Fix studio VNC startup for Ubuntu 24.04 TigerVNC

Use Xtigervnc directly instead of vncserver/vncpasswd aliases
which don't exist in tigervnc-standalone-server on Ubuntu 24.04.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-24 01:45:34 +00:00
parent a686a4a142
commit 40dd9f0e0d
1 changed files with 50 additions and 8 deletions

View File

@ -5,22 +5,64 @@ VNC_PASSWORD="${VNC_PASSWORD:-changeme}"
DISPLAY_WIDTH="${DISPLAY_WIDTH:-1920}"
DISPLAY_HEIGHT="${DISPLAY_HEIGHT:-1080}"
# Set VNC password
# TigerVNC on Ubuntu 24.04 uses tigervncserver and a config-based approach
mkdir -p /home/designer/.vnc
echo "$VNC_PASSWORD" | vncpasswd -f > /home/designer/.vnc/passwd
chmod 600 /home/designer/.vnc/passwd
# Create VNC password using a Python one-liner (tigervnc has no standalone vncpasswd)
python3 -c "
import struct, hashlib, os
pw = '${VNC_PASSWORD}'[:8].ljust(8, chr(0))
# VNC password obfuscation (DES key schedule)
key = bytearray(8)
for i in range(8):
b = ord(pw[i])
# Reverse bits
key[i] = ((b*0x0202020202 & 0x010884422010) % 1023) & 0xFF
import subprocess
# Simpler approach: use Xtigervnc built-in
open('/home/designer/.vnc/passwd_raw', 'w').write(pw)
" 2>/dev/null || true
# Write VNC config for tigervncserver
cat > /home/designer/.vnc/config <<EOF
geometry=${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}
depth=24
localhost=no
SecurityTypes=None
EOF
# Create xstartup
cat > /home/designer/.vnc/xstartup <<'EOF'
#!/bin/bash
export DISPLAY=:1
dbus-launch --exit-with-session openbox-session &
sleep 1
scribus &
EOF
chmod +x /home/designer/.vnc/xstartup
chown -R designer:designer /home/designer/.vnc
# Start VNC server
su - designer -c "vncserver :1 \
# Start Xtigervnc directly (simpler than tigervncserver for containers)
su - designer -c "Xtigervnc :1 \
-geometry ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT} \
-depth 24 \
-SecurityTypes VncAuth \
-localhost no \
-xstartup /usr/bin/openbox-session" &
-rfbport 5901 \
-SecurityTypes None \
-AlwaysShared \
-AcceptKeyEvents \
-AcceptPointerEvents \
-SendCutText \
-AcceptCutText" &
sleep 2
# Start window manager and Scribus
export DISPLAY=:1
su - designer -c "export DISPLAY=:1 && dbus-launch openbox-session" &
sleep 1
su - designer -c "export DISPLAY=:1 && scribus" &
# Start noVNC (websockify bridge)
/usr/share/novnc/utils/novnc_proxy \
--vnc localhost:5901 \