Difference between revisions of "Silent boot"

From ArchWiki
Jump to: navigation, search
(Syslinux+Systemd)
m (add link to Kernel parameters)
 
(53 intermediate revisions by 22 users not shown)
Line 1: Line 1:
 
[[Category:Boot process]]
 
[[Category:Boot process]]
This page is for those who prefer to limit the verbosity of their system to a strict minimum, either for aesthetics or other reasons. Following this guide will remove all text from the bootup process.
+
[[es:Silent boot]]
 +
[[ja:サイレントブート]]
 +
This page is for those who prefer to limit the verbosity of their system to a strict minimum, either for aesthetics or other reasons. Following this guide will remove all text from the bootup process. [http://www.youtube.com/watch?v=tuqhsqrhXk0 Video demonstration]
  
==Syslinux+Systemd==
+
== Kernel parameters ==
  
Your /boot/syslinux/syslinux.cfg should look something like:
+
Change the [[Kernel parameters|kernel parameters]] using the configuration options of your boot loader, to include the following parameters:
  
    $ grep APPEND /boot/syslinux/syslinux.cfg | head -n1
+
quiet vga=current
    APPEND root=/dev/sda1 ro 5 init=/usr/lib/systemd/systemd quiet vga=current
 
  
vga=current is the magic ''kernel argument'' not to do something crazy like [https://bugs.archlinux.org/task/32309 flash grey].
+
{{ic|1=vga=current}} is the kernel argument that avoid weird behaviours like {{Bug|32309}}.
  
Configure your systemd getty service like so:
+
If you are still getting messages printed to the console, it may be dmesg sending you what it thinks are important messages. You can change the level at which these messages will be printed by using {{ic|1=quiet loglevel=<level>}}, where {{ic|<level>}} is any number between 0 and 7, where 0 is the most critical, and 7 is debug levels of printing.
  
    x220:~$ grep ExecStart /usr/lib/systemd/system/getty@.service
+
quiet loglevel=3 vga=current
    ExecStart=-/sbin/agetty --skip-login --noissue --autologin YOUR_USERNAME %I 38400
 
  
To remove lastlog message you need to comment out ''lastlog'' in /etc/pam.d/login:
+
Note that this only seems to work if both {{ic|quiet}} and {{ic|1=loglevel=<level>}} are both used, and they must be in that order (quiet first). The loglevel parameter will only change that which is printed to the console, the levels of dmesg itself will not be affected and will still be available through the journal as well as the {{ic|dmesg}} command. For more information, see the {{ic|Documentation/kernel-parameters.txt}} file of the {{Pkg|linux-docs}} package.
  
    #session                optional        pam_lastlog.so
+
If you also want to stop systemd from printing its version number when booting, you should also append {{ic|1=udev.log-priority=3}} to your kernel commandline ([http://www.freedesktop.org/software/systemd/man/systemd-udevd.service.html#Kernel%20command%20line source]). If systemd is used in an [[initramfs]], append {{ic|1=rd.udev.log-priority=3}} instead.
  
To hide any kernel messages from the console use [http://unix.stackexchange.com/a/45525/27433 this tip]:
+
If you are using the {{ic|systemd}} hook in the [[initramfs]], you may get systemd messages during initramfs initialization. You can pass {{ic|1=rd.systemd.show_status=false}} to disable them, or {{ic|1=rd.systemd.show_status=auto}} to only suppress successful messages (so in case of errors you can still see them). Actually, {{ic|1=auto}} is already passed to {{ic|1=systemd.show_status=auto}} when {{ic|1=quiet}} is used, however for some motive sometimes systemd inside initramfs does not get it. Below are the parameters that you need to pass to your kernel to get a completely clean boot with systemd in your [[initramfs]]:
  
    $ grep ^kernel.printk /etc/sysctl.conf
+
  quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3
    kernel.printk = 3 3 3 3
 
  
To hide startx messages, you could redirect its output to /dev/null, like so:
+
Also {{ic|touch ~/.hushlogin}} to remove the Last login message.
  
    [[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx -- vt1 &> /dev/null
+
== sysctl ==
 +
 
 +
To hide any kernel messages from the console, add or modify the {{ic|kernel.printk}} line according to [http://unix.stackexchange.com/a/45525/27433]:
 +
 
 +
{{hc|/etc/sysctl.d/20-quiet-printk.conf|2=
 +
kernel.printk = 3 3 3 3
 +
}}
 +
 
 +
== startx ==
 +
 
 +
To hide {{ic|startx}} messages, you could redirect its output to {{ic|/dev/null}}, in your [https://github.com/kaihendry/Kai-s--HOME/blob/master/.bash_profile .bash_profile] like so:
 +
 
 +
{{Note|Redirection is broken with rootless login. See [[Xorg#Broken redirection]].}}
 +
 
 +
$ [[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx -- vt1 &> /dev/null
  
 
Outstanding Issues:
 
Outstanding Issues:
* [https://github.com/karelzak/util-linux/issues/21 agetty's automatic login is noisy]
+
* [https://bugs.freedesktop.org/show_bug.cgi?id=57216 Systemd shutdowns are not quiet] - As of systemd v206, the {{ic|quiet}} kernel command line parameter is now respected on shutdown, though it seems that if you use the {{ic|shutdown}} hook of {{Pkg|mkinitcpio}}, this function has not been set up to support that parameter.
* [https://bugs.freedesktop.org/show_bug.cgi?id=57216 Systemd shutdowns are not quiet]
+
 
 +
== fsck ==
 +
 
 +
To hide fsck messages during boot, let systemd check the root filesystem. For this, remove ''fsck'' from:
 +
 
 +
HOOKS=(...)
 +
 
 +
in {{ic|/etc/mkinitcpio.conf}} and then run:
 +
 
 +
mkinitcpio -p linux
 +
 
 +
Now copy the files {{ic|systemd-fsck-root.service}} and {{ic|systemd-fsck@.service}} located at {{ic|/usr/lib/systemd/system/}} to {{ic|/etc/systemd/system/}} and edit them, configuring ''StandardOutput'' and ''StandardError'' like this:
 +
 
 +
(...)
 +
 +
[Service]
 +
Type=oneshot
 +
RemainAfterExit=yes
 +
ExecStart=/usr/lib/systemd/systemd-fsck
 +
StandardOutput=null
 +
StandardError=journal+console
 +
TimeoutSec=0
 +
 
 +
See [http://www.freedesktop.org/software/systemd/man/systemd-fsck@.service.html this] for more info on the options you can pass to {{ic|systemd-fsck}} - you can change how often the service will check (or not) your filesystems.
 +
 
 +
== Remove console cursor blinking ==
 +
 
 +
The console cursor at boot keeps blinking if you follow these instructions. This can be solved by passing vt.global_cursor_default=0 to the kernel ([http://www.friendlyarm.net/forum/topic/2998 source]).
 +
 
 +
To recover the cursor in ttys run:
 +
# setterm -cursor on >> /etc/issue

Latest revision as of 12:39, 12 July 2017

This page is for those who prefer to limit the verbosity of their system to a strict minimum, either for aesthetics or other reasons. Following this guide will remove all text from the bootup process. Video demonstration

Kernel parameters

Change the kernel parameters using the configuration options of your boot loader, to include the following parameters:

quiet vga=current

vga=current is the kernel argument that avoid weird behaviours like FS#32309.

If you are still getting messages printed to the console, it may be dmesg sending you what it thinks are important messages. You can change the level at which these messages will be printed by using quiet loglevel=<level>, where <level> is any number between 0 and 7, where 0 is the most critical, and 7 is debug levels of printing.

quiet loglevel=3 vga=current

Note that this only seems to work if both quiet and loglevel=<level> are both used, and they must be in that order (quiet first). The loglevel parameter will only change that which is printed to the console, the levels of dmesg itself will not be affected and will still be available through the journal as well as the dmesg command. For more information, see the Documentation/kernel-parameters.txt file of the linux-docs package.

If you also want to stop systemd from printing its version number when booting, you should also append udev.log-priority=3 to your kernel commandline (source). If systemd is used in an initramfs, append rd.udev.log-priority=3 instead.

If you are using the systemd hook in the initramfs, you may get systemd messages during initramfs initialization. You can pass rd.systemd.show_status=false to disable them, or rd.systemd.show_status=auto to only suppress successful messages (so in case of errors you can still see them). Actually, auto is already passed to systemd.show_status=auto when quiet is used, however for some motive sometimes systemd inside initramfs does not get it. Below are the parameters that you need to pass to your kernel to get a completely clean boot with systemd in your initramfs:

 quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3

Also touch ~/.hushlogin to remove the Last login message.

sysctl

To hide any kernel messages from the console, add or modify the kernel.printk line according to [1]:

/etc/sysctl.d/20-quiet-printk.conf
kernel.printk = 3 3 3 3

startx

To hide startx messages, you could redirect its output to /dev/null, in your .bash_profile like so:

Note: Redirection is broken with rootless login. See Xorg#Broken redirection.
$ [[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx -- vt1 &> /dev/null

Outstanding Issues:

  • Systemd shutdowns are not quiet - As of systemd v206, the quiet kernel command line parameter is now respected on shutdown, though it seems that if you use the shutdown hook of mkinitcpio, this function has not been set up to support that parameter.

fsck

To hide fsck messages during boot, let systemd check the root filesystem. For this, remove fsck from:

HOOKS=(...) 

in /etc/mkinitcpio.conf and then run:

mkinitcpio -p linux

Now copy the files systemd-fsck-root.service and systemd-fsck@.service located at /usr/lib/systemd/system/ to /etc/systemd/system/ and edit them, configuring StandardOutput and StandardError like this:

(...)

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-fsck
StandardOutput=null
StandardError=journal+console
TimeoutSec=0

See this for more info on the options you can pass to systemd-fsck - you can change how often the service will check (or not) your filesystems.

Remove console cursor blinking

The console cursor at boot keeps blinking if you follow these instructions. This can be solved by passing vt.global_cursor_default=0 to the kernel (source).

To recover the cursor in ttys run:

# setterm -cursor on >> /etc/issue