TigerVNC on Manjaro ARM (Rpi4) running GNOME

I'm restarting this effort after realizing that just using X windows through an SSH session is a PIA (e.g., Chromium stops working after various system updates).

I am going to list below (I) what I have done; (II) what the result was; and (III) errors (new ones!) that I saw in the VNC logs.

I. What I Have Done.

A. Specs of the Pi
Rpi 4

  • X11 (after login from GUI)
  • Wayland (if restart, no GUI login, access from SSH)
DISTRIB_ID=Manjaro-ARM
DISTRIB_RELEASE=19.12
DISTRIB_CODENAME=
DISTRIB_DESCRIPTION="Manjaro ARM Linux"
NAME="Manjaro-ARM"
ID=manjaro-arm
PRETTY_NAME="Manjaro ARM"
ANSI_COLOR="1;32"
4.19.97-1-MANJARO-ARM

B. TigerVNC Installation

sudo pacman -S tigervnc
vncserver

chmod +x ~/.vnc/xstartup
vncserver :1 ##Note: this means port 5901 in the viewer, :0 means 5900, to kill vncserver -kill :1
sudo pacman -S xorg-server xorg-xinit xf86-video-fbdev xterm gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

C. TigerVNC Settings
nano ~/.vnc/xstartup

edit to

#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

nano ~/.vnc/config

Edit to

geometry=1920x1080
depth=24

II. The Result of the Above
I am able to access the VNC server via a viewer like Remmina. However, the desktop appears odd in that it does not have my theme settings and it does not have any launcher (I use dash to dock on the Pi4's GNOME desktop). It shows only Nautilus, and the only way to open an application is to right click a file and use the contextual menu to "Open with Other Application" -- and choose among the listed applications.
When opening a text file with, say, Chromium, Terminal, etc., the application opens. It appears in the same vanilla theme as the desktop, except GNOME-Terminal, which for some reason opens with the right theme. See below for screenshot.

III. What Errors I Get.

If I restart the Pi and log in solely from an SSH session, it appears to start in Wayland, as shown by this command from within the ssh:
loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'

I believe much of this problem stems from the system's selection of Wayland v. X11 on GUI-less startup. Below are the errors I get when opening the session from within Remmina.

vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server
/home/rsync/.vnc/xstartup: line 17: gnome-settings-daemon: command not found

** (process:3830): WARNING **: 08:01:51.007: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused

(gnome-panel:3832): gnome-panel-WARNING **: 08:01:52.075: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gnome-panel:3832): WARNING **: 08:01:52.188: Error opening directory “/usr/share/gnome-panel/applets”: No such file or directory
# _g_io_module_get_default: Found default implementation dconf (DConfSettingsBackend) for ‘gsettings-backend’
# watch_fast: "/org/gnome/terminal/legacy/" (establishing: 0, active: 0)
# unwatch_fast: "/org/gnome/terminal/legacy/" (active: 0, establishing: 1)
# watch_established: "/org/gnome/terminal/legacy/" (establishing: 0)
Xlib:  extension "DPMS" missing on display ":1".

Sun Feb  9 08:01:52 2020
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:nan ratio)
Xlib:  extension "DPMS" missing on display ":1".
Window manager warning: Display “:1” already has a window manager; try using the --replace option to replace the current window manager.
(gnome-shell:3831): mutter-ERROR **: 08:01:52.755: Failed to start Xwayland: Failed to acquire window manager ownership
== Stack trace for context 0x55800c73e0 ==

I should also note that I tried to install RealVNC using the AUR. It installed, but threw this error on every launch:
ssh x ERROR:token_service_table.cc(140)] Failed to decrypt token for service AccountId-105721815176495441250 [19275:19275:0208/142621.037357:ERROR:sandbox_linux.cc(372)] InitializeSandbox() called with multiple threads in process gpu-process. [19299:7:0208/142621.880600:ERROR:command_buffer_proxy_impl.cc(124)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.

Any help is appreciated!

I may have been wrong that the Pi starting Wayland v. X11 was the cause of the problem.

I just forced Wayland to be disabled via /etc/gdm/custom.conf and uncommenting #WaylandEnable=false. On reboot via SSH, it now reports X11 for the session.

The result for the VNC session was solely that the background was all black instead of gray. Otherwise, the functionality was the same: no panel, no dash-to-dock, and no way to switch between open applications.

So...I found a solution!

I was trying to start the VNC server automatically at boot using sudo systemctl start vncserver.service, and I was getting an error vncserver: The HOME environment variable is not set. Googling that error, gave me this awesome Arch forum post from a few years ago..

As stated in that post, I commented my ~/.vnc/xstartup settings and inserted instead exec dbus-launch gnome-session.

On restart of the VNC server, I got a full GNOME desktop!!!

I did get several recurring popups requiring authentication to create a new color profile, but the fix is here.

I figured out how to start the VNC server at boot using systemctl, but it was a seriousPIA. I'm pasting below a few key points:

1. [Edit the ~/.vnc/xstartup file to]

#!/bin/sh
export XDG_SESSION_TYPE=x11   ##NOTE:  This fixes "Uh oh!" error
exec dbus-launch gnome-session  ## NOTE:  This fixes black screen
xsetroot -solid grey -cursor_name left_ptr
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

2. [Set vncserver to start at boot by adding a service with @:1]

sudo cp /usr/lib/systemd/system/vncserver.service /etc/systemd/system/vncserver@:1.service
sudo nano /etc/systemd/system/vncserver@:1.service
sudo systemctl start vncserver@:1.service
sudo systemctl enable vncserver@:1.service

3. Fix recurring color profile warning

sudo nano /etc/polkit-1/rules.d/98-manjaro-mbwd.rules
[Add]
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.color-manager.create-device" ||
        action.id == "org.freedesktop.color-manager.create-profile" ||
        action.id == "org.freedesktop.color-manager.delete-device" ||
        action.id == "org.freedesktop.color-manager.delete-profile" ||
        action.id == "org.freedesktop.color-manager.modify-device" ||
        action.id == "org.freedesktop.color-manager.modify-profile") &&
       subject.isInGroup("rsync")) {
      return polkit.Result.YES;
   }
});

4. [Force X11 on boot]

sudo nano /etc/gdm/custom.conf
[uncomment]
WaylandEnable=false
2 Likes

Forum kindly sponsored by