Incredably long boot time (2 mins+) for my brother sharing same configuration as me

I manage multiple systems with a single NixOS configuration, me and my brother’s laptops being two of them. However, my brother has had 2 mins+ boot times for the entire time since he’s switched to Linux afaik (the better part of a year ago), when he previously used Bazzite. Now however, he still has this issue even when sharing a configuration with me, with his being basically a pretty barebones system that he can use flatpaks and other stuff imperatively.

It’s worth noting that he has an Nvidia system, just because I know Nvidia is a pain point, but I don’t know if this is the source of his problems.

Anyways, here’s some information about boot times I got from his system, to try help with debugging the issue.

$ 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 @1min 37.119s
└─multi-user.target @1min 37.118s
  └─tailscaled.service @1min 36.618s +500ms
    └─NetworkManager-wait-online.service @1min 32.290s +4.324s
      └─NetworkManager.service @1min 31.575s +714ms
        └─network-pre.target @1min 31.573s
          └─resolvconf.service @1min 31.515s +56ms
            └─basic.target @1min 31.488s
              └─dbus-broker.service @1min 31.404s +84ms
                └─dbus.socket @1min 31.400s +76us
                  └─sysinit.target @1min 31.386s
                    └─systemd-update-utmp.service @1min 31.295s +21ms
                      └─systemd-tmpfiles-setup.service @1min 31.257s +36ms
                        └─local-fs.target @1min 31.253s
                          └─run-wrappers.mount @1min 31.226s +26ms
                            └─local-fs-pre.target @1.285s
                              └─systemd-tmpfiles-setup-dev.service @1.276s +9ms
                                └─systemd-tmpfiles-setup-dev-early.service @1.252s +18ms
                                  └─kmod-static-nodes.service @1.239s +11ms
                                    └─systemd-journald.socket
                                      └─system.slice
                                        └─-.slice
$ systemd-analyze
Startup finished in 6.231s (firmware) + 1.050s (loader) + 512ms (kernel) + 22.851s (initrd) + 1min 37.186s (userspace) = 2min 7.831s 
graphical.target reached after 1min 37.119s in userspace.

And the output of systemd-analyze plot:

If there’s any more info I can give to help debug, please let me know! :smiley:
Thank you in advance for anyone willing to try help with this issue.

I’m noticing now that the image has gotten really compressed, is there somewhere I can upload it or the original svg file with it still being readable?

You can probably just upload your SVG here and send over the resulting link:

I’ve tried that (and I guess should’ve mentioned it, sorry), but for some reason I can’t upload to catbox for some reason (neither the original svg or the png):

Hmm, are you behind a VPN or in a blocked country?
I don’t know what other options are better if you can’t upload full-res SVG files here on Discourse.

I’m not in a blocked country no, but I thought of a solution, I uploaded the svg to a paste site where you can download it like so:

curl https://tpaste.us/oDqr > plot.svg

I know it’s not ideal, but it’s kinda the best I could come up with.

Would be easier if you just share a link to your repo if its public mate. Seems long.

Alright, I uploaded a public version of the repo with the configuration for his system only kept in tact, with personal info removed. Kladky/nix-config-thinkstation - Codeberg.org

The two plot files are available there too

From what I see can you answer if you manually partitioned your machine and did luks encryption as plymouth and your luks unlocking is the main issue.

When you formatted your disk how did you format it, full disk encryption and LVM management?

I think you may have messed up a step mate.

  1. format - gpt
  2. partition EFI and Root
  3. encrypt Root,
  4. open encryption,
  5. pvcreate,
  6. vgcreate,
  7. lvcreate
  8. then create your ext4 or btrfs or whatever system you want to use
  9. mkswap - for hibernation purposes on a laptop same as your ram
  10. then nixos-generate-config
  11. then add the luks device info of your root partition in your configuration correctly

I don’t think so, we just did automatic partitioning via the GUI installer, like I did for my own system, which doesn’t have this issue.

regenerate your nixos hardware config

and do a diff of the 2 files and share.

Also can you do an lsblk

Check that your ROOT and your SWAP are declared correctly mate.

my thought is you may need to declare it like so

boot.initrd.luks.devices."luks-eb51a538-e39a-4ee0-82e7-7f59bffe8e16" = {
  device = "/dev/disk/by-uuid/eb51a538-e39a-4ee0-82e7-7f59bffe8e16";
};

in your hosts/zenbook/configuration.nix and delete the incorrect entry in you hardware-configuration.nix

My average boot time on most of my nixos machines is anywhere between 30-40 seconds usually because I like having the plymouth unlock icon if I removed it the startup would be faster.

systemd-analyze critical-chain                                                                                                                     took 1s  15:30 
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 @18.376s
└─multi-user.target @9.492s
  └─mullvad-daemon.service @9.492s
    └─network-online.target @9.489s
      └─NetworkManager-wait-online.service @4.047s +5.441s
        └─NetworkManager.service @2.581s +1.463s
          └─network-pre.target @2.580s
            └─resolvconf.service @2.498s +67ms
              └─basic.target @2.475s
                └─dbus-broker.service @2.411s +63ms
                  └─dbus.socket @2.406s +171us
                    └─sysinit.target @2.394s
                      └─systemd-update-utmp.service @2.322s +10ms
                        └─auditd.service @2.294s +26ms
                          └─systemd-tmpfiles-setup.service @2.267s +25ms
                            └─systemd-journal-flush.service @1.295s +272ms
                              └─systemd-journald.service @1.226s +67ms
                                └─systemd-journald-audit.socket @1.235s +52us
                                  └─system.slice
                                    └─-.slice

Looks like you’re right, I was missing that from the configuration. I’ll try test it tomorrow and see if that helps, thank you!

The diff btw:

<   boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usbhid"];
---
>   boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"];
32c32,34
<   swapDevices = [];
---
>   swapDevices = [
>     {device = "/dev/mapper/luks-eb51a538-e39a-4ee0-82e7-7f59bffe8e16";}
>   ];

lsblk:

NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1                                       259:0    0 476.9G  0 disk  
├─nvme0n1p1                                   259:1    0     1G  0 part  /boot
├─nvme0n1p2                                   259:2    0 459.6G  0 part  
│ └─luks-8caeef9a-1432-468c-966f-70b5049c9969 254:0    0 459.6G  0 crypt /nix/store
│                                                                        /
└─nvme0n1p3                                   259:3    0  16.3G  0 part

Hey hey, that did the trick! :smiley: Thank you for all the help, this has really been bugging him for a while, so I’m glad it’s finallly fixed. :face_holding_back_tears: