Upon system bootup there should be a single tty console running Xorg on it. New tty consoles are generated upon its access dynamically. the tty1 is always reserved for the xorg process and thus can not be disabled.

# ps -ef | grep tty
root      11718  11710  0 Nov01 tty1     00:00:16 /usr/bin/Xorg :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-sKPFMh/database -seat seat0 -nolisten tcp vt1

 

tty basics

 

– One can switch from tty1 to tty6 using Ctrl+Alt+F[1-6] .

– This continues upto tty6 i.e. default number of allowed tty consoles are 6. ttys are managed by systemd in CentOS/RHEL 7.

– tty consoles are created on-the-fly upon access.

– The allowed number of consoles can be configured in /etc/systemd/logind.conf file.

 

Disable all tty consoles

 

1. Edit /etc/systemd/logind.conf file to set the value of the two parameters as shown below.

 # vi /etc/systemd/logind.conf
NAutoVTs=0
ReserveVT=N

 

Here,

  • NAutoVTs – set this to a desired number to have systemd capable of generating those many tty consoles. Defaults to 6. When set to 0, automatic spawning of autovt services is disabled.
  • ReserveVT – Takes a positive integer. Identifies one virtual terminal that shall unconditionally be reserved for autovt@.service activation. Defaults to 6 (in other words, there will always be a “getty” available on Alt-F6.). When set to 0, VT reservation is disabled.

 

Note : N is the number of tty you want to enable. It takes positive integer value. tty1 can not be disabled as it is used by xorg process and it is hardcoded.

 

Enable a tty console

 

1. To enable a single tty console set the below parameters in the file /etc/systemd/logind.conf.

# vi /etc/systemd/logind.conf
NAutoVTs=0
ReserveVT=1

 

2. Create a symbolic link of a tty you want to enable in /etc/systemd/system/getty.target.wants

# ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyN.service

 

3. Enable the tty using systemctl:

# systemctl enable getty@ttyN.service 

 

4. Reboot the system.

# shutdown -r now 

 

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)