I need some help getting xfce to run inside a virtual session using tigervnc on my raspberry pi. With session=xfce in ~/.vnc/config, when I run vncserver :2 it looks like everything is going to work, but instead I see xinit: connection to X server lost, then the program exits.
I made /usr/share/xsessions/twm.desktop which looks like this:
[Desktop Entry]
Version=1.0
Name=TWM Session
Comment=Use this session to run TWM as your desktop environment
Exec=twm
Icon=
Type=Application
DesktopNames=TWM
Setting session=twm in ~/.vnc/config works perfectly. I can connect without issue, so the problem is isolated to xfce. Not sure what I’m doing wrong, though.
Looks like an old solution I found on the archlinuxarm forums from 2016 fixes it for me.
dbus-launch vncserver :2
Would love an explanation about why this fixes it.
Still unsolved. Doing that works for vncserver, but it apparently isn’t a workable solution for vncsession, which is what the systemd unit runs.
I guess I could just create my own unit, but I would like to get it to work w/o doing that if I can.
I solved it by saving this file to /usr/share/xsessions/xfce4vnc.desktop
[Desktop Entry]
Version=1.0
Name=Xfce4vnc Session
Comment=Use this session to run Xfce in a virtual vnc server
Exec=dbus-launch startxfce4
Icon=
Type=Application
DesktopNames=XFCE4VNC
Then I set session=xfce4vnc in my ~/.vnc/config.
Works like a charm.