[SOLVED] Why so many virtual terminals?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

[SOLVED] Why so many virtual terminals?

Post by FanOfLinux »

I thought there are about 6 virtual terminals or so.

/dev $ ls tty* | wc -l
98

Most are tty???, where ??? = some numbers
But some are ttyprintk or ttyS16.
What are the differences between these terminals?

Why so many?
And how are they used for those with numbers that are greater than 6?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Why so many virtual terminals?

Post by rene »

What there are usually (and on Mint) 6 of are 6 open virtual terminals...

The /dev/tty<N> that you see are virtual terminal device nodes and are by themselves mere ways to address a specific virtual terminal. Until you actually open one of them no underlying "actual virtual" terminal device exist. Basically, the kernel provides by exporting /dev/tty1 to /dev/tty63 for the possibility of having 63 virtual terminals; not for 63 virtual terminals (/dev/tty0 is by the way always "the current virtual terminal", not itself a separate VT).

/dev/tty is not a VT but always the current process' controlling terminal.

The /dev/ttyS<N> are also not VTs but serial port devices. In the same manner as above, the 32 provided device nodes only make for the possibility of having as much serial ports; not for actual ones.

/dev/ttyprintk is a device that you can from userspace write messages to to be interspersed with the kernel messages visible in dmesg ("printk" is the name of the kernel function that you use to write these messages from kernel space).

But yes, on Mint and most other distributions only 6 actual virtual terminals are opened by starting a so-called "getty" on them. This is in the Mint 17.x case done in/through /etc/init/tty1.conf through /etc/init/tty6.conf. Those are the actual virtual terminals that you can visit through Ctrl+Alt+F1 through Ctrl+Alt+F6.

To get a bit of a feel for these things it can be nice to play around with the "write" command. That is, log in on the first virtual terminal (Ctrl+Alt+F1), run "mesg y" to allow messages on it, from a another VT or from a terminal under X run "write $USER /dev/tty1" and start chatting away with yourself. You are at that point social networking in a rather pre-Facebook sort of way...

Note also that when you messaged from an X terminal this was at the VT mentioned to come from a so-called "pts" device. Those are yet another form of (pseudo) terminals. "man pty" speaks of those.
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

Re: Why so many virtual terminals?

Post by FanOfLinux »

Thanks.
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

Re: Why so many virtual terminals?

Post by FanOfLinux »

Rene:

When I am in the virtual terminals,
The fonts are really really tiny.

How do you change the size of the font?
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Why so many virtual terminals?

Post by rene »

Buying a bigger monitor at the same resolution is the method that comes with additional benefits, but less drastically

Code: Select all

sudo dpkg-reconfigure console-setup
so as to be offered an interface that sets things up or you in a permanent manner. Either reboot after or, as it advises, run "setupcon" from a virtual terminal to have the new font setting take effect immediately.

Back in The Olden Days I used to like the Terminus Bold font. If the default Fixed 16 font is tiny for you I could advise Terminus Bold 24x12. "Fixed" only goes up to 18. The easiest way to experiment is to manually run (on a virtual terminal) setfont with one of the fonts in /usr/share/consolefonts; e.g.,

Code: Select all

setfont Uni2-TerminusBold24x12
Use the former method to make it permanent though; that one generates the font into /etc/console-setup and updates the initramfs so as to have it available at the right time.
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

Re: Why so many virtual terminals?

Post by FanOfLinux »

The screen starts with:

" Encoding to use on the console: "

One of the choices is UTF-8.
There are many others....
Which do I pick?

Then this:
" Character set to support: "
With many choices also like so:
... ...
# Latin1 and Latin5 - western Europe and Turkic languages
# Latin1 and Latin5 - western Europe and Turkic languages
...
There are many others.... also
Which to pick?
Thank you.


BTW, correction to setfont should be:

Code: Select all

setfont Uni2-TerminusBold24x12.psf.gz
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Why so many virtual terminals?

Post by rene »

FanOfLinux wrote:Which to pick?
Personally I consider it an affront to decency to these days use anything other than Unicode and the UTF-8 enocoding of such is what is used in Linux. As to which glyphs the font should then actually provide (the next "character set that should be supported" choice) you should decide. If you have no to a Westerner special needs the default will do.

There is a good, short introduction to "code pages and Unicode" at http://www.ibm.com/developerworks/library/ws-codepages/.
FanOfLinux wrote:BTW, correction to setfont should be:

Code: Select all

setfont Uni2-TerminusBold24x12.psf.gz
No, including the ".psf.gz" is not necessary. It seems strange you would post this as a correction if you hadn't tried it but there's not a single reason I can think of for me needing only the base name yet you needing to include the extension. So, err, what?
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

Re: Why so many virtual terminals?

Post by FanOfLinux »

When I ran my setting I got this using UTF-8:

Code: Select all

sudo dpkg-reconfigure console-setup
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.103ubuntu4.3) ...
update-initramfs: Generating /boot/initrd.img-3.13.0-37-generic
Warning: No support for locale: en_US.utf8
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
But the above warning is not causing any problem.... see below...

As for the setfont, it was not working without the extension,
but when I ran it again, it is now working....

So I think I may have included some error the first few times...

And I ran setupcon in VT1, and it is working for VT2,VT3, ....

Thank you for your generous time.
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Why so many virtual terminals?

Post by rene »

FanOfLinux wrote:But the above warning is not causing any problem....
I can imagine the utf8 warning appearing related but it is not in fact. We are all seeing that warning on various tool-invocations; "update-initramfs -u" in this case. Or that is, we were all seeing it until we ran

Code: Select all

sudo locale-gen --purge --no-archive
It's a trivial Mint 17.x distribution buglet...
And I ran setupcon in VT1, and it is working for VT2,VT3, ....
Congrats? :) Yes, setupcon is a system-wide tool that applies the values in /etc/default/console-setup (such as for example set up by sudo dpkg-reconfigure console-setup) and/or in ~/.console-setup. It's actually a script that you can look at and see what it does:

Code: Select all

less $(which setupcon)
FanOfLinux
Level 4
Level 4
Posts: 382
Joined: Mon Apr 28, 2014 1:23 pm

Re: [SOLVED] Why so many virtual terminals?

Post by FanOfLinux »

Hi Rene:

The font on the VT terminal is gray on black.
So the contrast is quite poor.
I went here http://misc.flogisoft.com/bash/tip_colo ... formatting
but it was no help.

I want to set the font brightness to white, not gray, preferably bright white for maximum contrast.
And the background at maximum black.

Thank you.
"Bad company corrupts good character." - https://en.wikipedia.org/wiki/Menander
Dual boot : Linux Mint Edge 20.1 Cinnamon, Win 11
Locked

Return to “Beginner Questions”