如何在运行Upstart的Ubuntu中设置tty自动登录


10

我试图找到在/etc/inittab哪里进行自动登录。但是在Ubuntu 11.04中,该文件似乎丢失了。这是在Ubuntu中做的正确方法吗?

# Auto Login for Ubuntu how?
# 1. apt-get install mingetty
# 2. vim /etc/init/tty1.conf

# 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
exec /sbin/mingetty --autologin <PUTYOUR_USERNAME_HERE> tty1
^
|____ edited only this line, seems to be working 

Answers:


15

/etc/inittabUbuntu 中没有,因为Ubuntu使用upstart来定义启动服务和运行级别。这并不是从Ubuntu的最新版本开始的,而是很久以前的。

无论如何,您仍然可以使用inittab,只需创建一个即可。我报告了一段来自/usr/share/doc/upstart/README.Debian.gz

How do I change the default runlevel?
-------------------------------------

If you have an /etc/inittab file, edit it.  Locate the following line:

    id:N:initdefault:

Where N is the default runlevel, change this to match.

Most people won't have that file, you can edit /etc/init/rc-sysinit.conf
and change the following line:

    env DEFAULT_RUNLEVEL=2

但是请记住,Ubuntu不像其他Linux发行版/ unix os那样使用标准的运行级别含义。旧标准是:

  • 0-关闭
  • 1-单用户模式
  • 3-多用户文本模式
  • 5-多用户图形模式
  • 6-重新启动

但是Ubuntu使用:

  • 0-关闭
  • 1-单用户模式
  • 2-多用户图形模式
  • 6-重新启动

最后,如果您想拥有一个具有自动登录功能的虚拟终端,那么尽管我不知道mingetty,但修改exec线路tty1.conf似乎是正确的方法,因此无法说出您是否正确使用了它。


我真的不明白这是如何解决这个问题的。您提供的甚至与该问题相关的唯一信息是您的最后一句话,其中您说自己实际上并不知道答案……
Justin Buser

3

在我的xubuntu 11.10系统上,默认运行级别是在/etc/init/rc-sysinit.conf中设置的-有问题的行read env DEFAULT_RUNLEVEL=2。因此,我创建了一个/etc/init/rc-sysinit.override,并将其读入一行env DEFAULT_RUNLEVEL=5,因此现在我的默认运行级别为5。


然后,我创建了一个/etc/init/lightdm.override(或gdm.override或kdm.override,无论您使用的是哪种显示管理器,情况如何),然后从lightdm 复制所有开始停止项。 conf-只是更改了运行级别位,因此我的显示管理器从运行级别5开始,并在其他运行级别停止。


0

我不清楚您发布的“ this”应该是什么以及在哪里。但是,无论如何,Upstart仍然会解析/ etc / inittab(如果存在),我建议像以前一样将与运行级别无关的内容放入其中。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.