VNC hacks for multiple sessions: Difference between revisions

From revRE Wiki
(First entry)
 
No edit summary
 
Line 22: Line 22:
This case you still have a problem because the second session that starts shows a hung black screen.
This case you still have a problem because the second session that starts shows a hung black screen.


systemctl start vncserver:@5 -> vncsession
systemctl start vncserver@:5 -> vncsession


vncsession reads ~/.vnc/config [sessions=XYZ] then (reads /usr/share/xsessions/gnome -> /usr/libexec/vncserver  
vncsession reads ~/.vnc/config [sessions=XYZ] then (reads /usr/share/xsessions/gnome -> /usr/libexec/vncserver  

Latest revision as of 19:06, 9 February 2024


VNC on modern Linux distributions stopped supporting multiple sessions for the same user when using Gnome around the time Wayland support showed up. This is a disaster for those of us who want to work in the same account but using Gnome, say for example two teams, working simultaneously on the same machine on some graphical interface.

There are two ways to do this


#1; Manually start VNC server by typing "vncserver" and letting it configure a new display

Add a "xstartup" script to your .vnc folder which has

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc


#2; Using services (you will need root access) and adding to /etc/tigervnc/vncserver.users (:5=user ;6=user...)

This case you still have a problem because the second session that starts shows a hung black screen.

systemctl start vncserver@:5 -> vncsession

vncsession reads ~/.vnc/config [sessions=XYZ] then (reads /usr/share/xsessions/gnome -> /usr/libexec/vncserver

/usr/libexec/vncserver (creates a command line for xinit ) -> xinit /etc/X11/xinit/Xsession gnome-XYZ -- Xvnc [options]

xinit -> /etc/X11/xinit/Xsession (a script that reads gnome-XYZ to learn what to launch via Exec=gnome-XYZscript)

xinit -> Xvnc is started (DISPLAY=:5 server)

/usr/bin/gnomeXYZscript -> gnome-session which is free to start whatever it likes (gnome-session binary usually, with options)


Edit gnomeXYZscript to add: "unset DBUS_SESSION_BUS_ADDRESS" before starting gnome-session last and it will work.