Score:0

Minimal system services(units) and default targets

cn flag

Please forgive what may seem like a naive question. I have 30+ years in windows development and IT management, but rarely use Linux. I have an elderly laptop with only 4Gb mem and 4 core @ 2.53Ghz... I originally installed Ubuntu 14ish years ago and it's been a pretty stable box, I have kept up with distro upgrades and from about v19 on up i've noticed a performance and stability hit. currently 21.04 GNOME 3.38.5/X11

I don't use this for much, just app development with VSCode. I don't need any bells or whistles Ie. (web srvr, mail, printing Etc)... So... I have been reading about the boot sequence and going through the targets and how the units get started during boot because I am seeing processes running that I don't need like email and calendar stuff and a huge list of gnome- processes. I'm trying to slim it down to a bare minimum graphical UI.

Looking at the graphical.target it says that multi-user.target is required. Does it have to be? that target is full of dependencies. I only have one user and have no need to switch users. I do not want to reinstall from a minimal-system install CD. My Dev environment is set.

What is the best way to go about reducing my overhead and removing services/devices that I do not absolutely have to have?

Score:1
cn flag

Looking at the graphical.target it says that multi-user.target is required. Does it have to be?

Yes, it is; that is a core functionality of Linux. systemd does it like this:

 $  ls -al /lib/systemd/system/runlevel*
/lib/systemd/system/runlevel0.target -> poweroff.target
/lib/systemd/system/runlevel1.target -> rescue.target
/lib/systemd/system/runlevel2.target -> multi-user.target
/lib/systemd/system/runlevel3.target -> multi-user.target
/lib/systemd/system/runlevel4.target -> multi-user.target
/lib/systemd/system/runlevel5.target -> graphical.target
/lib/systemd/system/runlevel6.target -> reboot.target

Targets are for GROUPING units and do not take up time in the boot process. And targets are also not relevant for a running system. Nor do those impact performance. services do impact boot up speed; so those add to the time needed to get to the desktop.

A unit configuration file whose name ends in ".target" encodes information about a target unit of systemd, which is used for grouping units and as well-known synchronization points during start-up.

  • Single user target = rescue.target = rescue mode.
  • multi-user.target is the non-graphical part that sets up multi-user and console access. Basically the "server" version
  • graphical.target is the desktop.

Without it it would not be Linux :)


I only have one user and have no need to switch users

You have 1 physical person using your machine but there are lots of users on your system ;) But again: this has nothing to do with performance or improving it. All of these are dormant unless used.


Now for the main question.

What is the best way to go about reducing my overhead and removing services/devices that I do not absolutely have to have?

  • See top on command line for performance, power consumption, cpu usage etc and see if anything stands out. htop (needs to be installed) for a nice layout of the same info.
  • remove 3rd party drivers or switch on power saving mode for the graphics card
  • remove unwanted active services
  • clear out orphan libs with deborphan

To list all active services:

systemctl list-units --type=service --state=activ   

and to stop a service:

sudo systemctl disable {service}

This WILL keep the software installed though.

I am seeing processes running that I don't need like email and calendar stuff and a huge list of gnome- processes

Each will have a package name. Remove the software you do not want from "software" and the service will be removed too. Neither of them will improve speed or performance when removed though: when not used the impact on performance is close to zero. All of those are tied with the desktop manager and use the same service; you can not delete that one without deleting the desktop manager.

with only 4Gb mem and 4 core @ 2.53Ghz

Consider using a version with less requirements; Like Xubuntu or Lubuntu.

I do not want to reinstall from a minimal-system install CD. My Dev environment is set.

So prepare your setup to withstand a reinstall. Put all alterations you did in a text file so you can execute it after an install. Put all personal files on a separate partition so you can mount it during installation. Use software from source so you can install it on that partition. Put a symlink in your text file to make connect it to a binary in /bin or /usr/bin It is something that takes effort but you only need to do that once.

DoImagine avatar
cn flag
Thank you so much for your patience and very thorough answer. Was there a major change in the desktop/display manager somewhere between v18-20. I don't remember all this gnome stuff. If so can I keep the newer base and use a previous desktop mgr? Would there be any advantage to it? Thank you for your time.
cn flag
Over the years we went from upstart to systemd as the startup system and started using wayland als manager. Ubuntu is more resource heavy when using gnome.
DoImagine avatar
cn flag
That seems to be what I am running into. Thanks for your time and info
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.