记录一次危险操作,减少虚拟终端tty
Tofloor
poster avatar
不避风云
deepin
2019-05-29 00:59
Author
本帖最后由 bubifengyun 于 2019-5-28 17:03 编辑

在看余洪春的《构建高性能Linux服务器》(第四版),看到关闭虚拟终端TTY的操作,貌似这样的,

  1. vim /etc/init/start-ttys.conf
  2. // 内容如下:
  3. start on stopped rc RUNLEVEL=[2345]
  4. env ACTIVE_CONSOLES=/dev/tty[1-6]
  5. env X_TTY=/dev/tty1
  6. task
  7. script
  8. /etc/sysconfig/init
  9.     for tty in $(echo $ACTIVE_CONSOLES) ; do
  10.         [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
  11.         initctl start tty TTY=$tty
  12.     done
  13. end script
  14. --------------------
  15. 作者:宁静致远kioye
  16. 来源:CSDN
  17. 原文:https://blog.csdn.net/kxwinxp/article/details/78895373
  18. 版权声明:本文为博主原创文章,转载请附上博文链接!
Copy the Code
折腾Deepin的时候发现不是这样,而是这样,参考网页 https://www.thegeekdiary.com/centos-rhel-7-how-to-disable-all-tty-consoles-and-enable-only-1/

自以为聪明的设置为,
  1. # vi /etc/systemd/logind.conf
Copy the Code


编辑该文字为如下内容,

  1. [Login]
  2. NAutoVTs=1
  3. ReserveVT=1
Copy the Code
直接让Deepin爬不起来,无法启动。中间经过一番折腾,在win10下修改ext4文件,不得已,全部改为2,如下,
  1. [Login]
  2. NAutoVTs=2
  3. ReserveVT=2
Copy the Code
才最终没有死掉,让Deepin重新启动了,且虚拟终端TTY只剩TTY1(桌面)和TTY2。看来TTY2必须要活着啊,不然deepin 无法启动。最后记录在:https://my.oschina.net/bubifengyun/blog/3054820
Reply Favorite View the author
All Replies
avatar
不避风云
deepin
2019-06-05 07:38
#1
https://bbs.deepin.org/user/52935 非常抱歉,这个不能这么做。后来我发现改为2后,手机一接上电脑就导致电脑文件管理器崩溃,电脑无法开机。后来改为6后,一切恢复正常。https://bbs.deepin.org/user/101846 这是啥情况呢?不是很明白咋回事。
Reply View the author
avatar
funtoo
deepin
2019-06-05 08:32
#2
logind.conf的man手册里面不是有说明么?
ReserveVT=

    Takes a positive integer. Identifies one virtual terminal that shall unconditionally be reserved for autovt@.service activation (see above). The VT selected with this option will be marked busy unconditionally, so that no other subsystem will allocate it. This functionality is useful to ensure that, regardless of how many VTs are allocated by other subsystems, one login "getty" is always available. Defaults to 6 (in other words, there will always be a "getty" available on Alt-F6.). When set to 0, VT reservation is disabled.
内核子系统可能也会占用VT。而且,systemd的getty是动态分配而不是常驻内存的,实在不明白这种所谓的“优化”有何意义。

Reply View the author
avatar
Feng Yu
deepin
2019-06-05 08:41
#3
你看的资料也不对,RHEL和Debian是两个系列,很多地方千差万别,千万别按照RHEL的套路去搞Debian。我搞了五年的服务器运维,CentOS和Ubuntu Server我都运维过,各大LTS版本都接触过,深有体会
Reply View the author
avatar
不避风云
deepin
2019-06-05 20:41
#4
https://bbs.deepin.org/post/178567
你看的资料也不对,RHEL和Debian是两个系列,很多地方千差万别,千万别按照RHEL的套路去搞Debian。我搞了五 ...

非常感谢提醒。学的还不够深。
Reply View the author
avatar
不避风云
deepin
2019-06-05 20:43
#5
https://bbs.deepin.org/post/178567
logind.conf的man手册里面不是有说明么?内核子系统可能也会占用VT。而且,systemd的getty是动态分配而不是 ...

看着centos来的。 https://bbs.deepin.org/user/13508 说的很对。本人搞错了。
Reply View the author
avatar
153******90
deepin
2019-06-06 00:09
#6
生命在于折腾
Reply View the author