Skip to content

Instantly share code, notes, and snippets.

@x43x61x69
Last active July 6, 2024 19:44
Show Gist options
  • Save x43x61x69/9a5a231a25426e8a2cc0f7c24cfdaed9 to your computer and use it in GitHub Desktop.
Save x43x61x69/9a5a231a25426e8a2cc0f7c24cfdaed9 to your computer and use it in GitHub Desktop.
Steam Deck VNC Installation
#!/bin/bash
#
# Script for installing x11vnc on Steam Deck.
#
# Install:
#
# sh -c "$(curl -fsSL https://gist.githubusercontent.com/x43x61x69/9a5a231a25426e8a2cc0f7c24cfdaed9/raw/vnc_install.sh?$RANDOM)"
#
# This will modify root filesystem so it will probably get
# overwrite on system updates but is totally ok executing
# it several times, so if something stops working just
# launch it again.
#
# If you like seeing the terminal window, change
# "Terminal=false" to "Terminal=true" for the desktop entries below.
#
# Original script: àngel "mussol" bosch (muzzol@gmail.com)
#
echo -n "Checking root permissions: "
if [ "$(id -ru)" == "0" ]; then
echo "OK"
else
echo "user is $(whoami), trying again as root"
exec sudo sh -c "$(curl -fsSL https://gist.githubusercontent.com/x43x61x69/9a5a231a25426e8a2cc0f7c24cfdaed9/raw/vnc_install.sh?$RANDOM)"
exit 0
fi
## system related comands
echo "Disabling readonly filesystem"
steamos-readonly disable
if [ ! -e "/etc/pacman.d/gnupg/trustdb.gpg" ]; then
echo "Initalizing pacman keys"
pacman-key --init
pacman-key --populate archlinux
fi
echo "Installing package"
pacman -Sy --noconfirm x11vnc
echo "Re-enabling readonly filesystem"
steamos-readonly enable
## user related commands
DECK_USER=$(grep "^User=" /etc/sddm.conf.d/steamos.conf | cut -d"=" -f2)
echo "Creating desktop entries"
mkdir -p "/home/${DECK_USER}/Desktop/VNC/"
LAUNCHER_TEXT='[Desktop Entry]
Name=Start VNC
Exec=x11vnc -noxdamage -usepw -display :0 -no6 -forever -bg
Icon=/usr/share/app-info/icons/archlinux-arch-community/64x64/x11vnc_computer.png
Terminal=false
Type=Application
StartupNotify=false'
echo "$LAUNCHER_TEXT" > "/home/${DECK_USER}/Desktop/VNC/Start VNC.desktop"
chown "${DECK_USER}" "/home/${DECK_USER}/Desktop/VNC/Start VNC.desktop"
chmod +x "/home/${DECK_USER}/Desktop/VNC/Start VNC.desktop"
LAUNCHER_TEXT='[Desktop Entry]
Name=Stop VNC
Exec=killall x11vnc
Icon=/usr/share/app-info/icons/archlinux-arch-community/64x64/x11vnc_computer.png
Terminal=false
Type=Application
StartupNotify=false'
echo "$LAUNCHER_TEXT" > "/home/${DECK_USER}/Desktop/VNC/Stop VNC.desktop"
chown "${DECK_USER}" "/home/${DECK_USER}/Desktop/VNC/Stop VNC.desktop"
chmod +x "/home/${DECK_USER}/Desktop/VNC/Stop VNC.desktop"
LAUNCHER_TEXT='[Desktop Entry]
Name=Set VNC Password
Exec=sudo x11vnc -storepasswd; read -s -n 1 -p "Press any key to continue . . ."
Icon=/usr/share/app-info/icons/archlinux-arch-community/64x64/x11vnc_computer.png
Terminal=true
Type=Application
StartupNotify=false'
echo "$LAUNCHER_TEXT" > "/home/${DECK_USER}/Desktop/VNC/Set VNC Password.desktop"
chown "${DECK_USER}" "/home/${DECK_USER}/Desktop/VNC/Set VNC Password.desktop"
chmod +x "/home/${DECK_USER}/Desktop/VNC/Set VNC Password.desktop"
LAUNCHER_TEXT='[Desktop Entry]
Name=Reinstall VNC
Exec=sudo sh -c "$(curl -fsSL https://gist.githubusercontent.com/x43x61x69/9a5a231a25426e8a2cc0f7c24cfdaed9/raw/vnc_install.sh?$RANDOM)"
Icon=/usr/share/app-info/icons/archlinux-arch-community/64x64/x11vnc_computer.png
Terminal=true
Type=Application
StartupNotify=false'
echo "$LAUNCHER_TEXT" > "/home/${DECK_USER}/Desktop/VNC/Reinstall VNC.desktop"
chown "${DECK_USER}" "/home/${DECK_USER}/Desktop/VNC/Reinstall VNC.desktop"
chmod +x "/home/${DECK_USER}/Desktop/VNC/Reinstall VNC.desktop"
SCRIPT_TEXT='#!/bin/bash
x11vnc -noxdamage -usepw -display :0 -no6 -forever -bg'
echo "$SCRIPT_TEXT" > "/home/${DECK_USER}/Desktop/VNC/vnc_startup.sh"
chown "${DECK_USER}" "/home/${DECK_USER}/Desktop/VNC/vnc_startup.sh"
chmod +x "/home/${DECK_USER}/Desktop/VNC/vnc_startup.sh"
if [ ! -f "/home/${DECK_USER}/.vnc/passwd" ]; then
echo "Creating VNC password"
sudo -H -u "${DECK_USER}" bash -c "x11vnc -storepasswd"
fi
echo "Done!"
read -s -n 1 -p "Press any key to continue . . ."
echo ""
@iFrez
Copy link

