我刚刚更新了我的内核Ubuntu 9.10系統從2.6.32.1到2.6.33.5,一切似乎都很顺利,但现在我的系统日志中充斥着来自 getty 的错误:
Jul 25 11:01:54 kobol getty[2414]: /dev/tty4: cannot open as standard input: No such device
Jul 25 11:01:54 kobol getty[2415]: /dev/tty2: cannot open as standard input: No such device
Jul 25 11:01:54 kobol getty[2416]: /dev/tty6: cannot open as standard input: No such device
Jul 25 11:01:54 kobol getty[2417]: /dev/tty3: cannot open as standard input: No such device
Jul 25 11:01:54 kobol getty[2418]: /dev/tty5: cannot open as standard input: No such device
Jul 25 11:01:54 kobol init: tty4 main process (2409) terminated with status 1
Jul 25 11:01:54 kobol init: tty4 main process ended, respawning
Jul 25 11:01:54 kobol init: tty2 main process (2410) terminated with status 1
Jul 25 11:01:54 kobol init: tty2 main process ended, respawning
Jul 25 11:01:54 kobol init: tty6 main process (2411) terminated with status 1
Jul 25 11:01:54 kobol init: tty6 main process ended, respawning
Jul 25 11:01:54 kobol init: tty3 main process (2412) terminated with status 1
Jul 25 11:01:54 kobol init: tty3 main process ended, respawning
Jul 25 11:01:54 kobol init: tty5 main process (2413) terminated with status 1
Jul 25 11:01:54 kobol init: tty5 main process ended, respawning
知道是什么原因造成的吗?如何阻止它?我知道这不是一个关键问题,但它不断发生(并填满日志文件)仍然很烦人,我不知道为什么。
更新: 这是我的 tty 设备的列表,其权限似乎在重启时被重置
crw------- 1 root root 4, 0 2010-07-26 10:00 /dev/tty1
crw--w---- 1 root tty 4, 1 2010-07-26 10:00 /dev/tty2
crw--w---- 1 root tty 4, 2 2010-07-26 10:00 /dev/tty3
crw--w---- 1 root tty 4, 3 2010-07-26 10:00 /dev/tty4
crw--w---- 1 root tty 4, 4 2010-07-26 10:00 /dev/tty5
crw--w---- 1 root tty 4, 5 2010-07-26 10:00 /dev/tty6
crw--w---- 1 root tty 4, 6 2010-07-26 10:00 /dev/tty7
crw--w---- 1 root tty 4, 7 2010-07-26 10:00 /dev/tty8
tty1 的初始化脚本如下:
# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -8 38400 tty1
以及 tty2-tty6 的 (几乎相同的) 初始化脚本:
# tty2 - getty
#
# This service maintains a getty on tty2 from the point the system is
# started until it is shut down again.
start on runlevel [23]
stop on runlevel [!23]
respawn
exec /sbin/getty -8 38400 tty2
更新2:初始化脚本的权限如下...
-rw-r--r-- 1 root root 228 2009-12-10 11:00 /etc/init/tty1.conf
-rw-r--r-- 1 root root 213 2009-12-10 11:00 /etc/init/tty2.conf
-rw-r--r-- 1 root root 213 2009-12-10 11:00 /etc/init/tty3.conf
-rw-r--r-- 1 root root 213 2009-12-10 11:00 /etc/init/tty4.conf
-rw-r--r-- 1 root root 213 2009-12-10 11:00 /etc/init/tty5.conf
-rw-r--r-- 1 root root 213 2009-12-10 11:00 /etc/init/tty6.conf
正在运行的 getty 实例的 grep 显示以下内容:
$ ps auxww|grep [g]etty
root 2228 0.0 0.2 5992 604 ? Ss+ 10:00 0:00 /sbin/getty -8 38400 tty1
root 6352 0.8 0.2 5988 688 ? Ss 11:06 0:00 /sbin/getty -8 38400 tty3
root 6355 0.5 0.2 5988 684 ? Ss 11:06 0:00 /sbin/getty -8 38400 tty4
root 6356 0.5 0.2 5988 684 ? Ss 11:06 0:00 /sbin/getty -8 38400 tty6
root 6357 0.8 0.2 5988 684 ? Ss 11:06 0:00 /sbin/getty -8 38400 tty2
root 6358 0.6 0.2 5988 684 ? Ss 11:06 0:00 /sbin/getty -8 38400 tty5
更新 3:降级至2.6.32.1错误消失了。我最近又升级到了2.6.34.1然后他们又出现了。我现在非常困惑。
答案1
我最近将 Rackspace 托管的服务器升级到 Ubuntu 12.04 LTS,遇到了同样的问题。我的 /var/log/auth.log 文件充斥着
May 13 12:50:40 foo getty[1796]: /dev/tty2: cannot open as standard input: No such device
May 13 12:50:51 foo getty[1798]: /dev/tty3: cannot open as standard input: No such device
May 13 12:50:51 foo getty[1797]: /dev/tty4: cannot open as standard input: No such device
May 13 12:50:52 foo getty[1800]: /dev/tty5: cannot open as standard input: No such device
May 13 12:50:52 foo getty[1799]: /dev/tty6: cannot open as standard input: No such device
我所做的就是删除(备份后)以下文件:
/etc/init/tty[2-6].conf
重启后问题就解决了。日志文件中不再有噪音,Rackspace 控制台仍然工作,尽管只有一个虚拟终端。(反正我从不在控制台上使用虚拟终端。)
答案2
查看这些设备是否存在:
ls -l /dev/tty[2-6]
如果他们不这样做,请执行以下操作:
cd /dev
MAKEDEV -n console
该命令名称是全部大写。-n
开关(“无操作”)将显示MAKEDEV
将采取的操作。如果您对其建议的内容感到满意,则将其更改-n
为-v
(“详细”)并再次运行。