Booting takes too long, found any speedups? Here's one:

As my manner is I walk through all the messages in dmesg and the journal from time to time looking for reasons boot takes so long. I’ve found one that allows for a ~10s speedup recently. It seems to me that the time from gdm starting to the greeter actually displaying the login prompt is where the improvement occurs but I do not know how to prove that.

The global timezone is set to Etc/UTC and users can configure their own TZ as desired. This slows down the boot on systems with wireless. The symptom can be discovered in dmesg or

grep wireless /var/log/message
Feb 21 11:30:19 fedora wireless[1664]: Could not determine country! Unable to set regulatory domain.

iw reg get

After some investigation I added a COUNTRY variable

cat /etc/sysconfig/regdomain
COUNTRY=US

Now the wireless message is no longer logged during boot and

iw reg get

shows a regulatory domain is now set.

Before setting the regulatory domain

journalctl --no-pager -S 2025-02-21 -g 'Startup finished.*firmware'
Feb 21 11:30:22 fedora systemd[1]: Startup finished in 8.082s (firmware) + 3.100s (loader) + 1.542s (kernel) + 21.080s (initrd) + 26.683s (userspace) = 1min 489ms.

After setting the requlatory domain

journalctl --no-pager -S 2025-02-21 -g 'Startup finished.*firmware'
Feb 21 12:06:21 fedora systemd[1]: Startup finished in 8.222s (firmware) + 3.115s (loader) + 1.537s (kernel) + 21.974s (initrd) + 7.670s (userspace) = 42.521s.

That is still a very long time to boot. Any suggestions on further speedups?

2 Likes

You can create a chart that shows the time it took all processes to go through the boot process:

$ systemd-analyze plot > plot.svg
1 Like

Thanks @litemotiv. There is useful information out of systemd-analyze but not at all helpful in finding the regdomain delay, which is a quite significant delay.

I am looking for actual cases where speedups were discovered and documented. I am confident there are more so I am reaching out to this excelent community to see what others have found.

If the chart shows a red bar then it is a blocking process, meaning that it will actually delay the boot process. Wireless regdomain is likely non-blocking, so it may take some time but this will then usually run parallel to other startup processes.

There is much that occurs during boot with interactions that can be subtle. There is nothing in systemd-analyze that gives any hint that not having a regdomain caused a delay so I do not think process blocking or parallelism is involved in this case, wireless is internal to the kernel. Also I am pretty sure that the delay between gdm starting successfully and the login box showing up on screen are not included in the systemd[1] startup finished times. Now for a big ask:

Can you replicate the behavior and give your analysis?

I can’t replicate it, my journalctl mentions:

feb 21 10:36:54 fedora wireless[1121]: setting regulatory domain to NL based on timezone

You would have to set your timezone to Etc/UTC (timedatectl). Maybe also have to boot with no networking enabled so a timezone does not get chosen some other way. And make sure there is no /etc/sysconfig/regdomain COUNTRY set. Then you should at least get the wireless could not determine country message.

Some time ago, I noticed on one of my systems (a systemd-nspawn container) that if I masked systemd-hostnamed.service (i.e. systemctl mask systemd-hostnamed.service), it would boot much faster. It might have been something to do with it being a container though. I never really investigated. If you do try it and it does speed up your boot time, let us know. :slightly_smiling_face:

1 Like

It does seem to take it’s time…

feb 21 18:27:11 fedora systemd[1]: Started systemd-hostnamed.service - Hostname Service.
feb 21 18:27:41 fedora systemd[1]: systemd-hostnamed.service: Deactivated successfully.

[Edit] it saves about 1 second:

1 Like

Eh, not much then for the normal case I guess. I think it was around 5 secs for my containers.

@glb, great one.

What I’ve been doing is building systems with the hostname set on the kernel cmdline ie:

systemd.hostname=fedora.land
1 Like

The system does seem to wait until it has an active network connection, which kind of surprises me:

[Edit] i think it may be because i’m autoloading a few network locations as shared drives

[Edit2] i disabled networkmanager-wait-online.service and it shaved 8s off the boot time, everything still works as before.

2 Likes

I have encryoted drive on my laptop. I find it faster and yet safe to have gdm auto-login. This way the manual step is removed and boot feels faster.

1 Like

Do you use suspend or hibernate? What would happen if your laptop was stolen while asleep?

Though there are no logs to show it I do observer on the order of 10 seconds of delay between the time gdm is started and the time the greeter login box is displayed. I could see auto-login cutting into that delay.

Yes, I do use suspend many times a day. Screen locks in suspend, as well as after configurable idle time by screensaver. Then I need to either login via password, or fingerprint. So it’s locked anyhow, should it get stolen.