Chinaunix首页 | 论坛 | 博客
  • 博客访问: 246881
  • 博文数量: 33
  • 博客积分: 3030
  • 博客等级: 中校
  • 技术积分: 500
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-09 17:49
文章分类

全部博文(33)

文章存档

2011年(1)

2010年(1)

2009年(10)

2008年(21)

我的朋友

分类: LINUX

2011-10-04 07:46:18

最近archlinux升级后发现启动后直接清屏并跳到登录界面去了,原来可以看到的启动信息被一刷而过,由于已经清空了/etc/issue文件,所以感到很奇怪,查了半天才发现,原来是负责登录的agetty程序做了调整,现在需要在/etc/inittab文件中的agetty命令后面加上 --noclear参数才行。下面是转贴wiki.archlinux.org的文章


Disable Clearing of Boot Messages

Summary
Preventing the boot sequence printout from disappearing.
Related

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 dmesg.

Note: Given the recent change in agetty, the mandatory change is: add a --noclear option to the call of agetty in /etc/inittab and also remove /etc/issue first line. See below
Contents []
Using flow control

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

  • Press Ctrl + S to pause the output
  • And Ctrl + Q to resume it
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 /etc/rc.local to pause when booting is finished, or the stat_fail() function in /etc/rc.d/functions 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 /etc/rc.local.

Have boot messages stay on tty1

Normal behaviour: Boot messages shoot past, screen is cleared, contents of /etc/issue 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:

  • by ;
  • due to control characters in /etc/issue because getty displays this file.

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

Disable clearing by getty

In /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 --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 . . . Disable clearing in /etc/issue Disable displaying of /etc/issue

Add the --noissue option in /etc/inittab:

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

Alternatively simply comment out the above line.

Note: this way the login prompt does not appear, i.e. tty1 is locked.
Give tty1 a custom /etc/issue

Copy the existing /etc/issue file to /etc/issue.tty1 (without the first line):

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

Find this in /etc/inittab:

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 /etc/issue 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 /etc/issue, paste it into a temporary file somewhere on you computer so you can copy and paste it back into /etc/issue later when you wish to restore original functionality. You can also backup the whole /etc/issue 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 :

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

This will insert the literal characters equivalent to the shell clear 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 :

C-q ESC (to insert literal escape)

Or you could just extract it from core/filesystem.

See Also
阅读(923) | 评论(0) | 转发(0) |
0

上一篇:archlinux中所谓nvidia与xorg冲突问题的解决

下一篇:没有了

给主人留下些什么吧!~~