How to setup vitual consols and tty for graphical login ?

Hi,
I need some tips configuring virtual consoles and on which of them graphical login will run.

Currently after several upates I noticed that:

  • environment variable DISPLAY changed from “:0” to “:1”
  • the graphical login runs on 2(two) tty’s: tty2 and tty7 (“ctrl-alt-F2” and cntrl-alt-F7" send me to plasma desktop)

Typically, graphical login and plasma desktop run on tty7. I have no clue what caused the changes. I just noticed because some of my cron jobs failed (because of change in DISPLAY var).

In old days there was file /etc/inittab where I could specify which virtual consoles to span, but now it is gone. Everything is managed by systemd and therefore is much less transparent …

How I can reconfigure to have only one “graphical” tty ?

Any tips will be appreciated.

Thank you!

I can confirm it on current TW with gdm/GNOME. gdm runs on tty7, but user session is started on different tty (in my case it is tty3 currently). I suspect it is actually started on the first “free” tty - before logging in in GNOME I switched to tty2 and it caused auto-spawn of login so tty2 was not available.

What display manager are you using?

It looks like I’m running gdm:

>ps ax | grep gdm
2470 ? Sl 0:00 /usr/sbin/gdm
2715 ? Sl 0:00 gdm-session-worker [pam/gdm-launch-environment]
2725 tty7 Ssl+ 0:00 /usr/lib/gdm/gdm-x-session gnome-session --autostart /usr/share/gdm/greeter/autostart
2727 tty7 Sl+ 0:08 /usr/bin/X vt7 -displayfd 3 -auth /run/user/292/gdm/Xauthority -background none -noreset -keeptty -verbose 3
2883 tty7 Sl+ 0:00 /usr/lib/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart
3413 pts/4 S+ 0:00 grep --color=auto gdm
3664 ? Sl 0:00 gdm-session-worker [pam/gdm-password]
3683 tty2 Ssl+ 0:00 /usr/lib/gdm/gdm-x-session --run-script /usr/bin/startkde
3685 tty2 Rl+ 24:39 /usr/bin/X vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3

You can see that there are two lines:

2727 tty7 Sl+ 0:08 /usr/bin/X vt7 -displayfd 3 -auth /run/user/292/gdm/Xauthority …
3685 tty2 Rl+ 24:39 /usr/bin/X vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority …

Looks like gdm needs two tty’s to run - tty2 for UID 1000 (that’s me) and tty7 for UID 292 (gdm).

I wonder if it is a “feature” or misconfiguration?

The fact that gdm is running is confusing because for a long time it was sddm. Only after a recent update login screen has changed. At that time I attributed that fact to a change in of plasma theme (breeze) version.

p.s.
in /etc/sysconfig/displaymanager sddm is set as display manager:
DISPLAYMANAGER=“sddm”

Displaymanager is not set anymore by /etc/sysconfig in Tumbleweed, it is set by
update-alternatives:
http://openmafia.org/~osf/Screenshots/Auswahl_245.jpg
Its an Screenshot, because Clipboard on this Maschine is not working…

Thank you, that helped! It is a good starting point for me.

I also found this comment in /usr/lib/X11/display-manager script:

DISPLAYMANAGER used to be set in /etc/sysconfig/displaymanager, but the default is now set by update-alternatives

DISPLAYMANAGER=$(realpath --relative-base=/usr/lib/X11/displaymanagers /usr/lib/X11/displaymanagers/default-displaymanager)

Also, found this discussion on Ubuntu forum:

https://askubuntu.com/questions/910108/why-is-my-gdm-at-a-different-tty-than-my-desktop-environment
There is also a link within it to a Gnome’s bugzilla page where this “feature” discussed. On a surface, looks like it is a “feature” and cannot be re-configured to use a single tty.

Now I need to find where the number of virtual consoles set and configured …

I do not understand what you mean. Can you elaborate?

Typically, you have virtual consoles running on tty1-tty6 and you graphical desktop or login on tty7. You can switch between them Ctrl-Alt-F1, Ctrl-Alt-F2, etc. The number of those tty’s (6 in this example) could be set in /etc/inittab file. It is not used anymore, but this is how you the relevant lines look like:

c1:2345:respawn:/etc/getty 9600 tty1
c2:2345:respawn:/etc/getty 9600 tty2
c3:2345:respawn:/etc/getty 9600 tty3
c4:2345:respawn:/etc/getty 9600 tty4

the exact description of format you can find, say, here:

https://manpages.debian.org/stretch/sysvinit-core/inittab.5.en.html

You can span 2 or you can span 9 virtual consoles, as many as you want. The consoles use some fonts and back(fore)ground colors and those are configurable too.

My problem is that I sort of understood how it was done in the past but with the advent of systemd and “alternatives” I am no more.

Wrong. The number of ttys is set by kernel and is actually fixed (63). /etc/inittab defined how many ttys would get login process on system start. It does not mean you could not use other ttys.

My problem is that I sort of understood how it was done in the past but with the advent of systemd and “alternatives” I am no more.

It is still not clear what is “it” that “was done in the past”. You want to start login on tty2 on system boot and not on demand? Run “systemctl enable getty@tty2.service”. But how tty login is related to your original question of why second X server is started?

Interesting that there is no SUSE documentation on this, much less openSUSE.

It’s my understanding…

  • tty7 is <always> the default graphical console in all Linux distros, both in the past and currently.
  • A big difference with systemd is that tty are not running automatically and already to use on boot. Tty are “generated” and started up on demand.
  • Although there are numerous references to tty1-6 for serial consoles, in systemd those are only the tty that can be automatically invokable. You can configure numerous additional tty but they just can’t be automatically started up.
  • There are differences between distros, so you have to be careful which documentation you may be reading. Example, I doubt that Arch with its use of agetty and related services and utilities applies to SUSE/openSUSE (but who knows? I may learn something).

So,
I guess bottom line is that for anyone who <really> wants to dig deeply into this should start with the standard documentation that’s included, eg the getty MAN pages and be wary of applying anything learned on another distro.

FWIW -
The following Lennart Poettering blog article on tty should be good reading… It also includes some comment about multiple X tty in GNOME which may or may not also apply to other environments.

http://0pointer.de/blog/projects/serial-console.html

TSU

In /etc/sddm.conf you can set your graphical konsole with

MinimumVT=

Here it is set to 7…

Wrong. Do you home work.

Tty are “generated” and started up on demand.

Your using of desperately wrong terms just leads to confusion. ttys are not “generated”. What is generated, is service that starts login on tty.

Thank you! That is what I was looking for.

Sometimes I loose graphical desktop and need to continue my work. That happened with kernels 4.9.* when nvidia driver would not compile, nouveau driver crapped out and the stock kernel driver was veeeery slow (Ihave 2560x1600 screen). In situation like this I need as many virtual consoles/terminals as possible.

Thank you for the link! That is a very helpful read about systemd - that article and the rest of which it is a part.

Wrong. Indeed when you boot typical linux install you will find /dev/tty1-/dev/tty63. This is an initial, minimal set of tty’s that will be created on boot. Now run this:

mknod /dev/tty72 c 4 72

It will create /dev/tty72. The major number “4” can be different on your box, but you can find it its value from “ls -l /dev/tty1”. All /dev/ttyN will have same major number.

I think even the authoritative blog post reference I provided supports what I wrote.
And, it’s important to know that these are what has changed in systemd compared to SysVinit.

TSU