Hey there,
I analyzed my boot process. I can not change the fact that grub is super slow on full disk encryption (FDE) with /boot encrypted, so I took a look at the kernel boot time.
All of this was run with the following boot parameters:
cat /proc/cmdline
BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=4.... rw rootflags=subvol=@ i8042.noaux debug --verbose cryptdevice=UUID=3...:luks-3... root=/dev/mapper/luks-3... quiet rd.udev.log_priority=3 vt.global_cursor_default=0 resume=/dev/mapper/luks-8... loglevel=7 ibt=off
1. amdgpu
(do not have a before/after kern.log of this, because it was cleaned up already)
Optimizing boot
First thing I found was a problem with the amdgpu
module.
I tried to disallow the module in modprobe.d
, but since it is hardcoded in /etc/mkinitcpio.conf
, I had to edit it there.
From:
MODULES=(crc32c-intel intel_agp i915 amdgpu radeon nouveau)
To:
MODULES=(crc32c-intel intel_agp i915 nouveau)
I also removed the radeon
part, since this is a Nvidia maschine.
I could have removed the nouveau
part too, I guess, since I am using Nvidia drivers, but since the driver did not act up during boot, I just kept it.
This shaved around 8-10 seconds of the boot time.
Root cause?
The package xf86-video-amdgpu
is installed because it is a dependency of garuda-video-linux-config
even though the hardware is not there. Same for intel and nuoveau.
This “problem” has been mentioned here already: Decouple `xf86-video-amdgpu` from `garuda-video-linux-config`
Possible other solution: Since the meta package is there to stay, could we maybe just disallow the modules that are not really needed from loading during boot after the hardware configuration has been determined?
This could happen during/after installation with a script, that is also triggerable in Garuda Maintenance or something.
This could leave the edge case of someone switching GPUs and not reinstalling open. But I guess Linux would be able to fallback to something by default, doesn’t it?
2. BTRFS raid6?
[ 7.733967] usb 1-14: new full-speed USB device number 4 using xhci_hcd
[ 7.861631] usb 1-14: New USB device found, idVendor=8087, idProduct=0029, bcdDevice= 0.01
[ 7.861728] usb 1-14: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 8.357784] scsi 1:0:0:0: Direct-Access Generic- SD/MMC 1.00 PQ: 0 ANSI: 6
[ 8.359942] sd 1:0:0:0: [sda] Media removed, stopped polling
[ 8.360606] sd 1:0:0:0: [sda] Attached SCSI removable disk
[ 33.599659] raid6: skipped pq benchmark and selected avx2x4
[ 33.599758] raid6: using avx2x2 recovery algorithm
[ 33.610322] xor: automatically using best checksumming function avx
There is a 25 second delay in between those two steps and there is no apparent reason for it.
sda
is a SD card slot with nothing in it.
The raid6
thing is part of the raid6_pq
module, which you can not prevent from loading in modprobe.d
, because it is indirectly loaded by BTRFS.
I do not use any raid6 configuration in BTRFS, so this seems superflous to run on every boot.
Question: Do you have any idea why this is happening?
3. In between BTRFS and Resume
[ 34.072993] Btrfs loaded, zoned=yes, fsverity=yes
[ 34.090708] BTRFS: device fsid 4... devid 1 transid 79225 /dev/dm-0 scanned by (udev-worker) (246)
[ 34.139958] BTRFS info (device dm-0): using crc32c (crc32c-intel) checksum algorithm
[ 34.140120] BTRFS info (device dm-0): using free space tree
[ 34.146766] BTRFS info (device dm-0): bdev /dev/mapper/luks-3... errs: wr 0, rd 0, flush 0, corrupt 2, gen 0
[ 34.196309] BTRFS info (device dm-0): enabling ssd optimizations
[ 52.973686] PM: Image not found (code -22)
[ 52.980366] BTRFS: device fsid 4... devid 1 transid 79227 /dev/mapper/luks-3... scanned by mount (283)
[ 52.980770] BTRFS info (device dm-0): using crc32c (crc32c-intel) checksum algorithm
[ 52.980804] BTRFS info (device dm-0): using free space tree
[ 52.983782] BTRFS info (device dm-0): bdev /dev/mapper/luks-3... errs: wr 0, rd 0, flush 0, corrupt 2, gen 0
[ 53.004411] BTRFS info (device dm-0): enabling ssd optimizations
As you see there is around an 18 second gap between some BTRFS things and [ 52.973686] PM: Image not found (code -22)
.
PM
has something todo with hibernation AFAIK. I understand that it takes some time to restore if I had resumed from hibernation, but why does it take 18 seconds to determine that there is nothing to do?
Question: Do you have any idea why this is happening?
The usual for completion’s sake:
garuda-inxi
System:
Kernel: 6.5.7-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
clocksource: tsc available: acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=4... rw rootflags=subvol=@
i8042.noaux debug --verbose
cryptdevice=UUID=3...:luks-3...
root=/dev/mapper/luks-3... quiet
rd.udev.log_priority=3 vt.global_cursor_default=0
resume=/dev/mapper/luks-8... loglevel=7
ibt=off
Desktop: KDE Plasma v: 5.27.8 tk: Qt v: 5.15.11 wm: kwin_x11 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:
Type: Laptop System: SchenkerGmbH product: XMG FUSION 15 (XFU15L19)
v: Late 2019 serial: <filter> Chassis: type: 10 v: 1.0 serial: N/A
Mobo: Intel model: LAPQC71B v: K54900-301 serial: <filter> UEFI: Intel
v: QCCFL357.0158.2022.1116.0856 date: 11/16/2022
Battery:
ID-1: BAT0 charge: 18.2 Wh (20.0%) condition: 91.2/93.5 Wh (97.6%)
volts: 10.5 min: 11.4 model: standard type: Li-ion serial: <filter>
status: discharging
CPU:
Info: model: Intel Core i7-9750H socket: BGA1440 (U3E1) note: check bits: 64
type: MT MCP arch: Coffee Lake gen: core 9 level: v3 note: check built: 2018
process: Intel 14nm family: 6 model-id: 0x9E (158) stepping: 0xA (10)
microcode: 0xF4
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
L3: 12 MiB desc: 1x12 MiB
Speed (MHz): avg: 800 min/max: 800/4500 base/boost: 792/8300 scaling:
driver: intel_pstate governor: powersave volts: 0.6 V ext-clock: 100 MHz
cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800
10: 800 11: 800 12: 800 bogomips: 62399
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities: <filter>
Graphics:
Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] driver: i915 v: kernel
arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1
empty: none bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300
Device-2: NVIDIA TU106M [GeForce RTX 2070 Mobile] vendor: Intel
driver: nvidia v: 535.113.01 alternate: nouveau,nvidia_drm non-free: 535.xx+
status: current (as of 2023-09) arch: Turing code: TUxxx
process: TSMC 12nm FF built: 2018-22 pcie: gen: 1 speed: 2.5 GT/s
lanes: 16 link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0
chip-ID: 10de:1f10 class-ID: 0300
Device-3: Chicony HD Webcam driver: uvcvideo type: USB rev: 2.0
speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-13:3 chip-ID: 04f2:b68b
class-ID: 0e02 serial: <filter>
Display: server: X.Org v: 21.1.8 with: Xwayland v: 23.2.1
compositor: kwin_x11 driver: X: loaded: modesetting,nvidia unloaded: nouveau
alternate: fbdev,intel,nv,vesa dri: iris gpu: i915 display-ID: :0
screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: eDP-1 model: BOE Display 0x084d built: 2018 res: 1920x1080
hz: 144 dpi: 142 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
ratio: 16:9 modes: 1920x1080
API: EGL v: 1.5 hw: drv: nvidia platforms: gbm: drv: nvidia
API: OpenGL v: 4.6.0 compat-v: 4.6 vendor: intel mesa v: 23.2.1-arch1.2
glx-v: 1.4 direct-render: yes renderer: Mesa Intel UHD Graphics 630 (CFL
GT2) device-ID: 8086:3e9b memory: 30.46 GiB unified: yes
API: Vulkan v: 1.3.264 layers: 4 device: 0 type: integrated-gpu name: Intel
UHD Graphics 630 (CFL GT2) driver: mesa intel v: 23.2.1-arch1.2
device-ID: 8086:3e9b surfaces: xcb,xlib device: 1 type: discrete-gpu
name: NVIDIA GeForce RTX 2070 with Max-Q Design driver: nvidia
v: 535.113.01 device-ID: 10de:1f10 surfaces: xcb,xlib device: 2 type: cpu
name: llvmpipe (LLVM 16.0.6 256 bits) driver: mesa llvmpipe
v: 23.2.1-arch1.2 (LLVM 16.0.6) device-ID: 10005:0000 surfaces: xcb,xlib
Audio:
Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel v: kernel
alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
chip-ID: 8086:a348 class-ID: 0403
Device-2: NVIDIA TU106 High Definition Audio vendor: Daewoo Telecom
driver: snd_hda_intel v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 16
link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.1 chip-ID: 10de:10f9
class-ID: 0403
API: ALSA v: k6.5.7-zen1-1-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 0.3.82 status: n/a (root, process) with:
1: pipewire-pulse status: active 2: wireplumber status: active
3: pipewire-alsa type: plugin 4: pw-jack type: plugin
tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Intel driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
port: 3000 bus-ID: 3d:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp61s0 state: down mac: <filter>
Device-2: Intel Wi-Fi 6 AX200 vendor: Rivet Networks Killer
driver: iwlwifi v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
bus-ID: 3e:00.0 chip-ID: 8086:2723 class-ID: 0280
IF: wlp62s0 state: up mac: <filter>
Bluetooth:
Device-1: Intel AX200 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-14:4 chip-ID: 8087:0029
class-ID: e001
Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
rfk-block: hardware: no software: yes address: <filter> bt-v: 5.2 lmp-v: 11
status: discoverable: no pairing: no
Drives:
Local Storage: total: 953.88 GiB used: 132.03 GiB (13.8%)
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 970 PRO 512GB
size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 1B2QEXP7 temp: 34.9 C
scheme: GPT
SMART: yes health: PASSED on: 22d 7h cycles: 1,135
read-units: 19,435,996 [9.95 TB] written-units: 15,868,819 [8.12 TB]
ID-2: /dev/nvme1n1 maj-min: 259:4 vendor: Samsung model: SSD 970 PRO 512GB
size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 1B2QEXP7 temp: 33.9 C
SMART: yes health: PASSED on: 24d 1h cycles: 1,565
read-units: 8,146,719 [4.17 TB] written-units: 11,135,964 [5.70 TB]
Partition:
ID-1: / raw-size: 442.32 GiB size: 442.32 GiB (100.00%)
used: 132.02 GiB (29.8%) fs: btrfs block-size: 4096 B dev: /dev/dm-0
maj-min: 254:0 mapped: luks-3...
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 6.6 MiB (2.2%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p1
maj-min: 259:1
ID-3: /home raw-size: 442.32 GiB size: 442.32 GiB (100.00%)
used: 132.02 GiB (29.8%) fs: btrfs block-size: 4096 B dev: /dev/dm-0
maj-min: 254:0 mapped: luks-3...
ID-4: /var/log raw-size: 442.32 GiB size: 442.32 GiB (100.00%)
used: 132.02 GiB (29.8%) fs: btrfs block-size: 4096 B dev: /dev/dm-0
maj-min: 254:0 mapped: luks-3...
ID-5: /var/tmp raw-size: 442.32 GiB size: 442.32 GiB (100.00%)
used: 132.02 GiB (29.8%) fs: btrfs block-size: 4096 B dev: /dev/dm-0
maj-min: 254:0 mapped: luks-3...
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: partition size: 34.31 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/dm-1 maj-min: 254:1
mapped: luks-8...
ID-2: swap-2 type: zram size: 31.19 GiB used: 14.2 MiB (0.0%)
priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 12
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 45.0 C pch: 61.0 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Processes: 338 Uptime: 1h 13m wakeups: 2 Memory: total: 32 GiB
available: 31.19 GiB used: 4.8 GiB (15.4%) igpu: 64 MiB Init: systemd v: 254
default: graphical tool: systemctl Compilers: gcc: 13.2.1 Packages:
pm: pacman pkgs: 1555 libs: 409 tools: octopi,pamac,paru
Shell: garuda-inxi (sudo) default: Bash v: 5.1.16 running-in: yakuake
inxi: 3.3.30
Garuda (2.6.17-1):
System install date: 2022-12-18
Last full system update: 2023-10-15
Is partially upgraded: No
Relevant software: snapper NetworkManager mkinitcpio nvidia-dkms
Windows dual boot: No/Undetected
Failed units:
systemd-analyze
Startup finished in 15.979s (firmware) + 1min 19.662s (loader) + 53.080s (kernel) + 7.427s (userspace) = 2min 36.150s
graphical.target reached after 7.427s in userspace.
systemd-analyze blame
5.033s systemd-modules-load.service
2.321s systemd-journal-flush.service
1.453s dev-mapper-luks\x2....device
1.353s systemd-tmpfiles-setup.service
981ms tmp.mount
946ms dev-zram0.swap
889ms boot-efi.mount
844ms NetworkManager.service
660ms systemd-udev-trigger.service
597ms systemd-tmpfiles-setup-dev-early.service
498ms systemd-random-seed.service
385ms udisks2.service
286ms systemd-binfmt.service
246ms systemd-udevd.service
225ms power-profiles-daemon.service
208ms polkit.service
202ms [email protected]
194ms upower.service
138ms proc-sys-fs-binfmt_misc.mount
132ms systemd-remount-fs.service
132ms systemd-sysctl.service
129ms systemd-backlight@backlight:intel_backlight.service
121ms home.mount
120ms [email protected]
119ms avahi-daemon.service
113ms systemd-tmpfiles-setup-dev.service
111ms systemd-fsck@dev-disk-by\x2duuid-B....service
108ms root.mount
108ms systemd-logind.service
104ms srv.mount
103ms lvm2-monitor.service
103ms systemd-tmpfiles-clean.service
102ms bluetooth.service
100ms var-cache.mount
97ms systemd-journald.service
96ms dev-mapper-luks\x2....swap
95ms var-log.mount
94ms ModemManager.service
92ms var-tmp.mount
83ms systemd-vconsole-setup.service
81ms plymouth-read-write.service
79ms systemd-timesyncd.service
75ms systemd-oomd.service
72ms linux-modules-cleanup.service
71ms plymouth-start.service
66ms garuda-pacman-snapshot-reject.service
63ms [email protected]
56ms garuda-pacman-lock.service
53ms dbus.service
52ms plymouth-quit.service
51ms [email protected]
44ms plymouth-quit-wait.service
29ms kmod-static-nodes.service
28ms [email protected]
25ms systemd-update-utmp.service
24ms pamac-daemon.service
23ms systemd-user-sessions.service
23ms wpa_supplicant.service
22ms docker.socket
22ms [email protected]
18ms [email protected]
16ms dev-hugepages.mount
16ms dev-mqueue.mount
16ms sys-kernel-debug.mount
15ms sys-kernel-tracing.mount
15ms sys-fs-fuse-connections.mount
14ms rtkit-daemon.service
14ms sys-kernel-config.mount
12ms systemd-rfkill.service
5ms modprobe@dm_mod.service