0

Overview

My goal is to setup VNC access to a Debian 9.5 VM guest built with virt-manager on Ubuntu 16.04 LTS (with desktop environment).

I have configured /etc/vnc/xstartup to use gnome-session (details below), and have setup a systemd service defined inside /lib/systemd/system/{service-name}.service, where it utilizes a script inside /usr/local/bin/{service-script} that directly calls /usr/bin/vncserver to execute stop and start operations.

The current behavior is that a blank screen appears when I log into the VNC server instance from another device on the LAN, and I'd like to learn why this config doesn't work and a little bit more about the Ubuntu/Debian desktop environment package hierarchy.

Couple Notes:

  • This exact configuration works using a windows host running virtual box.
  • Everything setup here is a mix of stuff I found online (that worked) for my windows host, so please point out redundant or useless configs I may not fully understand
  • The {user} in question NOT in the sudoers list but was the first user created during graphical installation
  • The gnome-settings errors in the status output seem suspicious to me, but I don't know enough about this stuff to make sense of it. (maybe someone else can?)

List of files & Debug

systemd

<user>@VPS:~$ ls -l /lib/systemd/system/<srvc-name>.service
-rw-r--r-- 1 root root 268 Aug 14 08:46 /lib/systemd/system/<srvc-name>.service

[Unit]
Description=Manage VNC Server

[Service]
Type=forking
ExecStart=/usr/local/bin/<srvc-script> start
ExecStop=/usr/local/bin/<srvc-script> stop
ExecReload=/usr/local/bin/<srvc-script> restart
User=<user>

[Install]
WantedBy=multi-user.target

service-script

<user>@VPS:~$ ls -l /usr/local/bin/<srvc-script>
-rwxr-xr-x 1 root staff 297 Aug 14 09:01 /usr/local/bin/<srvc-script>

#!/bin/bash

PATH="$PATH:/usr/bin/"
DISPLAY="2"
DEPTH="24"
GEOMETRY="1280x1024"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost no"

case "$1" in
start)
/usr/bin/vncserver ${OPTIONS}
;;

stop)
/usr/bin/vncserver -kill :${DISPLAY}
;;

restart)
$0 stop
$0 start
;;
esac
exit 0

xstartup

<user>@VPS:~$ ls -l /etc/vnc/xstartup
-rwxr-xr-x 1 root root 155 Aug 14 13:52 /etc/vnc/xstartup

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

xrdb $HOME/.Xresources
xsetroot -solid grey

export XKL_XMODMAP_DISABLE=1
gnome-session &

sudo service {srvc-name} status

