Difference between revisions of "Silent boot"

From ArchWiki
Jump to: navigation, search
m (fix)
(Informmation for grub-silent package)
 
(79 intermediate revisions by 27 users not shown)
Line 1: Line 1:
{{expansion}}
+
[[Category:Boot process]]
This page is for those who, like me, prefer to limit the verbosity of their system to a strict minimum, either for aesthetic reasons or any other reasons.
+
[[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]
  
The aim of this page is to give you instruction to remove all text from the boot process.
+
== Kernel parameters ==
  
==Grub configs==
+
Change the [[kernel parameters]] using the configuration options of your boot loader, to include the following parameters:
  
To avoid the verbose text, you can add this line to the grub kernel command "quiet console=tty12". It will send the outpout of the boot process to the "tty 12", while remaining on the "tty 1".
+
quiet vga=current
  
Example configuration for /boot/grub/menu.lst
+
{{ic|1=vga=current}} is the kernel argument that avoid weird behaviours like {{Bug|32309}}.
  
# (0) Arch Linux
+
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.
title  Arch Linux
 
root  (hd0,5)
 
kernel /vmlinuz26 root=/dev/disk/by-uuid/b2f2fc9a-6305-4770-aed2-fccb3ec51d5c ro quiet console=tty12
 
initrd /kernel26.img
 
  
This configuration will only leave the Arch logo on the screen for the whole boot process. If you would like to also remove the logo, simply add "logo.nologo" to the kernel command, like this:
+
quiet loglevel=3 vga=current
  
# (0) Arch Linux
+
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.
title  Arch Linux
 
root  (hd0,5)
 
kernel /vmlinuz26 root=/dev/disk/by-uuid/b2f2fc9a-6305-4770-aed2-fccb3ec51d5c ro quiet console=tty12 logo.nologo
 
initrd /kernel26.img
 
  
==/etc/inittab==
+
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.
  
The file /etc/inittab is responsible for the prompts you get in your ttys. The boot process taking place in tty 1, i want to remove the prompt in that tty so that no text is displayed whatsoever. So i am gonna deactivate tty1 completely. Simply comment the line responsible for it in the /etc/initab file. The line to comment is this one:
+
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]]:
  
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
+
  quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3
  
This is what my inittab file looks like with that line commented:
+
Also {{ic|touch ~/.hushlogin}} to remove the Last login message.
  
  #
+
== sysctl ==
  # /etc/inittab
+
 
  #
+
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
 +
 
 +
== 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:
 +
 
 +
  (...)
 
   
 
   
  #  Runlevels:
+
  [Service]
  #    0    Halt
+
  Type=oneshot
  #    1(S)      Single-user
+
  RemainAfterExit=yes
  #    2    Not used
+
  ExecStart=/usr/lib/systemd/systemd-fsck
#    3    Multi-user
+
  StandardOutput=null
#    4    Not used
+
  StandardError=journal+console
#    5    X11
+
  TimeoutSec=0
#    6    Reboot
+
 
   
+
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.
  ## Only one of the following two lines can be uncommented!
+
 
# Boot to console
+
== Remove console cursor blinking ==
  #id:3:initdefault:
+
 
# Boot to X11
+
The console cursor at boot keeps blinking if you follow these instructions. This can be solved by passing {{ic|1=vt.global_cursor_default=0}} to the kernel [http://www.friendlyarm.net/forum/topic/2998].
id:5:initdefault:
+
 
+
To recover the cursor in the TTY, run:
rc::sysinit:/etc/rc.sysinit
+
  # setterm -cursor on >> /etc/issue
rs:S1:wait:/etc/rc.single
 
rm:2345:wait:/etc/rc.multi
 
rh:06:wait:/etc/rc.shutdown
 
su:S:wait:/sbin/sulogin -p
 
 
# -8 options fixes umlauts problem on login
 
#c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
 
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
 
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
 
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
 
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
 
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
 
 
# Hypervisor Virtual Console for Xen and KVM
 
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux
 
 
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
 
 
# Example lines for starting a login manager
 
#x:5:respawn:/usr/bin/xdm -nodaemon
 
  #x:5:respawn:/usr/sbin/gdm -nodaemon
 
#x:5:respawn:/usr/bin/kdm -nodaemon
 
#x:5:respawn:/usr/bin/slim >& /dev/null
 
x:5:once:/bin/su yourusername -l -c "/bin/bash --login -c /usr/bin/startx >/dev/null 2>&1"
 
  
==Patching grub==
+
== Make GRUB silent ==
  
(coming soon)
+
To hide GRUB welcome and boot messages, you may install unofficial {{AUR|grub-silent}} package.
  
==more==
+
It is required to reinstall [[GRUB]] and regenerate {{ic|grub.cfg}} file.

Latest revision as of 10:54, 2 December 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

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 [2].

To recover the cursor in the TTY, run:

# setterm -cursor on >> /etc/issue

Make GRUB silent

To hide GRUB welcome and boot messages, you may install unofficial grub-silentAUR package.

It is required to reinstall GRUB and regenerate grub.cfg file.