NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.38k stars 13.6k forks source link

hide boot messages when plymouth is enabled #32556

Open davidak opened 6 years ago

davidak commented 6 years ago

Issue description

Plymouth is used to prevent boot messages from being displayed. That does not work completely.

/cc @abbradar @michaelpj

Steps to reproduce

NixOS system with Grub 2 and Xfce.

  1. boot.plymouth.enable = true;
  2. nixos-rebuild switch
  3. reboot
  4. you still get these messages

virtualbox_nixos_11_12_2017_06_02_11

Technical details

ghost commented 6 years ago

Yep, not great. With latest nixos-unstable On boot: grub -> few stage 1 messages -> Plymouth splash -> few stage 1 messages for a moment -> tty login prompt for a moment -> display manager [ on some hardware only - On reboot: blinking cursor for some time -> Plymouth splash for a moment ]

michaelpj commented 6 years ago

Yeah, currently we install Plymouth into the stage 2 of the initrd. So you don't get it until then, and if if stage 2 is very fast, you won't see much of it at all! I don't know why it goes into stage 2, @abbradar set it up initially, so might know.

ghost commented 6 years ago

And to fix

tty login prompt for a moment -> display manager

We need to provide systemd units for each display manager. See https://wiki.archlinux.org/index.php/plymouth#Smooth_transition

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
rileyinman commented 4 years ago

This is still important, it just has not been worked on.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

davidak commented 3 years ago

This is still needed for good UX.

peterhoeg commented 3 years ago

I have patches here, but cleaned up yet and ready for submission. With the latest plymouth we can show the UEFI vendor logo during boot which is quite nifty. Also just sitting in my local patch queue.......

bobvanderlinden commented 3 years ago

@peterhoeg that sounds great! Did you submit your patches somewhere already?

peterhoeg commented 3 years ago

Crucially I had left out a "not" in my earlier comment that should have been "but not cleaned up yet and ready for submisssion"... So there's that.

I'll allocate some time for this Soonish(tm). I'll ping you guys here when it's ready for testing. I have it working on one laptop here but not another although I'm not sure if this is related to what I did or the laptop in question.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

maydayv7 commented 3 years ago

(just bumping the issue)

daanhenke commented 2 years ago

Does anyone know a fix for this issue on 22.11? Or is it impossible to install the package into the stage1 initramfs?

maydayv7 commented 2 years ago

I'm using systemd-boot with GDM and plymouth with the following configuration on 21.11:

{
  console = {
    font = "ter-132n";
    packages = [pkgs.terminus_font];
    useXkbConfig = true;
    earlySetup = false;
  };

  boot = {
    consoleLogLevel = 0;
    initrd.verbose = false;
    plymouth.enable = true;
    kernelParams = [
      "quiet"
      "splash"
      "boot.shell_on_fail"
      "i915.fastboot=1"
      "loglevel=3"
      "rd.systemd.show_status=false"
      "rd.udev.log_level=3"
      "udev.log_priority=3"
    ];

    loader = {
      timeout = lib.mkDefault 0;
      efi.canTouchEfiVariables = true;
      systemd-boot = {
        enable = true;
        editor = false;
        configurationLimit = 100;
      };
    };
  };
}

It works flawlessly, displays the logo, without any text on boot/shutdown

TLATER commented 2 years ago

It works flawlessly, displays the logo, without any text on boot/shutdown

That "flawlessly" is somewhat arguable, the point of plymouth in my mind has always been that you can get logs by pressing escape, in case you need them, so disabling all logging seems a bit counter that :)

Using boot.initrd.systemd.enable is probably the way forward, but from my experimentation this still shows the stage1 logs (and a line stating something along the lines of "starting plymouth"), followed by some console flickering when switching to lightdm.

pmarreck commented 2 years ago

