You are not logged in.
I want to run two simultaneous XFCE sessions for the same user - one on graphical console and one headless on VNC. The idea is basically what Windows remote desktop enables you to do.
Many years ago (before systemd) I could do this simply by running an additional tigervnc server in addition to my XFCE session and it worked. Since then a lot of things have changed and this is not supported any more. I'm confused how this is supposed to work now and I would appreciate if somebody could point me in the right direction. I'm using tigervnc as my VNC server.
I tried using LightDM + lightdm-gtk-greeter and enabled support for VNC as described on wiki page, but this does not work with two sessions. If the user is logged in on console, VNC will just disconnect, and vice versa.
I also tried using LightDM with separate systemd service for headless tigervnc server for my user as described on TigerVNC wiki page, but it also does not work - VNC server simply does not start if lightdm is running.
Thanks!
Offline
So this really isn't just 2 XFCE sessions, but rather 2 XFCE sessions, lightdm, and tigerVNC, and something goes wrong. Narrow down which of these components is really triggering the problem: my money is definitely on lightDM.
First, just log in with startx/xinit from the console on tty1 and again on tty2. If that works, then you have two simultaneous XFCE sessions for the same user (as requested in the title). Then try to get one of them working with (tiger)VNC. Then potentially consider bringing lightDM back into the mix only after everything else is working.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I tried to narrow down the problem as much as possible.
First I set up a headless tigervnc service like this:
1. echo ":1=user" >> /etc/tigervnc/vncserver.users
2. Create /home/user/.vnc/config with "session=xfce"
3. Create /home/user/.vnc/passwd
4. systemd start vncserver@:1
After this I verified that VNC is working as expected and starting XFCE.
Next I created /home/user/.xinitrc like this:
echo "exec xterm" > /home/user/.xinitrc
And I started "xinit" with just xterm.
Then, with xterm running on console X I tried to run "xfce4-session" and I got a core dump.
With "systemctl stop vncserver@:1", xfce4-session would start OK in xterm, but in this case, "systemctl start vncserve@:1" would fail.
After desperately trying random stuff from the internet I eventually ran "dbus-launch xfce4-session" in xterm and with this I was able to run XFCE and VNC at the same time. However even after this I have no idea what is happening here or how to use this information to solve my problem.
Last edited by bachtiar (2021-06-21 20:10:22)
Offline
You should not run dbus-launch manually, but instead read the wiki page on startx/xinit and have a proper xinitrc. There's also no reason to run xfce4-session manually which is stated right in the xfce wiki page.
If `dbus-launch xfce4-session` works in the conditions you indicated, then startx with a proper xinitrc will almost certainly work as well.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
You should not run dbus-launch manually, but instead read the wiki page on startx/xinit and have a proper xinitrc. There's also no reason to run xfce4-session manually which is stated right in the xfce wiki page.
If `dbus-launch xfce4-session` works in the conditions you indicated, then startx with a proper xinitrc will almost certainly work as well.
I tried copying .xinitrc from /etc/X11/xinit/xinitrc as described on wiki page, but it doesn't work either (meaning: xfce4-session still crashes if another xfce-session is running on VNC).
Replacing "exec xfce4-session" with "exec startxfce4" does not help either.
What would be a "proper" solution here? How many dbus processes should be running, and when/from where they are supposed to be started? Ideally, I would like to have a display manager on boot + automatically started VNC service.
Last edited by bachtiar (2021-06-21 23:30:08)
Offline
Can you post the xinitrc you tried to use?
What would be a "proper" solution here? How many dbus processes should be running, and when/from where they are supposed to be started? Ideally, I would like to have a display manager on boot + automatically started VNC service.
The "proper" solution depends on first identifying the actual problem. I'm not sure how many dbus processes should be running as I break a lot of the "rules" on how X11 stuff should run, but I also don't use software that depends on those rules being followed. In any case you should never have to worry about where those processes are started if you have a proper xinitrc or use a (good) display manager as these will source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh which will take care of dbus activation.
While I know your goal is to use all these tools together, my advise remains to get one piece working at a time, that way when something goes wrong, you know which tool to focus on fixing. I also wouldn't be surprised if lightDM might be a problem in this set up - while I have absolutely no personal experience with DMs, from posts on this form it seems that lightDM is a common source of issues.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The "proper" solution depends on first identifying the actual problem. I'm not sure how many dbus processes should be running as I break a lot of the "rules" on how X11 stuff should run, but I also don't use software that depends on those rules being followed. In any case you should never have to worry about where those processes are started if you have a proper xinitrc or use a (good) display manager as these will source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh which will take care of dbus activation.
From what I can see, sourcing 50-systemd-user.sh does not help, so even if lightdm would do it it it would still not work. None of scripts in xinitrc.d will start a new instance of dbus process, whereas for some reason explicitly starting another dbus instance with "dbus-launch" seems to solve the problem. As I said, I discovered this by accident so I still don't know what it says about the actual problem since I have no knowledge about the internals of sessions, DBus, systemd, login etc. Needless to say I would be happy if I didn't have to worry about it - this information is surprisingly difficult to find, things keep changing all the time and it seems that there are no common agreements.
Do you have any other ideas about what I could try? By no means I want to get married to lightdm, I was simply hoping it would do the job properly.
Last edited by bachtiar (2021-06-22 06:45:24)
Offline
Do you have any other ideas about what I could try?
Just one crazy idea: provide some of the information previously requested.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Just one crazy idea: provide some of the information previously requested.
My ~/.xinitrc:
#!/bin/sh
# This part is copied from /etc/X11/xinit/xinitrc
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# My part - what I've tried so far
# (1) This is taken from "Exec=" in /usr/share/xsessions/xfce.desktop. It doesn't work.
startxfce4
# (2) This also doesn't work:
# xfce4-session
# (3) This works:
# dbus-exec xfce4-session
# (4) This also works as it forces xfce4-session to start dbus-exec itself
# (see https://gitlab.xfce.org/xfce/xfce4-session/-/blob/master/xfce4-session/main.c#L275)
# unset DBUS_SESSION_BUS_ADDRESS
# startxfce4From what I've read, DBUS_SESION_BUS_ADDRESS is set by systemd-pam. On my (minimal, vanilla) system it is basically always set to "unix:path=/run/user/1000/bus" for my user, and the value is the same whether I inspect it in console or in terminal running in headless VNC session. When you run "dbus-launch" it is set to a new value like "unix:abstract=/tmp/dbus-xxxxxx,guid=yyyyyy", and that seems to do the trick. If you run "ps", you can also see the new process, something like this:
/usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --sessionLast edited by bachtiar (2021-06-22 14:53:58)
Offline