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

我试图找到我自动登录的/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  tty1 ^ |____ edited only this line, seems to be working 

Ubuntu中没有/etc/inittab ,因为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操作系统那样使用标准运行级别的含义。 旧标准是:

  • 0 – 关机
  • 1 – 单用户模式
  • 3 – 多用户文本模式
  • 5 – 多用户图形模式
  • 6 – 重启

但是Ubuntu使用:

  • 0 – 关机
  • 1 – 单用户模式
  • 2 – 多用户图形模式
  • 6 – 重启

最后,如果你想拥有一个自动登录的虚拟终端,那么修改tty1.confexec行似乎是正确的方法,虽然我不知道mingetty,所以不能说你是否正确使用它。

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


然后我创建了一个/etc/init/lightdm.override(或gdm.override,或kdm.override,无论你使用的是什么显示管理器的情况),并复制了lightdm中的所有startstop项。 conf – 并且刚刚更改了运行级别位,因此我的显示管理器在运行级别5中启动,并在其他运行级别中停止。

我不清楚你发布的“这个”的内容和位置应该是什么。 无论如何,Upstart仍将解析/ etc / inittab,如果它存在,我建议将非运行级别的相关内容放入其中,就像之前一样。