How do I increase the number of TTY consoles?

Solution 1:

Before answering your question, I would rather point you to use something like screen or tmux.

But if you insist on using ttys, you can spawn a new one with:

sudo systemctl start [email protected]

with N being a number not already in use.

You could change the default number of ttys started at boot (6) to something else by editing /etc/systemd/logind.conf and uncommenting the first line and change the number 6 to something else like:

[Login]
NAutoVTs=7

Source: https://wiki.archlinux.org/index.php/Getty

Solution 2:

You cannot (short of recompiling the kernel).

Your terminology is incorrect. You are asking for TTY login sessions.

You have 63 Kernel Virtual Terminal (KVT) devices available. Always. To change this would involve recompiling the kernel, and possibly dealing with knock-on effects caused by assumptions in the rest of the operating system about the major and minor device numbers. But I suspect that this is far more than enough for you.

What you actually asking for is to change is the number of TTY login session services that are started on your system. Not all of those 63 terminal devices have a TTY login session service started against them. You want more login sessions.

Yes, the behaviour has changed with systemd. TTY login services are now ordinary services, like any other — an innovation from AT&T System 5 Release 4 back in 1988 that the Ubuntu world first gained with Upstart.

Nowadays on Ubuntu systemd-logind starts TTY login sessions on demand, as each kernel virtual terminal is activated by the key chords that switch amongst KVTs. There are controls in its configuration file that place an upper limit on the KVT number for which it will do this, and that can force a particular numbered KVT to always have a TTY login session started.

But of course you can manually start and enable the autovt@name services.

That several KVTs show a GUI is not really anything to do with systemd, in contrast, and everything to do with the fact that that is how multiple users are logged on with GUIs. Each GUI session has a KVT, so that it can coöperate with the KVT switching and HID sharing. If you have more than one logged in GUI session (at least one being devoted to the GUI login subsystem itself) then more than one of the KVTs is claimed.

(I had a user of my softwares who likewise found the TUI WWW browsers not up to the job, in this particular case of reading DocBook doco, as the GUI WWW browsers can. So I wrote a tool. ☺)

Further reading

  • https://unix.stackexchange.com/a/194218/5132
  • Jonathan de Boyne Pollard (2018). "linux-vt". Devices. nosh toolset.
  • Jonathan de Boyne Pollard (2018). "linux-console". Devices. nosh toolset.
  • https://unix.stackexchange.com/a/487796/5132
  • logind.conf. systemd manual pages. freedesktop.org.
  • Jonathan de Boyne Pollard (2018). getty spawned from init is a thing of the past.. Frequently Given Answers.
  • Jonathan de Boyne Pollard (2018). Manual pages for Linux kernel virtual terminal devices. Proposals.
  • Jonathan de Boyne Pollard (2019). "console-docbook-xml-viewer". User commands. nosh toolset.
  • Jonathan de Boyne Pollard (2016). "Terminals". nosh Guide. Softwares.