Boot speed-up

I ran sudo systemd-analyze blame and noticed that I had a few things which were causing the great majority of boot slow-down.

systemd-udev-settle.service
This is used by LVM (Logical Volume Manager), a sort of software RAID or logic layer that can make several hard-drives pretend to act as if they are one hard drive.

Obviously, if you're running a setup which requires LVM, you cannot disable this, but I'm not... and in fact, this was interfering with ZFS... my L2ARC cache drive on the rpool was designated by its PARTUUID. When I'd reboot to the Zorin OS USB, then boot back into the installed Zorin OS, it would change to the device path and node (ie: /dev/sdf or whatever), then it would fault. This happened several times, each time I would add it back in as a cache drive using the PARTUUID: sudo zpool add rpool cache 112ff53e-6b95-874a-bb76-a2a3d1978ebf, and each time, it'd change to the device path and node, then fault. Disabling systemd-udev-settle.service fixed that. Further, systemd-udev-settle.service is deprecated and not recommended to be run, so if you don't absolutely need it for LVM, you can disable it:

Check its status:
sudo systemctl status systemd-udev-settle.service

Stop it:
sudo systemctl stop systemd-udev-settle.service

Disable it (it can still be called by other programs and start up):
sudo systemctl disable systemd-udev-settle.service

Mask it so no matter what, it can't start up:
sudo systemctl mask systemd-udev-settle.service

That cut 12 seconds from my boot time.

I did the same for:
Don't run this if you boot your os from a networked drive rather than a SSD/HDD:

sudo systemctl status NetworkManager-wait-online.service
sudo systemctl stop NetworkManager-wait-online.service
sudo systemctl disable NetworkManager-wait-online.service
sudo systemctl mask NetworkManager-wait-online.service

Don't run this if you use dial-up internet:

sudo systemctl status pppd-dns.service
sudo systemctl stop pppd-dns.service
sudo systemctl disable pppd-dns.service
sudo systemctl mask pppd-dns.service

If you don't need or want location awareness / geolocation:

sudo systemctl status geoclue
sudo systemctl stop geoclue
sudo systemctl disable geoclue
sudo systemctl mask geoclue

If you're not so worried about getting the exact right color in a photo or video:

sudo systemctl status colord
sudo systemctl stop colord
sudo systemctl disable colord
sudo systemctl mask colord

If you want to turn off what Windows calls "file indexing" (searching through, cataloging and databasing files to make your file searches faster):

tracker reset --hard
sudo systemctl status tracker-store.service
sudo systemctl stop tracker-store.service
sudo systemctl disable tracker-store.service
sudo systemctl mask tracker-store.service

sudo systemctl status tracker-extract.service
sudo systemctl stop tracker-extract.service
sudo systemctl disable tracker-extract.service
sudo systemctl mask tracker-extract.service

sudo systemctl status org.freedesktop.Tracker1.Miner.Extract
sudo systemctl stop org.freedesktop.Tracker1.Miner.Extract
sudo systemctl disable org.freedesktop.Tracker1.Miner.Extract
sudo systemctl mask org.freedesktop.Tracker1.Miner.Extract

Now I get:

systemd-analyze
Startup finished in 10.474s (kernel) + 21.719s (userspace) = 32.194s 
graphical.target reached after 11.524s in userspace
systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @13.709s
└─udisks2.service @10.402s +3.306s
  └─basic.target @10.145s
    └─sockets.target @10.144s
      └─zsysd.socket @10.142s
        └─sysinit.target @10.000s
          └─snapd.apparmor.service @9.773s +225ms
            └─apparmor.service @8.696s +1.076s
              └─local-fs.target @8.695s
                └─run-user-1000-gvfs.mount @14.362s
                  └─run-user-1000.mount @13.225s
                    └─swap.target @8.154s
                      └─dev-disk-by\x2duuid-6d1b0ab8\x2d273e\x2d4fe7\x2d93b0\x2d90f74d7154d1.swap @8.146s +5ms
                        └─dev-disk-by\x2duuid-6d1b0ab8\x2d273e\x2d4fe7\x2d93b0\x2d90f74d7154d1.device @8.145s

In addition, apparently the Tracker service was consuming alot of drive space... before I did the above, I was sitting at 10.34 GB of hard drive space consumed. It is now at 8.07 GB.

You can see all of your services by:
sudo systemctl list-units --type=service --all

sudo systemctl list-unit-files --all

And if you want to unmask and re-enable a service, a good guide is here.

4 Likes

So kernel is as low as I can likely get it... now we work on userspace:
ps -eo pid,lstart,cmd

That lists the started programs by the time they were started. List yours, then look through for big gaps in the time.

The following lists CPU time per process:
sudo ps -aux

4 Likes

Replied so i can find this back later, good stuff.

1 Like

@Michel you could simply Bookmark the post for future reference. :smiley:

1 Like

Just upgrade to Kernel 6.09 via Ubuntu's mainline . And you have a much better boot-time without killing processes at all. Install libssl3 via the added repo's of ubuntu jammy jellyfish. Upgrade when Zorin offers to upgrade partial. So, today speaking, I am now on kernel 6.09 on Zorin 16.2 and all runs much more smooth. Kernel 5.15 - 65 was no good at all and was running behind on many bug-patchings. There always be bugs of course, but upgrading via de mainline PPA is by far a MAJOR improvement. And new hardware is better supported: such as the brand new MQA-DAC's for HiFi-equipment and streamings.

1 Like

I just performed your recommendation, and was not given the jammy jellyfish repositories. Apt cannot locate libssl3 and Zorin offers no upgrade option when running update.

sudo add-apt-repository ppa:cappelikan/ppa sudo apt update sudo apt install -y mainline

Out of the mainline app you install Kernel 6.09 ...... after that I ran the updates that gave me partial upgrade (so I choose). During install kernel click Y on the prompted suggestion.

click here for information on libssl3 and jammy repo's (Stack Exchange link)
in this link you'll find the howto and repo for Jammy in Zorin 16.2 and installing the required libssl3 package.
The First Answer is the good method
@337harvey

1 Like

I tried that, but the boot stops, says the kernel key is invalid, says I must load the kernel first, then dumps me back into Grub, where the only selection that will boot is the existing one (5.15.0.57.63~20.04.23).

That happens for any kernel I attempt to install (from 6.1.1 on down). So I've cleaned up the kernels I tried, and am doing more research.