iFrez commented Sep 29, 2023

Hello, got this error. SteamOS 3.5. Can you please help?

(2/2) checking package integrity [#######################################################] 100% error: libvncserver: signature from "GitLab CI Package Builder <ci-package-builder-1@steamos.cloud>" is unknown trust :: File /var/cache/pacman/pkg/libvncserver-0.9.14-2-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)). Do you want to delete it? [Y/n] error: x11vnc: signature from "GitLab CI Package Builder <ci-package-builder-1@steamos.cloud>" is unknown trust :: File /var/cache/pacman/pkg/x11vnc-1:0.9.16-7-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)). Do you want to delete it? [Y/n] error: failed to commit transaction (invalid or corrupted package (PGP signature)) Errors occurred, no packages were upgraded. Re-enabling readonly filesystem Creating desktop entries Done! Press any key to continue . . .

@edasque
Copy link

edasque commented Oct 25, 2023

Hello, got this error. SteamOS 3.5. Can you please help?

(2/2) checking package integrity [#######################################################] 100% error: libvncserver: signature from "GitLab CI Package Builder <ci-package-builder-1@steamos.cloud>" is unknown trust :: File /var/cache/pacman/pkg/libvncserver-0.9.14-2-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)). Do you want to delete it? [Y/n] error: x11vnc: signature from "GitLab CI Package Builder <ci-package-builder-1@steamos.cloud>" is unknown trust :: File /var/cache/pacman/pkg/x11vnc-1:0.9.16-7-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)). Do you want to delete it? [Y/n] error: failed to commit transaction (invalid or corrupted package (PGP signature)) Errors occurred, no packages were upgraded. Re-enabling readonly filesystem Creating desktop entries Done! Press any key to continue . . .

Try sudo pacman-key --populate holo. You might need sudo pacman -Scc after but try without first, @iFrez .

@kylefmohr
Copy link

Thanks @edasque I was facing the same error and sudo pacman-key --populate holo resolved it for me 👍

@ch4d1
Copy link

ch4d1 commented Mar 3, 2024

I have occasionally encountered the issue that the DisplayID was not "0". To resolve this issue, I modified the 'vnc_startup.sh' script. Now, it always retrieves and uses the current ID.

  • vnc_startup.sh
#!/bin/bash
display_id=$(who | grep "pts/0" | sed -n 's/.*(\(:[0-9]\)).*/\1/p' | tr -d ':')
x11vnc -noxdamage -usepw -display :$display_id -no6 -forever -bg

@TFWol
Copy link

TFWol commented Apr 14, 2024

@ch4d1 Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment