You are not logged in.

#1 2022-11-23 11:03:34

Czarnodziej
Member
From: Poland
Registered: 2017-02-20
Posts: 11
Website

systemd-boot takes ages to initially appear

systemd-boot:

Startup finished in 16.046s (firmware) + 20.635s (loader) + 1.352s (kernel) + 1min 14.220s (userspace) = 1min 52.255s

refind:

Startup finished in 10.071s (firmware) + 2.990s (loader) + 1.329s (kernel) + 1min 7.880s (userspace) = 1min 22.272s

Over 17 seconds of difference in loader stage before systemd-boot menu appears on screen during bootup. Refind menu appears almost instantly.

Issue started to appear after systemd-update v252

Additional info:
nvme ssd, dual boot with windows

Offline

#2 2022-11-23 12:03:23

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,222

Re: systemd-boot takes ages to initially appear

I have systemd-boot on several machines and the loader section of systemd-analyze does not take as long as your quoted time. On one dual boot laptop I have with both arch and Windows 10, for example:

$ systemd-analyze
Startup finished in 4.416s (firmware) + 4.423s (loader) + 2.699s (kernel) + 3.097s (initrd) + 6.136s (userspace) = 20.772s 
graphical.target reached after 6.136s in userspace.

and on a desktop server with an nvme ssd drive:

$ systemd-analyze
Startup finished in 4.953s (firmware) + 1.768s (loader) + 1.907s (kernel) + 1.291s (initrd) + 11.279s (userspace) = 21.200s

The second is a server so will inevitably take longer overall as it has to start a number of services, but the second example is single boot to arch only.  So it depends on the detail of how the system is set up,  particularly the sd-bootor loader entries, and whether or not the efi is on the same partition as the loader entries and kernel, or whether or not a separate XBOOTLDR partiion contains /boot, for sd-boot,, and may also depend on other factors including how systemd-boot interacts with the uefi on a particular motherboard.

Does systemd-analyze critical-chain point to any additional info about which part of the boot is taking time?

Last edited by mcloaked (2022-11-23 12:11:24)


Mike C

Offline

#3 2022-11-23 13:32:39

Czarnodziej
Member
From: Poland
Registered: 2017-02-20
Posts: 11
Website

Re: systemd-boot takes ages to initially appear

[root:~] # 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.

└─lightdm.service @2.291s +12ms
  └─systemd-user-sessions.service @2.285s +3ms
    └─nss-user-lookup.target @2.306s
[root:~] # cat /boot/loader/entries/*
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/archssd-root rw
[root:~] # mv temp/arch-snapshot.conf /boot/loader/entries/
[root:~] # cat /boot/loader/entries/*
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/archssd-root rw
title Arch Linux Snapshot
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/archssd-root rw systemd.unit=make-snapshots.target
[root:~] # cat /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/archssd-root rw
[root:~] # cat /boot/loader/entries/arch-snapshot.conf
title Arch Linux Snapshot
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/archssd-root rw systemd.unit=make-snapshots.target
[root:~] # ll /boot
drwxr-xr-x   - root 23 lis 07:58 EFI
drwxr-xr-x   - root 23 lis 14:27 loader
drwxr-xr-x   - root 19 lis 12:20 memtest86+
.rwxr-xr-x 51k root 22 lis 07:05 amd-ucode.img
.rwxr-xr-x 46M root 22 lis 12:39 initramfs-linux-fallback.img
.rwxr-xr-x 20M root 22 lis 12:39 initramfs-linux.img
.rwxr-xr-x  99 root 19 lis 11:43 refind_linux.conf
.rwxr-xr-x 11M root 19 lis 11:44 vmlinuz-linux

EFI partition:  BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition", shared with windows

Offline

#4 2022-11-23 16:35:28

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,222

Re: systemd-boot takes ages to initially appear

In your bootloader entries I notice that you have the amd-ucode.img before the initramfs.img lines - I don't know if that matters but I always put the microcode image initrd line after the main initramfs line.

So in this laptop my arch kernel entry is:

$ cat /boot/loader/entries/linux-arch.conf 
#
# linux-arch.conf
#
title   Linux Arch
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
initrd  /intel-ucode.img 
options root="UUID=xxxxx-xxxxxx-xxxxxx" radeon.runpm=0 rw audit=0

Since yours boots but just takes longer than expected this may not matter but worth checking.

Also running "systemd-analyze blame" may give additional info about any components that took extra time in the boot process.

Last edited by mcloaked (2022-11-23 16:37:59)


Mike C

Offline

#5 2022-11-23 16:41:52

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: systemd-boot takes ages to initially appear

mcloaked wrote:

In your bootloader entries I notice that you have the amd-ucode.img before the initramfs.img lines - I don't know if that matters but I always put the microcode image initrd line after the main initramfs line.

So in this laptop my arch kernel entry is:

$ cat /boot/loader/entries/linux-arch.conf 
#
# linux-arch.conf
#
title   Linux Arch
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
initrd  /intel-ucode.img 
options root="UUID=xxxxx-xxxxxx-xxxxxx" radeon.runpm=0 rw audit=0