● <srvc-name>.service - Manage VNC Server
   Loaded: loaded (/lib/systemd/system/<srvc-name>.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-08-14 14:01:22 PDT; 1min 9s ago
  Process: 419 ExecStart=/usr/local/bin/<srvc-script> start (code=exited, status=0/SUCCESS)
    Tasks: 151 (limit: 4915)
   CGroup: /system.slice/<srvc-name>.service
           ├─487 /usr/bin/Xtigervnc :2 -desktop VPS:2 (<user>) -auth /home/<user>/.Xauthority -geometry 1280x1024 -depth 24 -rfbwait 30000 -rfbauth /home/<user>/.vnc/passwd -rfbport 5902 -pn -SecurityTypes VncAuth,TLSVnc
           ├─498 /usr/bin/perl /usr/bin/vncserver -depth 24 -geometry 1280x1024 :2 -localhost no
           ├─499 /bin/sh /etc/X11/Xvnc-session
           ├─501 vncconfig -iconic
           ├─502 /usr/lib/gnome-session/gnome-session-binary
           ├─540 dbus-launch --autolaunch 5e4be6148690420bb12518bb1b2bf070 --binary-syntax --close-stderr
           ├─554 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
           ├─612 /usr/bin/dbus-launch --exit-with-session --sh-syntax
           ├─615 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
           ├─658 /usr/bin/ssh-agent x-session-manager
           ├─674 /usr/lib/at-spi2-core/at-spi-bus-launcher
           ├─679 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
           ├─681 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
           ├─689 /usr/lib/gvfs/gvfsd
           ├─694 /usr/lib/gvfs/gvfsd-fuse /home/<user>/.gvfs -f -o big_writes
           ├─718 /usr/bin/gnome-keyring-daemon --start --components=secrets
           ├─736 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
           ├─757 /usr/bin/pulseaudio --start --log-target=syslog
           ├─780 /usr/lib/gnome-settings-daemon/gsd-printer
           ├─793 /usr/lib/evolution/evolution-alarm-notify
           ├─798 /usr/lib/tracker/tracker-store
           ├─799 /usr/lib/tracker/tracker-miner-user-guides
           ├─800 /usr/lib/tracker/tracker-miner-apps
           ├─802 /usr/lib/tracker/tracker-miner-fs
           ├─803 /usr/lib/tracker/tracker-extract
           ├─830 /usr/lib/evolution/evolution-source-registry
           ├─836 /usr/lib/gnome-online-accounts/goa-daemon
           ├─845 /usr/lib/telepathy/mission-control-5
           ├─846 /usr/lib/gnome-online-accounts/goa-identity-service
           ├─855 /usr/lib/evolution/evolution-calendar-factory
           ├─867 /usr/lib/evolution/evolution-calendar-factory-subprocess --factory contacts --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx855x2 --own-path /org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/855/2
           ├─869 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
           ├─886 /usr/lib/dconf/dconf-service
           ├─891 /usr/lib/evolution/evolution-addressbook-factory
           ├─892 /usr/lib/evolution/evolution-calendar-factory-subprocess --factory local --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx855x3 --own-path /org/gnome/evolution/dataserver/Subprocess/Backend/Calendar/855/3
           ├─917 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
           ├─923 /usr/lib/evolution/evolution-addressbook-factory-subprocess --factory local --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.AddressBookx891x2 --own-path /org/gnome/evolution/dataserver/Subprocess/Backend/AddressBook/891/2
           ├─932 /usr/lib/gvfs/gvfs-afc-volume-monitor
           ├─944 /usr/lib/gvfs/gvfs-goa-volume-monitor
           └─949 /usr/lib/gvfs/gvfs-mtp-volume-monitor

Aug 14 14:01:21 VPS pulseaudio[776]: [pulseaudio] pid.c: Daemon already running.
Aug 14 14:01:21 VPS gnome-settings-[736]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
Aug 14 14:01:21 VPS gnome-settings-[736]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
Aug 14 14:01:21 VPS gnome-settings-[736]: Failed to StopUnit service: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
Aug 14 14:01:21 VPS gnome-settings-[736]: g_task_return_error: assertion 'error != NULL' failed
Aug 14 14:01:21 VPS gnome-session-binary[502]: Entering running state
Aug 14 14:01:21 VPS goa-daemon[836]: goa-daemon version 3.22.5 starting
Aug 14 14:01:22 VPS org.gtk.vfs.AfcVolumeMonitor[615]: Volume monitor alive
Aug 14 14:01:22 VPS systemd[1]: Started Manage VNC Server.
Aug 14 14:01:45 VPS pulseaudio[757]: [pulseaudio] bluez5-util.c: GetManagedObjects() failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

1 Answer 1

1

Finally figured out enough to resolve this situation for anyone curious.

  • My other VM setup runs under a username that has sudo privileges and for this one the user isn't in the sudoers list.
  • I tried to get this working with a deb9.4 guest on a win10 virutalbox setup and encountered the same issue.
  • I changed the service-script permission so the non-sudo user could execute it and everything started working -- those gnome-settings errors in the status output remain in my newly working setup.

So in short, other than the service-script permission issue I don't really understand much about this. Some additional input from someone would help clarify the overall situation I think.

You must log in to answer this question.

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