Xfce desktop and container_vnc template

Hi all,

This topic is basically a follow-up of this one: Xfce4 Desktop app using container_vnc

I’m trying to run xfce4 in a container.

Here is my submit.yml.erb so far:

---
batch_connect:
  template: "vnc_container"
  websockify_cmd: "/usr/bin/websockify"
  container_path: "/shared/software/singularity/images/turbovnc-rocky8-rpbs.sif"
  container_bindpath: ""
  container_command: "apptainer"
  before_script: |
    export XDG_RUNTIME_DIR=/tmp/${USER}
    mkdir -p $XDG_RUNTIME_DIR
  run_script: |
    apptainer exec instance://$INSTANCE_NAME desktops/xfce.sh
script:
  native:
    - "--cpus-per-task=<%= my_cpus %>"
    - "--mem=<%= my_mem %>G"

The turbovnc-rocky8-rpbs.sif image was built following this recipe: Batch Connect VNC Container Options — Open OnDemand 4.0.0 documentation

Actually a Dockerfile but converted to a .sif image:

FROM rockylinux/rockylinux:8

RUN dnf install -y epel-release && \
    dnf groupinstall -y xfce && \
    dnf install -y python3-pip xorg-x11-xauth glibc-langpack-en && \
    pip3 install ts && \
    dnf install -y https://yum.osc.edu/ondemand/latest/compute/el8Server/x86_64/python3-websockify-0.10.0-1.el8.noarch.rpm && \
    dnf install -y https://yum.osc.edu/ondemand/latest/compute/el8Server/x86_64/turbovnc-2.2.5-1.el8.x86_64.rpm && \
    dnf clean all && \
    rm -rf /var/cache/dnf/* && \
    /bin/dbus-uuidgen > /etc/machine-id

ENV PATH /opt/TurboVNC/bin/:$PATH
ENV LANGUAGE "en_US.UTF-8"
ENV LC_ALL "en_US.UTF-8"
ENV LANG "en_US.UTF-8"

The job is running but the virtual desktop stays stuck in “Starting” mode. Unfortunately I’m not sure where to look at next. Here are the error logs I’m getting:

Loading singularity...
Starting instance...
INFO:    Instance stats will not be available - requires cgroups v2 with systemd as manager.
INFO:    instance started successfully
Setting VNC password...
Starting VNC server...

Warning: gpu-node15:2 is taken because of /tmp/.X2-lock
Remove this file if there is no X server gpu-node15:2
Killing Xvnc process ID 66
Xvnc process ID 66 already killed
Xvnc did not appear to shut down cleanly. Removing /tmp/.X11-unix/X2
Xvnc did not appear to shut down cleanly. Removing /tmp/.X2-lock
55605

Desktop 'TurboVNC: gpu-node15:1 (rey)' started on display gpu-node15:1

Log file is vnc.log
Successfully started VNC server on gpu-node15:5901...
Script starting...

(xfwm4:128): xfwm4-WARNING **: 18:35:19.475: Unsupported GL renderer (llvmpipe (LLVM 17.0.6, 256 bits)).

** (agent:154): CRITICAL **: 18:35:20.111: Failed to get connection to system bus: Could not connect: No such file or directory

** (xfce4-screensaver:160): WARNING **: 18:35:20.252: screensaver already running in this session

** (xfdesktop:148): WARNING **: 18:35:20.361: Failed to get system bus: Could not connect: No such file or directory

** (wrapper-2.0:153): WARNING **: 18:35:20.568: No outputs have backlight property

(wrapper-2.0:153): libupower-glib-WARNING **: 18:35:20.582: Couldn't connect to proxy: Could not connect: No such file or directory

(wrapper-2.0:153): GLib-GObject-WARNING **: 18:35:20.586: invalid (NULL) pointer instance

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.586: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:153): GLib-GObject-WARNING **: 18:35:20.586: invalid (NULL) pointer instance

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.586: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.594: up_device_get_object_path: assertion 'UP_IS_DEVICE (device)' failed

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.594: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:153): GLib-GObject-WARNING **: 18:35:20.594: invalid (NULL) pointer instance

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.594: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.595: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.595: up_device_get_object_path: assertion 'UP_IS_DEVICE (device)' failed

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.595: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.595: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.595: up_client_get_on_battery: assertion 'UP_IS_CLIENT (client)' failed

** (wrapper-2.0:152): WARNING **: 18:35:20.604: Binding 'XF86AudioMicMute' failed!

(wrapper-2.0:152): pulseaudio-plugin-WARNING **: 18:35:20.604: Could not have grabbed volume control keys. Is another volume control application (xfce4-volumed) running?

(wrapper-2.0:152): libnotify-WARNING **: 18:35:20.614: Failed to connect to proxy

(wrapper-2.0:172): libactions-WARNING **: 18:35:20.618: Calling CanShutdown failed GDBus.Error:org.xfce.SessionManager.Error.Failed: Could not connect: No such file or directory

(wrapper-2.0:172): libactions-WARNING **: 18:35:20.630: Calling CanRestart failed GDBus.Error:org.xfce.SessionManager.Error.Failed: Could not connect: No such file or directory

(xfce4-session:103): xfce4-session-WARNING **: 18:35:20.651: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:103): xfce4-session-WARNING **: 18:35:20.655: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:103): xfce4-session-WARNING **: 18:35:20.668: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(wrapper-2.0:172): Gtk-WARNING **: 18:35:20.685: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node button, owner XfceArrowButton)

(wrapper-2.0:152): Gtk-WARNING **: 18:35:20.702: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner PulseaudioButton)

(wrapper-2.0:153): GLib-GObject-CRITICAL **: 18:35:20.779: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.779: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed

(wrapper-2.0:153): libupower-glib-CRITICAL **: 18:35:20.779: up_client_get_on_battery: assertion 'UP_IS_CLIENT (client)' failed
xfce4-panel-Message: 18:35:21.099: Plugin power-manager-plugin-9 has been automatically restarted after crash.

** (wrapper-2.0:188): WARNING **: 18:35:21.399: No outputs have backlight property

(wrapper-2.0:188): libupower-glib-WARNING **: 18:35:21.409: Couldn't connect to proxy: Could not connect: No such file or directory

(wrapper-2.0:188): GLib-GObject-WARNING **: 18:35:21.412: invalid (NULL) pointer instance

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.412: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:188): GLib-GObject-WARNING **: 18:35:21.412: invalid (NULL) pointer instance

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.412: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.416: up_device_get_object_path: assertion 'UP_IS_DEVICE (device)' failed

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.416: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:188): GLib-GObject-WARNING **: 18:35:21.416: invalid (NULL) pointer instance

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.416: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.416: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.416: up_device_get_object_path: assertion 'UP_IS_DEVICE (device)' failed

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.416: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.416: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.416: up_client_get_on_battery: assertion 'UP_IS_CLIENT (client)' failed

(wrapper-2.0:188): GLib-GObject-CRITICAL **: 18:35:21.585: g_object_get: assertion 'G_IS_OBJECT (object)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.585: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed

(wrapper-2.0:188): libupower-glib-CRITICAL **: 18:35:21.585: up_client_get_on_battery: assertion 'UP_IS_CLIENT (client)' failed

Any help would be greatly appreciated.

As an off the top guess, you likely need /var in the bindpath to communicate with the host.

Actually, I tried to launch vncserver and the xfce desktop directly from a compute node using this commands:

apptainer instance start /shared/software/singularity/images/turbovnc-rocky8-rpbs.sif 7f9d5038-a065-44e3-bb12-fd1fbeb385af
echo -ne "tototo\ntototo" | apptainer exec instance://7f9d5038-a065-44e3-bb12-fd1fbeb385af vncpasswd -f > "vnc.passwd"
apptainer exec instance://7f9d5038-a065-44e3-bb12-fd1fbeb385af vncserver -rfbauth "vnc.passwd" -noxstartup
DISPLAY=:1 apptainer exec instance://7f9d5038-a065-44e3-bb12-fd1fbeb385af xfce4-session

and could succesfully connect to the session from a VNC client using port 5901 despite the xfce warnings / error messages showing in the console.

However, no success from the OOD dashboard. The job_script_content.sh script never continues to the websockify part.

Well, I just found out what was causing the issue.

A & is appended to the end of the run_script line in the job_script_content.sh script. You must use |- or write the command on a single line to avoid a line break at the end of the line.

Here is the fix:

batch_connect:
  template: "vnc_container"
  websockify_cmd: "/usr/bin/websockify"
  container_path: "/shared/software/singularity/images/turbovnc-rocky8-rpbs.sif"
  container_command: "apptainer"
  before_script: |
    export XDG_RUNTIME_DIR=$(mktemp -d /tmp/XXXXX)
  run_script: |-
    apptainer exec instance://$INSTANCE_NAME ./script.sh
script:
  native:
    - "--cpus-per-task=<%= my_cpus %>"
    - "--mem=<%= my_mem %>G"
1 Like