Skip to content

Instantly share code, notes, and snippets.

@hute37
Last active February 27, 2024 14:01
Show Gist options
  • Save hute37/7653600a222d787d8404555435721e49 to your computer and use it in GitHub Desktop.
Save hute37/7653600a222d787d8404555435721e49 to your computer and use it in GitHub Desktop.
Xvfb startup for nomachine headless (wayland) virtual desktop session
#!/bin/sh
##
# Xvfb headless startup
#
# #see: https://www.nomachine.com/AR10K00710
##
# stop (wayland) gdm from desktop :0 vt7
#
sudo systemctl is-active gdm && (sudo systemctl stop gdm ; sudo systemctl status gdm)
##
# Xvfb start on desktop :0 virtual screen 0: (-nocomposite)
#
COOKIE=`ps -ef | md5sum | cut -f 1 -d " "`
AUTHFILE=$HOME/.Xvfb-0.auth
xauth -f $AUTHFILE add :0 MIT-MAGIC-COOKIE-1 $COOKIE
xauth add :0 MIT-MAGIC-COOKIE-1 $COOKIE
Xvfb :0 -auth $AUTHFILE -screen 0 1024x768x24 -extension Composite >> ~/.xvfb.0.log 2>&1 &
sleep 3
sudo /etc/NX/nxserver --restart
export DISPLAY=:0.0
xrdb -merge ~/.Xresources
setxkbmap it
xterm -T Login -n Login -sl 5000 -bg ghostwhite -fg black -cr navy
# eval $(ssh-agent); xterm -T Login -n Login -sl 5000 -e dbus-launch $(which twm)
# xterm -T Login -n Login -sl 5000 -e dbus-launch $(which xfce4-session)
# xterm -T Login -n Login -sl 5000 -e /etc/X11/xsession default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment