3

I am able to run without using systemd.

The config looks like so:

ubuntu@yocto:~/.vnc$ cat xstartup
#!/bin/sh

# [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &

I start it like so:

ubuntu@yocto:~$ vncserver -geometry 1920x1200 -depth 24

New 'yocto.c.annotator-1286.internal:1 (ubuntu)' desktop at :1 on machine yocto.c.annotator-1286.internal

Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/yocto.c.annotator-1286.internal:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/ubuntu/.vnc/passwd :1 to connect to the VNC server.

it runs correctly like so:

ubuntu@yocto:~$ vncserver -list

TigerVNC server sessions:

X DISPLAY # RFB PORT #  PROCESS ID
:1      5901        1624
ubuntu@yocto:~$ 

I create an ssh tunnel on macOS like so:

gcloud compute --project "annotator-1286" ssh --zone "us-central1-a" "ubuntu@yocto" -- -NL 5901:localhost:5901

and then I can connect with the "Screen Sharing.app" by pointing to localhost:5901.

enter image description here

However, if, instead of manually staring the service, I try to run it as a systemd service, following these instructions:

ubuntu@yocto:~$ cat .local/share/systemd/user/vncserver@.service
[Unit]
Description=TigerVNC Service

[Service]
Type=forking
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver :%i -localhost no
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=default.target

Enabling and starting:

ubuntu@yocto:~$ systemctl daemon-reload --user
ubuntu@yocto:~$ systemctl enable vncserver@1 --user
Created symlink /home/ubuntu/.config/systemd/user/default.target.wants/vncserver@1.service → /home/ubuntu/.local/share/systemd/user/vncserver@.service.

ubuntu@yocto:~$ systemctl start vncserver@1 --user    

It seems to actually start vnc server:

ubuntu@yocto:~$ vncserver -list

TigerVNC server sessions:

X DISPLAY # RFB PORT #  PROCESS ID
:1      5901        1287
ubuntu@yocto:~$ 

But if you try connecting to this, the screen will be blank due the following errors:

ubuntu@yocto:~$ systemctl status vncserver@1 --user
● vncserver@1.service - TigerVNC Service
   Loaded: loaded (/home/ubuntu/.local/share/systemd/user/vncserver@.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-04-16 02:00:21 UTC; 3s ago
  Process: 3493 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=0/SUCCESS)
  Process: 3499 ExecStart=/usr/bin/vncserver :1 -localhost no (code=exited, status=0/SUCCESS)
   CGroup: /user.slice/user-1000.slice/user@1000.service/vncserver.slice/vncserver@1.service
           ├─3507 /usr/bin/Xtigervnc :1 -desktop yocto.c.annotator-1286.internal:1 (ubuntu) -auth /home/ubuntu/.Xauthority -geometry 1900x1200 -depth 24 -rfbwait 30000 -rfbau
           ├─3511 vncconfig -iconic
           ├─3515 dbus-launch --exit-with-session gnome-session
           ├─3516 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
           ├─3521 /usr/lib/at-spi2-core/at-spi-bus-launcher
           ├─3526 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
           ├─3530 /usr/lib/gvfs/gvfsd
           ├─3535 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
           ├─3545 /usr/bin/gnome-screensaver --no-daemon
           ├─3551 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
           └─3561 /usr/bin/gnome-keyring-daemon --start --components=secrets

Apr 16 02:00:22 yocto gnome-session[3512]: gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Apr 16 02:00:22 yocto gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Apr 16 02:00:22 yocto org.gnome.Shell.desktop[3572]: Window manager warning: Unsupported session type
Apr 16 02:00:22 yocto gnome-session[3512]: gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Apr 16 02:00:22 yocto gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Apr 16 02:00:22 yocto gnome-session[3512]: gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
Apr 16 02:00:22 yocto gnome-session-binary[3512]: WARNING: App 'org.gnome.Shell.desktop' respawning too quickly
Apr 16 02:00:22 yocto gnome-session-binary[3512]: Unrecoverable failure in required component org.gnome.Shell.desktop
Apr 16 02:00:22 yocto gnome-session[3512]: gnome-session-binary[3512]: CRITICAL: We failed, but the fail whale is dead. Sorry....
Apr 16 02:00:22 yocto gnome-session-binary[3512]: CRITICAL: We failed, but the fail whale is dead. Sorry....
ubuntu@yocto:~$ 

These gnome errors are quite generic and I'm having difficulty debugging this problem.
I don't quite understand why I only get these errors when running as a systemd service.

I did have to disable Wayland like so:

ubuntu@yocto:/etc/gdm3$ cat custom.conf
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.

[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false

# Enabling automatic login
#  AutomaticLoginEnable = true
#  AutomaticLogin = user1

# Enabling timed login
#  TimedLoginEnable = true
#  TimedLogin = user1
#  TimedLoginDelay = 10

[security]

[xdmcp]

[chooser]

[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true

as a work-around for this:

ubuntu@yocto:~/.vnc$ systemctl status gdm
● gdm.service - GNOME Display Manager
   Loaded: loaded (/lib/systemd/system/gdm.service; static; vendor preset: enabled)
   Active: active (running) since Wed 2020-04-15 23:17:56 UTC; 26min ago
 Main PID: 1125 (gdm3)
    Tasks: 3 (limit: 4410)
   Memory: 4.1M
   CGroup: /system.slice/gdm.service
           └─1125 /usr/sbin/gdm3

Apr 15 23:17:44 yocto systemd[1]: Starting GNOME Display Manager...
Apr 15 23:17:56 yocto systemd[1]: Started GNOME Display Manager.
Apr 15 23:17:56 yocto gdm-launch-environment][1130]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
Apr 15 23:19:31 yocto gdm3[1125]: GdmDisplay: Session never registered, failing
Apr 15 23:19:31 yocto gdm3[1125]: Child process -1149 was already dead.
Apr 15 23:19:31 yocto gdm3[1125]: Child process -1149 was already dead.
Apr 15 23:19:31 yocto gdm-launch-environment][1917]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
Apr 15 23:19:32 yocto gdm-launch-environment][1917]: pam_unix(gdm-launch-environment:session): session closed for user gdm
Apr 15 23:19:32 yocto gdm3[1125]: Child process -1944 was already dead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.