NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.07k stars 14.13k forks source link

systemd-stage-1/plymouth: Password prompt takes a long time to appear #266804

Open ElvishJerricco opened 12 months ago

ElvishJerricco commented 12 months ago

Describe the bug

With both systemd-initrd and plymouth enabled, the password prompt takes a significant amount of time to appear; about 8 seconds. The logs indicate that plymouth is ready and idle during that whole time, and there's no messages indicating an event to trigger the prompt to appear when it does. If the splash kernel parameter is removed, then the console-based password prompt appears immediately as expected.

Steps To Reproduce

  1. boot.initrd.systemd.enable = true;
  2. boot.plymouth.enable = true;
  3. Use an encrypted root file system.

Expected behavior

The plymouth password prompt should appear extremely quickly after initrd starts.

/cc @littlejohn24

amaxine commented 10 months ago

I've noticed that the delay doesn't occur with plymouth enabled when using systemd boot from lanzaboote. With no lanzaboote (and no secure boot) I was getting this on every boot.

ElvishJerricco commented 7 months ago

Finally found something about this. If I enable plymouth debug logging, I see this:

00:00:00.659 ../src/libply-splash-core/ply-device-manager.c:498:create_devi: found device /sys/devices/platform/simple-framebuffer.0/drm/card0
00:00:00.659 ../src/libply-splash-core/ply-device-manager.c:505:create_devi: device is initialized
00:00:00.660 ../src/libply-splash-core/ply-device-manager.c:509:create_devi: found node /dev/dri/card0
00:00:00.660 ../src/libply-splash-core/ply-device-manager.c:396:create_devi: device subsystem is drm
00:00:00.661 ../src/libply-splash-core/ply-device-manager.c:400:create_devi: ignoring since we only handle SimpleDRM devices after timeout

And then 8 seconds later,

00:00:08.663 ../src/libply-splash-core/ply-device-manager.c:1237:create_dev: Timeout elapsed, looking for devices from udev

and the splash shows up.

So whatever this "SimpleDRM" thing is, plymouth doesn't like it.

EDIT: Looks like we can tweak this in the DeviceTimeout setting in plymouthd.conf, and you can use a plymouth.use-simpledrm kernel param to disable this behavior entirely.

ElvishJerricco commented 7 months ago

Yea, plymouth deliberately refuses to use simpledrm devices. You can use plymouth.use-simpledrm to override this, but I think this has the drawback that once amdgpu (or your equivalent) loads, the splash dies and never recovers. I'm not sure that's how that's working though.

nixos-discourse commented 6 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/get-plymouth-to-show-password-prompt-for-encrypted-root/24916/9

misuzu commented 6 months ago

I've noticed that the delay doesn't occur with plymouth enabled when using systemd boot from lanzaboote. With no lanzaboote (and no secure boot) I was getting this on every boot.

Is it possible that there's something wrong with our systemd-boot?

arthsmn commented 6 months ago

I've noticed that the delay doesn't occur with plymouth enabled when using systemd boot from lanzaboote. With no lanzaboote (and no secure boot) I was getting this on every boot.

Using lanzaboote and it's still delaying.

deviantsemicolon commented 3 months ago

I've also noticed this. it isn't a big deal. just annoying

ElvishJerricco commented 3 months ago

Yea, like I said, Plymouth just doesn't like SimpleDRM graphics, so it sits around for 8 seconds before giving up and using it anyway. The problem "goes away" if you include your graphics drivers in initrd (though this causes an unsightly graphical flicker during stage 1 that likely also takes some time), or you can force it to use SimpleDRM with plymouth.use-simpledrm on the cmdline.

misuzu commented 3 months ago

https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/323

ElvishJerricco commented 3 months ago

@misuzu That's interesting; that change seems to resolve an issue where simpledrm takes too long to be initialized, which is not at all what we're seeing here. In NixOS, simpledrm isn't used at all at first unless you pass plymouth.use-simpledrm on the cmdline, which is why it waits 8 seconds to fall back to it. The issue they describe in that merge request says that even simpledrm was timing out and it was falling all the way back to text mode.

nixos-discourse commented 4 days ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/oem-logo-blinks-plymouth-not-shown-correctly/55490/2