0

I have a Debian 12 VM that and when I boot it remotely the user session is a TTY, can I have it launch an X11 session at the console end?

Attempt A

  • KDE is installed
  • I have selected plasma-x11 as my default session manager
  • I have changed the default display manager to sddm
loginctl
SESSION  UID USER   SEAT TTY  
      3 1000 user1      pts/0

1 sessions listed.

loginctl show-session 3 -p Type                                   
Type=tty

update-alternatives --config x-session-manager             
There are 3 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).

  Selection    Path                      Priority   Status
------------------------------------------------------------
  0            /usr/bin/startxfce4        50        auto mode
* 1            /usr/bin/startplasma-x11   40        manual mode
  2            /usr/bin/startxfce4        50        manual mode
  3            /usr/bin/xfce4-session     40        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

cat /etc/X11/default-display-manager
/usr/sbin/sddm

ls /usr/share/xsessions
lightdm-xsession.desktop  plasma.desktop  xfce.desktop

but my user keeps login into a TTY session. How can I solve it?

Attempt B

  • I have tried starting the display-manager.service
systemctl start display-manager.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'lightdm.service'.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ====

loginctl show-session 22 -p Type
Type=tty

but it started lightdm instead of sddm even though I set x-session-manager to /usr/bin/startplasma-x11, and the session is still type=tty.

Attempt C

  • I have manually started sddm
  • I have tried startx, startplasma-x11 and startkde, but to no avail.
systemctl start sddm.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to start 'sddm.service'.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ====

startx
/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server
^Cxinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: unexpected signal 2
Couldn't get a file descriptor referring to the console.

startkde
zsh: command not found: startkde

startplasma-x11
$DISPLAY is not set or cannot connect to the X server.

As a result, an x11 session has been started for the sddm user instead of changing my user's session to X11.

loginctl
SESSION  UID USER   SEAT  TTY  
     22 1000 user1       pts/0
     24  111 sddm   seat0 

2 sessions listed.

When I have a regular X11 session, it's my user's session, not the session for the display manager user.

Attempt D

  • I have tried startX with root privileges and detaching it, so it doesn't block the terminal.
doas startx &
[2] 2446
[2]  + suspended (tty output)  doas startx  

but it doesn't work.

1 Answer 1

0

When sddm is running a session as user sddm, it normally means it's displaying a GUI login screen. When you use it to log in, the user will be switched to the actual logged-in account.

But the X11 server is starting on the VM console, not in your pseudo-TTY-based remote session.

If you want a remote X11 session, you'll need:

  • a X11 display server running on your local workstation, appropriate to its operating system
  • a SSH session with X11 forwarding enabled
  • the xauth command and X11 client libraries available on the remote host/VM.

Specifically, you don't need a remote X11 server at all for a X11-based remote session: it does not have to be running, or even installed. With VNC or RDP, it would be a different story.

When all these pre-requisites are met, you should automatically get a terminal session that has the DISPLAY environment set to localhost:10 (the display number may be different, but it will be 10 or greater). The XAUTHORITY environment variable might also be set, if necessary in your distribution. At that point, you should be able to just run

startplasma-x11 &

to start a KDE session.

8
  • I have also been trying to go this route, but to no avail. - The xauth command is available everywhere. - libx11-dev is installed at the remote VM and libx11 at my local machine. - The remote VM has ForwardX11 and ForwardX11Trusted set to yes in the client config file and X11Fowarding set to yes and X11DisplayOffset set to 10 in the sshd config file. They are uncommented and the deamon has been restarted. - I login via SSH -X and my $DISPLAY variable is empty. I do not understand why.
    – Centaro
    Dec 6, 2023 at 14:31
  • If you use ssh -X to connect, and the remote $DISPLAY remains empty, that most likely means the local SSH client failed to connect to the local X11 display server, and therefore decided that trying to request X11 forwarding will be futile. What is the OS of your local/host system?
    – telcoM
    Dec 6, 2023 at 14:37
  • The remote VM is Debian 12. The local machine is Manjaro.
    – Centaro
    Dec 6, 2023 at 15:08
  • Do you have $DISPLAY set in your local session in Manjaro when you start the SSH connection? Can you run X11 applications locally? If not, then the SSH client will not be able to forward the X11 connection since there is apparently no X11 server reachable at the local system which would process the incoming X11 draw requests.
    – telcoM
    Dec 6, 2023 at 15:13
  • It is set to :0 and echo $XDG_SESSION_TYPE returns x11. I am running KDE and as far as I am concerned, KDE is a hybrid using Wayland for some things and Xorg for others.
    – Centaro
    Dec 6, 2023 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .