Fedora 29 takes longer to get to the virtual terminal prompt

Posted on . Updated on .

Although the upgrade to Fedora 29 was smooth as silk, as I mentioned in a previous post, I quickly noticed my system was taking slightly longer to give me the virtual terminal login prompt when booting up. Linux in general and Fedora in particular has always booted really fast for me, specially after switching to SSD drives some years ago. After a cold boot, I get the login prompt in less than 5 seconds from the Grub menu, so a few extra seconds are easily noticed.

To give you a bit of background information, I’m the kind of person that boots to a virtual terminal by default instead of a graphical login prompt, and I use the “text” plymouth theme. Normally, just after logging in, I go ahead and type “xs”, which is a fast alias I have to launch an X session using “startx” with a few parameters, which in turn ends up launching i3. But booting to a virtual terminal is very handy when I need to exit the X session in order to uninstall the proprietary NVIDIA drivers to upgrade an X11 package, mesa or the kernel. It’s also a bit faster when I don’t need to launch an X session for a basic task I want to do quickly. The inconvenience of having to type x+s+Enter after logging in is tiny, because it takes a fraction of a second to perform those 3 keystrokes, and my hands are already at the keyboard after typing my user password.

After experimenting a bit and measuring actual boot time with a chronometer, I verified my findings. Indeed, it was taking a bit over 9 seconds to get to the login prompt, which is at least twice as long as what I was used to. After analyzing the boot process with systemd-analyze and doing various experiments, I booted with systemd’s log level set to “debug” and I was finally able to verify what was happening. The prompt is given by the [email protected] unit, and it was taking 5 seconds to launch “agetty” after the unit was considered started. See the following boot log:

Nov 06 22:49:57 localhost.localdomain systemd[1]: [email protected]: Passing 0 fds to service
Nov 06 22:49:57 localhost.localdomain systemd[1]: [email protected]: About to execute: /sbin/agetty -o '-p -- \u' --noclear tty1 $TERM
Nov 06 22:49:57 localhost.localdomain systemd[1]: [email protected]: Forked /sbin/agetty as 613
Nov 06 22:49:57 localhost.localdomain systemd[1]: [email protected]: Changed dead -> running
Nov 06 22:49:57 localhost.localdomain systemd[1]: [email protected]: Job [email protected]/start finished, result=done
Nov 06 22:49:57 localhost.localdomain systemd[1]: Started Getty on tty1.
Nov 06 22:49:57 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=getty@tty1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

[Thousands of lines...]

Nov 06 22:50:02 localhost.localdomain systemd[613]: [email protected]: Executing: /sbin/agetty -o '-p -- \u' --noclear tty1 linux

That appeared to be the exact cause of my login prompt delay, but I wasn’t sure about why it was happening. However, a few web searches later I arrived to the conclusion it was due to the [email protected] unit being declared with Type=idle. According to systemd.service(5):

Behavior of idle is very similar to simple; however, actual
execution of the service program is delayed until all active jobs
are dispatched. This may be used to avoid interleaving of output of
shell services with the status output on the console. Note that
this type is useful only to improve console output, it is not
useful as a general unit ordering tool, and the effect of this
service type is subject to a 5s time-out, after which the service
program is invoked anyway.

Indeed, changing the unit to type “simple” restored the old behavior. I’ve investigated a bit and that unit has had that type for a long time, so my guess is the change I observed in boot time has been triggered by other changes in the Fedora boot process. Just for completeness, this is the list of units with type “idle” in my system, but the only one that matters to me is [email protected].

/usr/lib/systemd/system/[email protected]:30:Type=idle
/usr/lib/systemd/system/emergency.service:24:Type=idle
/usr/lib/systemd/system/rescue.service:23:Type=idle
/usr/lib/systemd/system/[email protected]:35:Type=idle
/usr/lib/systemd/system/[email protected]:40:Type=idle
/usr/lib/systemd/system/console-getty.service:25:Type=idle

It’s worth noting I don’t get text garbage on screen by changing the unit type to simple, at least in Fedora. First of all, the wait process was timing out in any case, so I could still get a garbaged prompt. Furthermore, when agetty is launched, plymouth seems to go away and I get a clean login prompt. Waiting for an idle system is futile, more so if the system boots slower than mine. Those reasons prompted me to file a bug report that hasn’t been updated since filed. Fedora’s systemd package has 146 open bugs as of the time I’m writing this and many of them are sitting there marked as “New” without being confirmed or assigned.

To change the unit type to “simple” in a non-intrusive way that survives system upgrades, the best way is to create a so-called drop-in file for it. As root, use:

systemctl edit [email protected]

That will launch a text editor and create a file named /etc/systemd/system/[email protected]/override.conf where you can change parts of the unit configuration. The contents should simply be:

[Service]
Type=simple

If you also boot to a virtual terminal, I hope this helps or at least encourages you to experiment a bit to see if you can boot faster.

Load comments