Posting this because I've seen a lot of similar posts in searching for a solution, but no solution.
The issue is that I can launch a vncserver
session to create a GNOME desktop by issuing a command in terminal or a script -- but only when ssh'd in to a computer or directly on the computer: NOT via a script at startup or via systemd. Here is the ~/.vnc/xstartup
script:
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey -cursor_name left_ptr
xsetroot -solid grey left_ptr
vncconfig -iconic &
dbus-launch --exit-with-session /usr/bin/gnome-session &
And here is the command to start the session: vncserver :1 -localhost no -geometry 2560x1440 -depth 24
.
All works perfectly from ssh
or the computer itself: whether a direct terminal command or via a script that includes the command.
But that same script will fail if used as a startup script, and the same command will fail via systemd. Well, "fail" is strong: it does result in a semi-functional GNOME desktop session. That is, it does start a vnc
session that I can reach and that has launched my startup applications (e.g.,gnome-terminal
and nautilus
). But the underlying desktop has failed to launch properly, so I can't move the windows (though I can quit them), there is not top bar, and I get the "Oh no! Something has gone wrong!” error where the desktop should be.
My sense is that this has something to do with how ~/.vnc/xstartup
is being run at startup, but I can't figure it out. I am using tigervnc
, as that is the only one that appears to like GNOME enough to work at all.
$HOME
might be unset. I'd recommend letting the startup script start a semi-functional session, and then inspecting the environment of the processes of that session viastrings /proc/<PID/environ | sort | less
or similar.