Solved Switch User / F9, F10, F11 etc. Virtual Terminals

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

I am having rather peculiar problems with switching users in a DE. I am using sddm with xfce and mate.

When I login I get my DE which I can use without problem. I can then logout, and login again, either as the same user with a different DE or as a different user with whichever DE, and all is fine. I can switch back and forth between text terminals F1 - F8 and graphical terminal F9 without problem.

Also, from the DE, I can switch user and get a second graphical session on F10, either as the same user or as a different user. And all is fine so far.

It all starts when I go back to F9, either by logging off the second session, or switching with <Ctl><Alt><F9>. None of the launchers or menus work. I cannot start any new programs. All the programs that were previously opened in that session are still there.

It gets a bit more peculiar. If I then switch back to F10, and I had started F10 as the same user, then the programs that I had tried to open in F9, open in F10. Of course this can only work if I had not logged out of F10, and F10 is the same user as F9.

I have even tried it with three sessions, F9, F10 and F11. Same thing, trying to start a program in F9 opens the program in F11. I have even had the log off window for mate from F9 come up in the F11 session of xfce.

Logging off does not help. The whole graphical switch user thing is rendered useless. All I can do is log off from all graphical sessions and start a new session, so that I only have one session running at a time. That is not really what I want. I want to switch back and forth between two users.

Do you know what is going on here?

Have you had any success in switching users in X? If so, what manager do you use and what DE?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,366

Do you know what is going on here?
It probably has to with the DISPLAY setting for each 'terminal', most applications that run on the desktop assume 0:0, which means the first X session. By starting another X session on another 'terminal' you'll get a DISPLAY of 0:1, the next will get 0:2, etc. So it depends which one was opened first where the applications will get rendered.
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

It probably has to with the DISPLAY setting for each 'terminal', most applications that run on the desktop assume 0:0, which means the first X session. By starting another X session on another 'terminal' you'll get a DISPLAY of 0:1, the next will get 0:2, etc. So it depends which one was opened first where the applications will get rendered.

Yes. So then the DISPLAY setting is only being incremented and not being reset when I switch back to a previous session. I will look into this.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,366

With startx you can supply a DISPLAY number; startx -- :1. I presume that's also possible with sessions started through a display manager, and have it depend on which virtual terminal the session starts. So vtty 8 always gets :0, vtty 9 :1, etc. But I never looked into that.

I've ran nested X sessions and sessions split over two monitors for example. You had to set the DISPLAY variable correctly to have it open on a specific session; env DISPLAY=:1 xclock for example.
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

From an xterm within F9, echo $DISPLAY :0.0

xterm in F10 :0.0

in F11 :0

Switching back and forth and logging out of F11 and F10 does not change this.
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

I will try without sddm, and use startx as you suggest.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,366

From an xterm within F9, echo $DISPLAY :0.0

xterm in F10 :0.0

in F11 :0

Switching back and forth and logging out of F11 and F10 does not change this.
That's probably because that variable isn't dynamically set and simply assumes :0.0 because it's not common to have more than one display session running. That's also why an application started on F11 (vtty10) opens up on vtty8 because that's the actual :0.0 session (it was the first one to start).
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

From F2, startx in xterm in F9 echo $Display :0.0
From F3, startx -- :1 ... in F10 :1.0
From F4, startx -- :2 ... in F11 :2.0

And I can use them all! And I can switch and log off back and forth.
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

That's probably because that variable isn't dynamically set and simply assumes :0.0 because it's not common to have more than one display session running.

Is that a bug in sddm then?
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

Any suggestions for a DM that does allow switching and correctly sets DISPLAY, and (unlike gdm) actually works?
 
OP
Geezer

Geezer

Aspiring Daemon

Reaction score: 454
Messages: 780

Installed lightdm, has a few slight peculiarities. But it works, sets DISPLAY correctly.
 
Top