How to **really** suppress kernel messages during boot?

6,651

So apparently console=tty5 doesn't work or any virtual console for that matter. What does seem to work is console=ttyS0 set in GRUB_CMDLINE_LINUX (the GRUB_CMDLINE_LINUX_DEFAULT doesn't work for some reason, even though that option should send kernel parameters to normal boot, while GRUB_CMDLINE_LINUX - to both diagnostic and normal). I'll update this answer if I figure out anything else but so far this seems to be it.

Share:
6,651
Sergiy Kolodyazhnyy
Author by

Sergiy Kolodyazhnyy

Updated on September 18, 2022

Comments

  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy over 1 year

    I have Ubuntu Server 18.04 LTS. I want to suppress kernel messages shown on console during boot. (The type of [0.1234] kernel message thing that floods the screen ).

    THIS DID NOT WORK:

    • Changing /etc/systl.conf
    • Setting LogLevel=err or LogLevel=emerg in /etc/systemd/system.conf. This did in fact remove [ ok ] Blah blah type of messages but not [123.456] Something something type.
    • Changing GRUB settings. Even GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3 loglevel=0" (source). No, difference in loglevel=0 or loglevel=3. No, I did not forget to run sudo update-grub.
    • sudo dmesg -n 1 (source)
    • This,too. Don't mark this question as duplicate of that since agetty is completely unrelated to boot messages and OP's own answer does not work, like I mentioned above about GRUB part.
    • editing /etc/systemd/journal.conf to set ForwardToWall=no or MaxLevelWall=emerg
    • setting console=tty5 in /etc/default/grub ( source )
    • I removed plymouth completely - the messages still appear. Which also makes sense since it's not related to plymouth, it's not even started as service in systemd, and there's no GUI on this system.

    I'll probably be offering a bounty to the answer that can make a perfectly quiet boot setting and maybe downvote all those other answers because they're outdated and not useful at all and don't work at all. I've spent quite a considerable time on trying to figure this out with not much results.

    • Slava Knyazev
      Slava Knyazev over 5 years
      Why do you need this?
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @SlavaKnyazev Simply to have a clear screen during boot up until login prompt shows up cleanly, without boot messages mangling text when I type in my username and password and driving me mad ?
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 5 years
      I started to research this but a super-sleuth such as yourself would probably do better: Redirect /dev/tty or /dev/console to a file so it's never displayed on screen?
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @WinEunuuchs2Unix But it's Ubuntu Server. I do need to use /dev/tty1. I mean, i could switch to tty2, but . . . that's hacky
    • LucaM
      LucaM over 5 years
      Hi, I'm the author of post you linked (askubuntu.com/a/1067093/702388). I'm happy with no kernel messages at all; have you tried my solution(s)? Seems like to be very close to what you need...
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @donlucacorleone Yes, I have tried that. Altering values in /etc/default/grub to GRUB_CMDLINE_LINUX_DEFAULT="quiet" hasn't helped. As I posted below, the only thing that did is setting console=ttyS0 , i.e. redirecting where console messages go
    • LucaM
      LucaM over 5 years
      @SergiyKolodyazhnyy I'm new to Linux system, but I think you should set all of them: GRUB_CMDLINE_LINUX_DEFAULT="quiet", GRUB_CMDLINE_LINUX="quiet", GRUB_RECORDFAIL_TIMEOUT=0
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @LucaM Well, if you read GRUB's documentation the GRUB_CMDLINE_LINUX variables pass parameters to kernel. The quiet parameter in kernel docs is referenced as "Disable most log messages", which it indeed would do in versions prior to 15.04, but now that Ubuntu switched to systemd init subsystem, this doesn't seem to work anymore, at least in my experience.
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @LucaM GRUB_RECORDFAIL_TIMEOUT is not referenced in docs, but from brief research it doesn't have to do with kernel messages, but rather with failed boot ( see ubuntu wiki )
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @LucaM As far as GRUB_CMDLINE_LINUX settings go, I've tried them over and over in multiple variations without any positive result. And yes, I tried the complete 3 settings too even though I know one of them is pointless. Did not work.
    • LucaM
      LucaM over 5 years
      @SergiyKolodyazhnyy Maybe you can try to reinstall the whole OS, or perhaps using 18.04 .1 ... I'm sorry I don't know how to help you further :-(
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 5 years
      @LucaM It's alright :) Not that big of an issue, but it just was very annoying. I may give 18.04.1 a go in virtual machine. Thanks for trying to help, though, I do appreciate that :) I'll update this post if I can find anything further
  • just_chilling
    just_chilling almost 5 years
    Thanks, it works for me too on Ubuntu 19.04 Server!
  • Admin
    Admin almost 5 years
    Suggestion: Probably better to emphasize that the issue is applicable for Ubuntu Server only. The console= option does work for Ubuntu-based desktop flavours; I have tried with Xubuntu 18.04 and Ubuntu MATE 18.04, via GRUB2 menu and GRUB2 configuration, and anyway had similar results.
  • Gaia
    Gaia over 4 years
    is it possible to enable and disable this w/o a reboot??
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy over 4 years
    @Gaia I dont think so, since that configuration file is read at boot time. If there is a way, I'm not aware of it