Since yours boots but just takes longer than expected this may not matter but worth checking.

Also running "systemd-analyze blame" may give additional info about any components that took extra time in the boot process.

Unless I'm mistaken, all that would do is skip the ucode image entirely. Not what you want.

Offline

#6 2022-11-23 16:48:22

Czarnodziej
Member
From: Poland
Registered: 2017-02-20
Posts: 11
Website

Re: systemd-boot takes ages to initially appear

mcloaked wrote:

Also running "systemd-analyze blame" may give additional info about any components that took extra time in the boot process.

Isn't it after the kernel loads?

[root:~] # systemd-analyze blame
1min 2.046s reflector.service
     5.210s NetworkManager-wait-online.service
     2.765s docker.service
     1.832s systemd-modules-load.service
      528ms dev-mapper-archssd\x2droot.device
      269ms systemd-hwdb-update.service
      171ms mnt-rpi4.mount
      153ms user@1000.service
      131ms boot.mount
      124ms systemd-journal-flush.service
      104ms lvm2-monitor.service
       78ms systemd-fsck@dev-disk-by\x2duuid-abc9eab5\x2da602\x2d4d82\x2d85f8\x2d2a74ec2582ad.service
       72ms systemd-udev-trigger.service
       71ms dev-disk-by\x2duuid-4e44ad4a\x2d574b\x2d4e63\x2da00f\x2dc912995a9b34.swap
       59ms ldconfig.service
       48ms systemd-journald.service
       39ms accounts-daemon.service
       39ms libvirtd.service
       37ms lm_sensors.service
       33ms systemd-timesyncd.service
       27ms systemd-fsck@dev-disk-by\x2duuid-502D\x2d0557.service
       25ms systemd-tmpfiles-setup.service
       25ms systemd-udevd.service
       24ms systemd-sysusers.service
       23ms systemd-logind.service
       23ms systemd-boot-update.service
       22ms systemd-tmpfiles-setup-dev.service
       20ms bluetooth.service
       20ms NetworkManager.service
       16ms systemd-random-seed.service
       11ms dbus.service
       11ms dev-hugepages.mount
       10ms dev-mqueue.mount
       10ms sys-kernel-debug.mount
        9ms polkit.service
        9ms sys-kernel-tracing.mount
        9ms systemd-machined.service
        9ms kmod-static-nodes.service
        8ms modprobe@fuse.service
        8ms modprobe@configfs.service
        7ms modprobe@drm.service
        7ms systemd-journal-catalog-update.service
        7ms lightdm.service
        7ms systemd-remount-fs.service
        7ms alsa-restore.service
        4ms user-runtime-dir@1000.service
        4ms systemd-update-utmp.service
        3ms home.mount
        3ms systemd-rfkill.service
        3ms systemd-sysctl.service
        2ms sys-kernel-config.mount
        2ms docker.socket
        2ms systemd-update-done.service
        2ms systemd-user-sessions.service
        2ms rtkit-daemon.service
        1ms sys-fs-fuse-connections.mount
        1ms tmp.mount

Offline

#7 2022-11-23 16:48:51

d.ALT
Member
Registered: 2019-05-10
Posts: 914

Re: systemd-boot takes ages to initially appear

Scimmia wrote:
mcloaked wrote:

In your bootloader entries I notice that you have the amd-ucode.img before the initramfs.img lines - I don't know if that matters but I always put the microcode image initrd line after the main initramfs line.

So in this laptop my arch kernel entry is:

$ cat /boot/loader/entries/linux-arch.conf 
#
# linux-arch.conf
#
title   Linux Arch
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
initrd  /intel-ucode.img 
options root="UUID=xxxxx-xxxxxx-xxxxxx" radeon.runpm=0 rw audit=0

Since yours boots but just takes longer than expected this may not matter but worth checking.

Also running "systemd-analyze blame" may give additional info about any components that took extra time in the boot process.

Unless I'm mistaken, all that would do is skip the ucode image entirely. Not what you want.

Yes

initrd
is the initrd cpio image to use when executing the kernel. This key may appear more than once in which case all specified images are used, in the order they are listed.

(https://uapi-group.org/specifications/s … ification/

Microcode updates must otherwise be enabled by adding /boot/amd-ucode.img or /boot/intel-ucode.img as the first initrd in the bootloader configuration file.

(https://wiki.archlinux.org/title/Microc … trd_images)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#8 2022-11-23 20:02:20

Czarnodziej
Member
From: Poland
Registered: 2017-02-20
Posts: 11
Website

Re: systemd-boot takes ages to initially appear

I've checked systemd-boot build from source, version 251 and it appears instantly. I'm gonna bisect it and create issue at systemd github.

EDIT:
https://github.com/systemd/systemd/issues/25510

Last edited by Czarnodziej (2022-11-24 07:34:38)

Offline

Board footer

Powered by FluxBB