Difference between revisions of "Disable clearing of boot messages"

From ArchWiki
Jump to: navigation, search
m (added Codeline, Keypress, and Filename formatting)
Line 36: Line 36:
  
 
'''Desired behaviour:'''
 
'''Desired behaviour:'''
Boot messages shoot past, login (either CLI or login manager) is displayed without clearing of tty1
+
Boot messages shoot past, login (either CLI or login manager) is displayed without clearing of tty1.
  
There are three methods to achieve this. Choose the one that suits you best.
+
First you should know that screen may be cleared:
 +
* by [[getty]];
 +
* due to control characters in {{Filename|/etc/issue}} because '''getty''' displays this file.
 +
I.e. to force desired behavior you should eliminate one/all of the above factors.
  
===Method 1: edit /etc/inittab===
+
===Disable clearing by getty===
If the default [[getty]], Agetty, is used, it is possible to skip displaying the contents of {{Filename|/etc/issue}} altogether and instead keep the boot messages displayed on tty1. In {{Filename|/etc/inittab}}, you will find a list of numbered consoles which look something like the following; just scroll down in the file to find it. Then you need to add the {{Codeline|"-i"}} option for the first virtual console (the c1 line) only:
+
 
  c1:2345:respawn:/sbin/agetty '''-i''' -8 38400 tty1 linux
+
In {{Filename|/etc/inittab}}, you will find a list of numbered consoles which look something like the following; just scroll down in the file to find it. If you are using '''agetty''' or '''mingetty''' as '''getty''', add the {{Codeline|--noclear}} option for the first virtual console (the c1 line) only:
 +
  c1:2345:respawn:/sbin/agetty '''--noclear''' -8 38400 tty1 linux
 
  c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
 
  c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
 
  .
 
  .
Line 48: Line 52:
 
  .
 
  .
  
Alternatively simply comment the first line. '''Note:''' this way the login dialogue does not appear, i.e. tty1 is locked.
+
===Disable clearing in /etc/issue===
#c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux                                                                                                             
+
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux                                                                                                             
+
.
+
.
+
.
+
  
But if you are using '''mingetty''', you will need to add the {{Codeline|"--noclear"}} and {{Codeline|"--noissue"}} options for your first virtual console (c1) only:
+
====Disable displaying of /etc/issue====
  c1:2345:respawn:/sbin/mingetty --noclear --noissue tty1 linux
+
 
c2:2345:respawn:/sbin/mingetty tty2 linux
+
Add the {{Codeline|--noissue}} option in {{Filename|/etc/inittab}}:
.
+
  c1:2345:respawn:/sbin/agetty '''--noissue''' -8 38400 tty1 linux
.
+
 
 +
Alternatively simply comment the above line. '''Note:''' this way the login dialogue does not appear, i.e. tty1 is locked.
 +
 
 +
====Give tty1 a custom /etc/issue====
  
===Method 2: give tty1 a custom /etc/issue===
 
 
Copy the existing {{Filename|/etc/issue}} file to {{Filename|/etc/issue.tty1}} (without the first line):
 
Copy the existing {{Filename|/etc/issue}} file to {{Filename|/etc/issue.tty1}} (without the first line):
 
  sed 1d /etc/issue > /etc/issue.tty1
 
  sed 1d /etc/issue > /etc/issue.tty1
Line 71: Line 72:
 
  c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux -f /etc/issue.tty1
 
  c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux -f /etc/issue.tty1
  
===Method 3: edit /etc/issue directly===
+
====Edit /etc/issue directly====
 
Simply cut the contents of the first line in {{Filename|/etc/issue}} so it looks like this:
 
Simply cut the contents of the first line in {{Filename|/etc/issue}} so it looks like this:
 
   
 
   
Line 78: Line 79:
 
{{Warning|Read below how to restore the file before attempting this.}}
 
{{Warning|Read below how to restore the file before attempting this.}}
  
====Restoring /etc/issue====
+
=====Restoring /etc/issue=====
 
The characters cannot be just typed again into the file because they are special characters '''not''' available on your keyboard!
 
The characters cannot be just typed again into the file because they are special characters '''not''' available on your keyboard!
  

Revision as of 06:48, 26 September 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start

Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary end

After the boot process, the screen is cleared and the login prompt appears, leaving users unable to read init output and error messages. This default behavior may be modified using methods outlined in this article.

Note that regardless of the chosen option, kernel messages can be displayed for inspection after booting by using Template:Codeline.

Note: Given the recent change in agetty, the mandatory change is: add a Template:Codeline option to the call of agetty in Template:Filename and also remove Template:Filename first line. See below

Using flow control

This is basic management that applies to most terminal emulators, including virtual consoles (vc):

More permanent solution

For a more permanent change, the following can be used to add a pause or wait for keypress while boot messages are still on the screen:

  • Wait for a keypress before clearing the screen:
 read -n1
  • Wait for at most 5 seconds or until a keypress occurs:
 read -t5 -n1

Add one of these to either the bottom of Template:Filename to pause when booting is finished, or the stat_fail() function in Template:Filename to pause when a boot script in /etc/rc.d fails with an explicit error code. Note that the latter is a system script and may be overwritten when that file is updated. If you are unsure what this means, use Template:Filename.

Have boot messages stay on tty1

Normal behaviour: Boot messages shoot past, screen is cleared, contents of Template:Filename are displayed, login (either CLI or login manager) is displayed.

Desired behaviour: Boot messages shoot past, login (either CLI or login manager) is displayed without clearing of tty1.

First you should know that screen may be cleared:

I.e. to force desired behavior you should eliminate one/all of the above factors.

Disable clearing by getty

In Template:Filename, you will find a list of numbered consoles which look something like the following; just scroll down in the file to find it. If you are using agetty or mingetty as getty, add the Template:Codeline option for the first virtual console (the c1 line) only:

c1:2345:respawn:/sbin/agetty --noclear -8 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
.
.
.

Disable clearing in /etc/issue

Disable displaying of /etc/issue

Add the Template:Codeline option in Template:Filename:

c1:2345:respawn:/sbin/agetty --noissue -8 38400 tty1 linux

Alternatively simply comment the above line. Note: this way the login dialogue does not appear, i.e. tty1 is locked.

Give tty1 a custom /etc/issue

Copy the existing Template:Filename file to Template:Filename (without the first line):

sed 1d /etc/issue > /etc/issue.tty1

Find this in Template:Filename:

c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux

Replace it with:

c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux -f /etc/issue.tty1

Edit /etc/issue directly

Simply cut the contents of the first line in Template:Filename so it looks like this:

Arch Linux \r  (\n) (\l)
Warning: Read below how to restore the file before attempting this.
Restoring /etc/issue

The characters cannot be just typed again into the file because they are special characters not available on your keyboard!

After you cut the contents from line 1 in Template:Filename, paste it into a temporary file somewhere on you computer so you can copy and paste it back into Template:Filename later when you wish to restore original functionality. You can also backup the whole Template:Filename somewhere safe and restore it when needed.

Optionally, if you are more advanced, you can follow special procedures for typing in these special characters:

Methods of placing literal escape characters are editor dependent. In Vim:

ESC (exit insert mode)
:r !clear
:x (Save and Exit)

This will insert the literal characters equivalent to the shell Template:Codeline command. Optionally you can also insert the characters manually:

i (insert)
ctrl-v (insert literal character)
ESC (insert escape character)
c
ESC (exit insert mode)
ZZ (Save and Exit)

In Emacs:

C-q ESC (to insert literal escape)

See Also