Stuck on grub2 for now due to zfs-on-root (although if someone wants to provide a guide to get zfs-on-root working with systemd-boot, that'd be great!), and would also like the option to see a nicer boot and making console text optional. When you work on your nixos config for hours to get things just right, this kind of thing is the icing on the cake.

I don't use LUKS, so I'm fine with an option that doesn't yet work with LUKS (some protection in place for those who do but try to enable plymouth, might be warranted)

pmarreck commented 2 years ago

EDIT: I got it to work. Plymouth is now uninterrupted. My (current) config is on my profile, I'm not sure exactly which combination of bits makes it work but one of the configs suggested in the recent comments helped. Note that a previous incarnation/attempt at this actually hid a real error/problem (regarding mounting my bpool in time), and the only symptom of that was that it kept dumping me into a root login at boot which I could just control-D out of, so be aware that you might want to turn it off sometimes.

mainrs commented 2 years ago

[...] so be aware that you might want to turn it off sometimes.

So pressing escape to see the boot logs is not possible?

pmarreck commented 2 years ago

@mainrs I don't think that worked for me unfortunately. I too would like that feature or something like it (like holding down Shift, etc.)

pmarreck commented 2 years ago

@mainrs Nevermind, escape DID work! It does show the full boot text after hitting it. So everything is sweet now :)

heywoodlh commented 1 year ago

Just FYI, this is my config to suppress boot messages on my machines:

  boot = {
    kernelParams = [ "quiet" "splash" ];
    plymouth.enable = true;
    consoleLogLevel = 0;
    initrd.verbose = false;
  };
davidak commented 1 year ago

@heywoodlh that has no effect on my system using grub2. Do you use systemd-boot?

https://www.youtube.com/watch?v=4_C8l3YhGwM

heywoodlh commented 1 year ago

@davidak Ah yes, sorry, should have clarified: I am using systemd-boot.

TLATER commented 1 year ago

https://www.youtube.com/watch?v=4_C8l3YhGwM

Most of that appears to be grub showing stuff, which happens before even the Linux kernel takes over, and won't be affected by any of the systemd/plymouth configuration. That's up to configuring grub.

After grub finishes "booting the kernel" you get a blank screen for a while, which I assume is most of stage 1. It's blank because you've disabled all logging for that portion of the boot - ideally plymouth would start much earlier here, so you don't need to disable stage 1 logging (and can make it visible through escape).

Finally just before stage 1 hands over to stage 2 plymouth finally starts (so that it can ask for decryption stuff), but as lightdm takes over you get tty1 flickering again. I'm pretty sure it's possible to resolve that as well, I've seen fedora systems boot without that flicker.

I think the current state is:

codeiimon commented 1 month ago

I was having a similar issue and just wanted to post my solution to this (Tho I am a newbie, so take this with caution). I'm currently using grub on an intel system and could only get plymouth to show on system shutdown but not on system boot. What fixed it for me was add the 'i915' kernel module to my initrd.kernalModules like so:

boot.initrd.kernelModules = [ "i915" ];

What led me to the answer was this reddit post linked here.

Also, I'm not sure if this is necessary, but I also added these lines of code to hide logs on boot:

boot.initrd.verbose = false;
boot.consoleLogLevel = 0;
boot.kernelParams = [
        "quiet"
        "splash"
        "boot.shell_on_fail"
        "i915.fastboot=1"
        "loglevel=3"
        "rd.systemd.show_status=false"
        "rd.udev.log_level=3"
        "udev.log_priority=3"
];
jmickelin commented 2 weeks ago

@codeiimon Thank you! This comment led me down the right track. It also does work without the lines to disable the logs, for what it's worth. i915.fastboot=1 seems to prevent the display of the console again between Plymouth closing and the display manager starting.

An alternative method that doesn't require adding any new modules in the initrd image is to force Plymouth to use the SimpleDRM driver. By default it hesitates to do so (waiting for some udev probing to detect "better" options), but reluctantly ends up using it after an annoyingly long timeout. You can tell it to go for SimpleDRM immediately by adding plymouth.use-simpledrm to the kernel command line:

boot.kernelParams = [
  ...
  plymouth.use-simpledrm
  ...
];

(It seems that the Plymouth developers are considering making this the default in future versions: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/110)

Here is a full, minimal, example:

  boot.loader.systemd-boot.enable = true; # For reference, since I see no reason why this wouldn't work with other bootloaders.

  boot.initrd.systemd.enable = true; # (optional, experimental) Needed to show the decryption prompt in Plymouth.
  boot.plymouth.enable = true;
  boot.kernelParams = [
    "plymouth.use-simpledrm"
  ];

(note that "splash" isn't strictly needed either, since it should already be added by boot.plymouth.enable = true;).


As for the flicker free boot sequence mentioned in previous posts, I found this summary of how Fedora does it on Intel GPU machines, though it might be out of date compared to what they're currently doing: https://fedoraproject.org/wiki/Changes/FlickerFreeBoot It relies on that i915.fastboot parameter. I assume this means that the initrd does need to bundle the i915 module.