Steam doesn't run and the script for wine-proton doesn't exist.

/usr/local/bin/steam:58:in 'String#undump': invalid dumped string; not wrapped with '"' nor '"...".force_encoding("...")' form (RuntimeError)
from /usr/local/bin/steam:58:in 'block in Object#check_requirements'
from /usr/local/bin/steam:56:in 'String#each_line'
from /usr/local/bin/steam:56:in 'Object#check_requirements'
from /usr/local/bin/steam:109:in '<main>'
 
/usr/local/wine-proton/bin/pkg32.sh install wine-proton mesa-dri
/usr/local/steam-utils/bin/lsu-bootstrap --allow-stealing-my-passwords,-browser-history-and-ssh-keys
 
/usr/local/bin/steam:58:in 'String#undump': invalid dumped string; not wrapped with '"' nor '"...".force_encoding("...")' form (RuntimeError)
from /usr/local/bin/steam:58:in 'block in Object#check_requirements'
from /usr/local/bin/steam:56:in 'String#each_line'
from /usr/local/bin/steam:56:in 'Object#check_requirements'
from /usr/local/bin/steam:109:in '<main>'
You need to add a steamuser account to your FreeBSD and run into that profile or session. That the easiest way. And not all games is going to work... Another way is execute the software with your normal user but with steamuser account with nologin and pass your desktop session. That's more complicated you need to do some extra steps... Maybe tomorrow I can share part of the launcher code what I have.
 
I know it's a bad idea but I always remove the "dumb person" flag from the install script and install it on my user account. Also, I believe the pkg32.sh isn't needed since you can add launch option
PROTON_USE_WOW64=1 %command%
to your 32bit games. That seems to be working fine for my library of games.

EDIT:

By the way that would be these lines

Code:
DUMB_PERSON_FLAG = '--allow-stealing-my-passwords,-browser-history-and-ssh-keys'
skip_sanity_check = ARGV.include?(DUMB_PERSON_FLAG)

if !skip_sanity_check && `id -G`.split(' ').include?('0')
  STDERR.puts <<MSG

Please, consider setting up a dedicated OS user account for Steam.
Otherwise each and every Steam game will have unrestricted access to your files.
If you really couldn't care less, you can supress this message with
#{DUMB_PERSON_FLAG} flag.

MSG
  exit(1)
end

from /usr/local/steam-utils/bin/lsu-bootstrap

And you probably shouldn't do that. And I wouldn't recommend anyone do that. I'm just saying that I do. :D
 
I know it's a bad idea but I always remove the "dumb person" flag from the install script and install it on my user account. Also, I believe the pkg32.sh isn't needed since you can add launch option
PROTON_USE_WOW64=1 %command%
to your 32bit games. That seems to be working fine for my library of games.

EDIT:

By the way that would be these lines

Code:
DUMB_PERSON_FLAG = '--allow-stealing-my-passwords,-browser-history-and-ssh-keys'
skip_sanity_check = ARGV.include?(DUMB_PERSON_FLAG)

if !skip_sanity_check && `id -G`.split(' ').include?('0')
  STDERR.puts <<MSG

Please, consider setting up a dedicated OS user account for Steam.
Otherwise each and every Steam game will have unrestricted access to your files.
If you really couldn't care less, you can supress this message with
#{DUMB_PERSON_FLAG} flag.

MSG
  exit(1)
end

from /usr/local/steam-utils/bin/lsu-bootstrap

And you probably shouldn't do that. And I wouldn't recommend anyone do that. I'm just saying that I do. :D
On latest repository, there is only new wow64 mode, so no need for that flags
 
well here i share the code what im using: in this way im still in my primary account and i can execute the game launcher and games with another user session.

you need to add user with username steamuser and with session /nologin


sh:
#!/bin/sh
set -eu
umask 077

# Usuario de Steam: configurable.
STEAM_USER="${STEAM_USER:-steamuser}"

# Display: configurable, por defecto XWayland :0.
DISPLAY_NUM="${DISPLAY_NUM:-:0}"
DISPLAY_INDEX="${DISPLAY_NUM#:}"
DISPLAY_INDEX="${DISPLAY_INDEX%%.*}"

SOCKET="/tmp/.X11-unix/X${DISPLAY_INDEX}"

WORKDIR=""
AUTHDIR=""
XDG_DIR=""
AUTH_SOURCE=""
AUTH_COPY=""
SOCKET_SAVED=0
SOCKET_UID=""
SOCKET_GID=""
SOCKET_MODE=""
SOCKET_INODE=""
SOCKET_DEVICE=""

if [ "$(/usr/bin/id -u)" -ne 0 ]; then
    echo "Steam: se requiere root"
    exit 1
fi

# Obtener dinámicamente el usuario y grupo de Steam.
if ! /usr/bin/id "$STEAM_USER" >/dev/null 2>&1; then
    echo "Steam: usuario configurado inexistente: $STEAM_USER"
    exit 1
fi

STEAM_UID=$(/usr/bin/id -u "$STEAM_USER")
STEAM_GROUP=$(/usr/bin/id -gn "$STEAM_USER")

if [ "$STEAM_UID" -eq 0 ]; then
    echo "Steam: no se permite ejecutar Steam como root"
    exit 1
fi

# Detectar el usuario propietario del socket XWayland.
if [ ! -S "$SOCKET" ] || [ -L "$SOCKET" ]; then
    echo "Steam: socket XWayland inválido: $SOCKET"
    exit 1
fi

SESSION_UID=$(/usr/bin/stat -f '%u' "$SOCKET")
SESSION_USER=$(/usr/bin/id -nu "$SESSION_UID")

if [ -z "$SESSION_USER" ]; then
    echo "Steam: no se pudo identificar el usuario gráfico"
    exit 1
fi

if [ "$SESSION_UID" -eq "$STEAM_UID" ]; then
    echo "Steam: la sesión gráfica y Steam pertenecen al mismo usuario"
    echo "Steam: revisa la configuración antes de continuar"
    exit 1
fi

# Obtener el directorio XDG del usuario gráfico.
XDG_DIR="/var/run/xdg/$SESSION_USER"

if [ ! -d "$XDG_DIR" ] || [ -L "$XDG_DIR" ]; then
    echo "Steam: directorio XDG inválido: $XDG_DIR"
    exit 1
fi

XDG_META=$(/usr/bin/stat -f '%u %Lp' "$XDG_DIR")
set -- $XDG_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "700" ]; then
    echo "Steam: propietario o permisos XDG inesperados"
    exit 1
fi

# Detectar XWayland perteneciente al usuario gráfico.
PIDS=$(/usr/bin/pgrep -u "$SESSION_UID" -x Xwayland || true)
COUNT=0
PID=""

for CANDIDATE in $PIDS; do
    ARGS=$(/bin/ps -ww -p "$CANDIDATE" -o args=)

    case " $ARGS " in
        *" $DISPLAY_NUM "*)
            COUNT=$((COUNT + 1))
            PID=$CANDIDATE
            ;;
    esac
done

if [ "$COUNT" -ne 1 ]; then
    echo "Steam: no se encontró un único XWayland para $DISPLAY_NUM"
    exit 1
fi

ARGS=$(/bin/ps -ww -p "$PID" -o args=)

# Extraer dinámicamente la ruta -auth.
set -f
set -- $ARGS

EXPECT_AUTH=0

for ARG do
    if [ "$EXPECT_AUTH" -eq 1 ]; then
        AUTH_SOURCE=$ARG
        EXPECT_AUTH=0
        continue
    fi

    if [ "$ARG" = "-auth" ]; then
        EXPECT_AUTH=1
    fi
done

if [ -z "$AUTH_SOURCE" ]; then
    echo "Steam: no se encontró la autorización XWayland"
    exit 1
fi

case "$AUTH_SOURCE" in
    "$XDG_DIR"/xauth_*) ;;
    *)
        echo "Steam: ruta de autorización inesperada"
        exit 1
        ;;
esac

if [ ! -f "$AUTH_SOURCE" ] || [ -L "$AUTH_SOURCE" ]; then
    echo "Steam: archivo Xauthority inválido"
    exit 1
fi

AUTH_META=$(/usr/bin/stat -f '%u %Lp' "$AUTH_SOURCE")
set -- $AUTH_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "600" ]; then
    echo "Steam: propietario o permisos Xauthority inesperados"
    exit 1
fi

# Crear espacio temporal privado bajo control de root.
WORKDIR=$(/usr/bin/mktemp -d /var/run/steam-freebsd.XXXXXX)

cleanup() {
    STATUS=$?
    trap - EXIT HUP INT TERM
    set +e

    RESTORE_FAILED=0

    echo "Steam: restaurando configuración..."

    if [ -n "$AUTHDIR" ] && [ -d "$AUTHDIR" ]; then
        /bin/rm -rf "$AUTHDIR" || RESTORE_FAILED=1
    fi

    if [ "$SOCKET_SAVED" -eq 1 ]; then
        CURRENT_INODE=$(/usr/bin/stat -f '%i' "$SOCKET" 2>/dev/null)
        CURRENT_DEVICE=$(/usr/bin/stat -f '%d' "$SOCKET" 2>/dev/null)

        if [ -S "$SOCKET" ] &&
           [ "$CURRENT_INODE" = "$SOCKET_INODE" ] &&
           [ "$CURRENT_DEVICE" = "$SOCKET_DEVICE" ]; then

            /usr/sbin/chown "$SOCKET_UID:$SOCKET_GID" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/chmod "$SOCKET_MODE" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/setfacl -M "$WORKDIR/socket.acl" "$SOCKET" ||
                RESTORE_FAILED=1
        else
            echo "Steam: el socket XWayland cambió; no se restaurará a ciegas"
            RESTORE_FAILED=1
        fi
    fi

    if [ -n "$WORKDIR" ] && [ -d "$WORKDIR" ]; then
        /bin/rm -rf "$WORKDIR" || RESTORE_FAILED=1
    fi

    if [ "$RESTORE_FAILED" -ne 0 ]; then
        echo "Steam: ADVERTENCIA: restauración incompleta"
        [ "$STATUS" -ne 0 ] || STATUS=1
    else
        echo "Steam: permisos y ACL restaurados"
    fi

    exit "$STATUS"
}

trap cleanup EXIT
trap 'exit 129' HUP
trap 'exit 130' INT
trap 'exit 143' TERM

# Guardar permisos, ACL e identidad del socket.
SOCKET_META=$(/usr/bin/stat -f '%u %g %Lp %i %d' "$SOCKET")
set -- $SOCKET_META

SOCKET_UID=$1
SOCKET_GID=$2
SOCKET_MODE=$3
SOCKET_INODE=$4
SOCKET_DEVICE=$5

/bin/getfacl "$SOCKET" > "$WORKDIR/socket.acl"
SOCKET_SAVED=1

# Crear autorización temporal para Steam.
AUTHDIR=$(/usr/bin/mktemp -d /var/run/steam-xauth.XXXXXX)

/usr/sbin/chown root:wheel "$AUTHDIR"
/bin/chmod 711 "$AUTHDIR"

AUTH_COPY="$AUTHDIR/Xauthority"

/usr/bin/install -o "$STEAM_USER" -g "$STEAM_GROUP" -m 600 \
    "$AUTH_SOURCE" "$AUTH_COPY"

# Conceder acceso temporal al socket.
if ! /usr/bin/chgrp "$STEAM_GROUP" "$SOCKET" ||
   ! /bin/chmod 770 "$SOCKET"; then
    echo "Steam: no se pudo autorizar el socket XWayland"
    exit 1
fi

echo "======================================"
echo "Steam FreeBSD Launcher"
echo "======================================"
echo "Usuario gráfico: $SESSION_USER (UID $SESSION_UID)"
echo "Usuario Steam:   $STEAM_USER (UID $STEAM_UID)"
echo "Grupo Steam:     $STEAM_GROUP"
echo "Display:         $DISPLAY_NUM"
echo "XWayland PID:    $PID"
echo "NVIDIA PRIME:    habilitado"
echo "Vulkan NVIDIA:   preferido"
echo "======================================"

# Iniciar Steam con entorno controlado.
exec /usr/bin/su -m "$STEAM_USER" -c \
    "/usr/bin/env -i \
    HOME=/home/$STEAM_USER \
    USER=$STEAM_USER \
    LOGNAME=$STEAM_USER \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    LANG=C.UTF-8 \
    LC_CTYPE=C.UTF-8 \
    DISPLAY=$DISPLAY_NUM \
    XAUTHORITY=$AUTH_COPY \
    PROTON_USE_WOW64=1 \
    __NV_PRIME_RENDER_OFFLOAD=1 \
    __GLX_VENDOR_LIBRARY_NAME=nvidia \
    __VK_LAYER_NV_optimus=NVIDIA_only \
    /usr/local/bin/dbus-run-session -- /usr/local/bin/steam"
 
well here i share the code what im using: in this way im still in my primary account and i can execute the game launcher and games with another user session.

you need to add user with username steamuser and with session /nologin


sh:
#!/bin/sh
set -eu
umask 077

# Usuario de Steam: configurable.
STEAM_USER="${STEAM_USER:-steamuser}"

# Display: configurable, por defecto XWayland :0.
DISPLAY_NUM="${DISPLAY_NUM:-:0}"
DISPLAY_INDEX="${DISPLAY_NUM#:}"
DISPLAY_INDEX="${DISPLAY_INDEX%%.*}"

SOCKET="/tmp/.X11-unix/X${DISPLAY_INDEX}"

WORKDIR=""
AUTHDIR=""
XDG_DIR=""
AUTH_SOURCE=""
AUTH_COPY=""
SOCKET_SAVED=0
SOCKET_UID=""
SOCKET_GID=""
SOCKET_MODE=""
SOCKET_INODE=""
SOCKET_DEVICE=""

if [ "$(/usr/bin/id -u)" -ne 0 ]; then
    echo "Steam: se requiere root"
    exit 1
fi

# Obtener dinámicamente el usuario y grupo de Steam.
if ! /usr/bin/id "$STEAM_USER" >/dev/null 2>&1; then
    echo "Steam: usuario configurado inexistente: $STEAM_USER"
    exit 1
fi

STEAM_UID=$(/usr/bin/id -u "$STEAM_USER")
STEAM_GROUP=$(/usr/bin/id -gn "$STEAM_USER")

if [ "$STEAM_UID" -eq 0 ]; then
    echo "Steam: no se permite ejecutar Steam como root"
    exit 1
fi

# Detectar el usuario propietario del socket XWayland.
if [ ! -S "$SOCKET" ] || [ -L "$SOCKET" ]; then
    echo "Steam: socket XWayland inválido: $SOCKET"
    exit 1
fi

SESSION_UID=$(/usr/bin/stat -f '%u' "$SOCKET")
SESSION_USER=$(/usr/bin/id -nu "$SESSION_UID")

if [ -z "$SESSION_USER" ]; then
    echo "Steam: no se pudo identificar el usuario gráfico"
    exit 1
fi

if [ "$SESSION_UID" -eq "$STEAM_UID" ]; then
    echo "Steam: la sesión gráfica y Steam pertenecen al mismo usuario"
    echo "Steam: revisa la configuración antes de continuar"
    exit 1
fi

# Obtener el directorio XDG del usuario gráfico.
XDG_DIR="/var/run/xdg/$SESSION_USER"

if [ ! -d "$XDG_DIR" ] || [ -L "$XDG_DIR" ]; then
    echo "Steam: directorio XDG inválido: $XDG_DIR"
    exit 1
fi

XDG_META=$(/usr/bin/stat -f '%u %Lp' "$XDG_DIR")
set -- $XDG_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "700" ]; then
    echo "Steam: propietario o permisos XDG inesperados"
    exit 1
fi

# Detectar XWayland perteneciente al usuario gráfico.
PIDS=$(/usr/bin/pgrep -u "$SESSION_UID" -x Xwayland || true)
COUNT=0
PID=""

for CANDIDATE in $PIDS; do
    ARGS=$(/bin/ps -ww -p "$CANDIDATE" -o args=)

    case " $ARGS " in
        *" $DISPLAY_NUM "*)
            COUNT=$((COUNT + 1))
            PID=$CANDIDATE
            ;;
    esac
done

if [ "$COUNT" -ne 1 ]; then
    echo "Steam: no se encontró un único XWayland para $DISPLAY_NUM"
    exit 1
fi

ARGS=$(/bin/ps -ww -p "$PID" -o args=)

# Extraer dinámicamente la ruta -auth.
set -f
set -- $ARGS

EXPECT_AUTH=0

for ARG do
    if [ "$EXPECT_AUTH" -eq 1 ]; then
        AUTH_SOURCE=$ARG
        EXPECT_AUTH=0
        continue
    fi

    if [ "$ARG" = "-auth" ]; then
        EXPECT_AUTH=1
    fi
done

if [ -z "$AUTH_SOURCE" ]; then
    echo "Steam: no se encontró la autorización XWayland"
    exit 1
fi

case "$AUTH_SOURCE" in
    "$XDG_DIR"/xauth_*) ;;
    *)
        echo "Steam: ruta de autorización inesperada"
        exit 1
        ;;
esac

if [ ! -f "$AUTH_SOURCE" ] || [ -L "$AUTH_SOURCE" ]; then
    echo "Steam: archivo Xauthority inválido"
    exit 1
fi

AUTH_META=$(/usr/bin/stat -f '%u %Lp' "$AUTH_SOURCE")
set -- $AUTH_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "600" ]; then
    echo "Steam: propietario o permisos Xauthority inesperados"
    exit 1
fi

# Crear espacio temporal privado bajo control de root.
WORKDIR=$(/usr/bin/mktemp -d /var/run/steam-freebsd.XXXXXX)

cleanup() {
    STATUS=$?
    trap - EXIT HUP INT TERM
    set +e

    RESTORE_FAILED=0

    echo "Steam: restaurando configuración..."

    if [ -n "$AUTHDIR" ] && [ -d "$AUTHDIR" ]; then
        /bin/rm -rf "$AUTHDIR" || RESTORE_FAILED=1
    fi

    if [ "$SOCKET_SAVED" -eq 1 ]; then
        CURRENT_INODE=$(/usr/bin/stat -f '%i' "$SOCKET" 2>/dev/null)
        CURRENT_DEVICE=$(/usr/bin/stat -f '%d' "$SOCKET" 2>/dev/null)

        if [ -S "$SOCKET" ] &&
           [ "$CURRENT_INODE" = "$SOCKET_INODE" ] &&
           [ "$CURRENT_DEVICE" = "$SOCKET_DEVICE" ]; then

            /usr/sbin/chown "$SOCKET_UID:$SOCKET_GID" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/chmod "$SOCKET_MODE" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/setfacl -M "$WORKDIR/socket.acl" "$SOCKET" ||
                RESTORE_FAILED=1
        else
            echo "Steam: el socket XWayland cambió; no se restaurará a ciegas"
            RESTORE_FAILED=1
        fi
    fi

    if [ -n "$WORKDIR" ] && [ -d "$WORKDIR" ]; then
        /bin/rm -rf "$WORKDIR" || RESTORE_FAILED=1
    fi

    if [ "$RESTORE_FAILED" -ne 0 ]; then
        echo "Steam: ADVERTENCIA: restauración incompleta"
        [ "$STATUS" -ne 0 ] || STATUS=1
    else
        echo "Steam: permisos y ACL restaurados"
    fi

    exit "$STATUS"
}

trap cleanup EXIT
trap 'exit 129' HUP
trap 'exit 130' INT
trap 'exit 143' TERM

# Guardar permisos, ACL e identidad del socket.
SOCKET_META=$(/usr/bin/stat -f '%u %g %Lp %i %d' "$SOCKET")
set -- $SOCKET_META

SOCKET_UID=$1
SOCKET_GID=$2
SOCKET_MODE=$3
SOCKET_INODE=$4
SOCKET_DEVICE=$5

/bin/getfacl "$SOCKET" > "$WORKDIR/socket.acl"
SOCKET_SAVED=1

# Crear autorización temporal para Steam.
AUTHDIR=$(/usr/bin/mktemp -d /var/run/steam-xauth.XXXXXX)

/usr/sbin/chown root:wheel "$AUTHDIR"
/bin/chmod 711 "$AUTHDIR"

AUTH_COPY="$AUTHDIR/Xauthority"

/usr/bin/install -o "$STEAM_USER" -g "$STEAM_GROUP" -m 600 \
    "$AUTH_SOURCE" "$AUTH_COPY"

# Conceder acceso temporal al socket.
if ! /usr/bin/chgrp "$STEAM_GROUP" "$SOCKET" ||
   ! /bin/chmod 770 "$SOCKET"; then
    echo "Steam: no se pudo autorizar el socket XWayland"
    exit 1
fi

echo "======================================"
echo "Steam FreeBSD Launcher"
echo "======================================"
echo "Usuario gráfico: $SESSION_USER (UID $SESSION_UID)"
echo "Usuario Steam:   $STEAM_USER (UID $STEAM_UID)"
echo "Grupo Steam:     $STEAM_GROUP"
echo "Display:         $DISPLAY_NUM"
echo "XWayland PID:    $PID"
echo "NVIDIA PRIME:    habilitado"
echo "Vulkan NVIDIA:   preferido"
echo "======================================"

# Iniciar Steam con entorno controlado.
exec /usr/bin/su -m "$STEAM_USER" -c \
    "/usr/bin/env -i \
    HOME=/home/$STEAM_USER \
    USER=$STEAM_USER \
    LOGNAME=$STEAM_USER \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    LANG=C.UTF-8 \
    LC_CTYPE=C.UTF-8 \
    DISPLAY=$DISPLAY_NUM \
    XAUTHORITY=$AUTH_COPY \
    PROTON_USE_WOW64=1 \
    __NV_PRIME_RENDER_OFFLOAD=1 \
    __GLX_VENDOR_LIBRARY_NAME=nvidia \
    __VK_LAYER_NV_optimus=NVIDIA_only \
    /usr/local/bin/dbus-run-session -- /usr/local/bin/steam"
That's way safer than how I carelessly use the installer. haha
 
That's way safer than how I carelessly use the installer. haha
well im making v2 script with everithing ready i added cleanup and improved some security. so you can play your games in your account with isolated temporary session. for now is only working with wayland and plasma6. in future versions you can modify. i just need to figure out how i can pass context menu from system tray icon from steam to current user session (safely?) xd.
 
hello... this is another version... of the script is more stable... and cleaning up the session.

freebsd 15.1
plasma5
wayland
pulseaudio
steamuser with /nologin
linux_ebable=yes

this script is located in: /usr/local/sbin/steam-freebsd-start

sh:
#!/bin/sh
set -eu
umask 077

# Usuario de Steam: configurable.
STEAM_USER="${STEAM_USER:-steamuser}"

# Display: configurable, por defecto XWayland :0.
DISPLAY_NUM="${DISPLAY_NUM:-:0}"
DISPLAY_INDEX="${DISPLAY_NUM#:}"
DISPLAY_INDEX="${DISPLAY_INDEX%%.*}"

SOCKET="/tmp/.X11-unix/X${DISPLAY_INDEX}"

WORKDIR=""
AUTHDIR=""
XDG_DIR=""
AUTH_SOURCE=""
AUTH_COPY=""
SOCKET_SAVED=0
SOCKET_UID=""
SOCKET_GID=""
SOCKET_MODE=""
SOCKET_INODE=""
SOCKET_DEVICE=""
STEAM_XDG_DIR=""

if [ "$(/usr/bin/id -u)" -ne 0 ]; then
    echo "Steam: se requiere root"
    exit 1
fi

# Obtener dinámicamente el usuario y grupo de Steam.
if ! /usr/bin/id "$STEAM_USER" >/dev/null 2>&1; then
    echo "Steam: usuario configurado inexistente: $STEAM_USER"
    exit 1
fi

STEAM_UID=$(/usr/bin/id -u "$STEAM_USER")
STEAM_GROUP=$(/usr/bin/id -gn "$STEAM_USER")

if [ "$STEAM_UID" -eq 0 ]; then
    echo "Steam: no se permite ejecutar Steam como root"
    exit 1
fi

# Detectar el usuario propietario del socket XWayland.
if [ ! -S "$SOCKET" ] || [ -L "$SOCKET" ]; then
    echo "Steam: socket XWayland inválido: $SOCKET"
    exit 1
fi

SESSION_UID=$(/usr/bin/stat -f '%u' "$SOCKET")
SESSION_USER=$(/usr/bin/id -nu "$SESSION_UID")

if [ -z "$SESSION_USER" ]; then
    echo "Steam: no se pudo identificar el usuario gráfico"
    exit 1
fi

if [ "$SESSION_UID" -eq "$STEAM_UID" ]; then
    echo "Steam: la sesión gráfica y Steam pertenecen al mismo usuario"
    echo "Steam: revisa la configuración antes de continuar"
    exit 1
fi

# Obtener el directorio XDG del usuario gráfico.
XDG_DIR="/var/run/xdg/$SESSION_USER"

if [ ! -d "$XDG_DIR" ] || [ -L "$XDG_DIR" ]; then
    echo "Steam: directorio XDG inválido: $XDG_DIR"
    exit 1
fi

XDG_META=$(/usr/bin/stat -f '%u %Lp' "$XDG_DIR")
set -- $XDG_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "700" ]; then
    echo "Steam: propietario o permisos XDG inesperados"
    exit 1
fi

# Detectar XWayland perteneciente al usuario gráfico.
PIDS=$(/usr/bin/pgrep -u "$SESSION_UID" -x Xwayland || true)
COUNT=0
PID=""

for CANDIDATE in $PIDS; do
    ARGS=$(/bin/ps -ww -p "$CANDIDATE" -o args=)

    case " $ARGS " in
        *" $DISPLAY_NUM "*)
            COUNT=$((COUNT + 1))
            PID=$CANDIDATE
            ;;
    esac
done

if [ "$COUNT" -ne 1 ]; then
    echo "Steam: no se encontró un único XWayland para $DISPLAY_NUM"
    exit 1
fi

ARGS=$(/bin/ps -ww -p "$PID" -o args=)

# Extraer dinámicamente la ruta -auth.
set -f
set -- $ARGS

EXPECT_AUTH=0

for ARG do
    if [ "$EXPECT_AUTH" -eq 1 ]; then
        AUTH_SOURCE=$ARG
        EXPECT_AUTH=0
        continue
    fi

    if [ "$ARG" = "-auth" ]; then
        EXPECT_AUTH=1
    fi
done

if [ -z "$AUTH_SOURCE" ]; then
    echo "Steam: no se encontró la autorización XWayland"
    exit 1
fi

case "$AUTH_SOURCE" in
    "$XDG_DIR"/xauth_*) ;;
    *)
        echo "Steam: ruta de autorización inesperada"
        exit 1
        ;;
esac

if [ ! -f "$AUTH_SOURCE" ] || [ -L "$AUTH_SOURCE" ]; then
    echo "Steam: archivo Xauthority inválido"
    exit 1
fi

AUTH_META=$(/usr/bin/stat -f '%u %Lp' "$AUTH_SOURCE")
set -- $AUTH_META

if [ "$1" != "$SESSION_UID" ] || [ "$2" != "600" ]; then
    echo "Steam: propietario o permisos Xauthority inesperados"
    exit 1
fi

# Crear espacio temporal privado bajo control de root.
WORKDIR=$(/usr/bin/mktemp -d /var/run/steam-freebsd.XXXXXX)

cleanup() {
    STATUS=$?
    trap - EXIT HUP INT TERM
    set +e

    RESTORE_FAILED=0

    echo "Steam: restaurando configuración..."

    if [ -n "$AUTHDIR" ] && [ -d "$AUTHDIR" ]; then
        /bin/rm -rf "$AUTHDIR" || RESTORE_FAILED=1
    fi

    if [ -n "$STEAM_XDG_DIR" ] &&
       [ -d "$STEAM_XDG_DIR" ] &&
       [ ! -L "$STEAM_XDG_DIR" ]; then
        /bin/rm -rf "$STEAM_XDG_DIR" || RESTORE_FAILED=1
    fi

    if [ "$SOCKET_SAVED" -eq 1 ]; then
        CURRENT_INODE=$(/usr/bin/stat -f '%i' "$SOCKET" 2>/dev/null)
        CURRENT_DEVICE=$(/usr/bin/stat -f '%d' "$SOCKET" 2>/dev/null)

        if [ -S "$SOCKET" ] &&
           [ "$CURRENT_INODE" = "$SOCKET_INODE" ] &&
           [ "$CURRENT_DEVICE" = "$SOCKET_DEVICE" ]; then

            /usr/sbin/chown "$SOCKET_UID:$SOCKET_GID" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/chmod "$SOCKET_MODE" "$SOCKET" ||
                RESTORE_FAILED=1

            /bin/setfacl -M "$WORKDIR/socket.acl" "$SOCKET" ||
                RESTORE_FAILED=1
        else
            echo "Steam: el socket XWayland cambió; no se restaurará a ciegas"
            RESTORE_FAILED=1
        fi
    fi

    if [ -n "$WORKDIR" ] && [ -d "$WORKDIR" ]; then
        /bin/rm -rf "$WORKDIR" || RESTORE_FAILED=1
    fi

    if [ "$RESTORE_FAILED" -ne 0 ]; then
        echo "Steam: ADVERTENCIA: restauración incompleta"
        [ "$STATUS" -ne 0 ] || STATUS=1
    else
        echo "Steam: permisos y ACL restaurados"
    fi

    exit "$STATUS"
}

trap cleanup EXIT
trap 'exit 129' HUP
trap 'exit 130' INT
trap 'exit 143' TERM

# Crear runtime XDG privado para Steam.
STEAM_XDG_DIR=$(/usr/bin/mktemp -d /var/run/steam-xdg.XXXXXX)

/usr/sbin/chown "$STEAM_UID:$STEAM_GROUP" "$STEAM_XDG_DIR"
/bin/chmod 700 "$STEAM_XDG_DIR"

# Guardar permisos, ACL e identidad del socket.
SOCKET_META=$(/usr/bin/stat -f '%u %g %Lp %i %d' "$SOCKET")
set -- $SOCKET_META

SOCKET_UID=$1
SOCKET_GID=$2
SOCKET_MODE=$3
SOCKET_INODE=$4
SOCKET_DEVICE=$5

/bin/getfacl "$SOCKET" > "$WORKDIR/socket.acl"
SOCKET_SAVED=1

# Crear autorización temporal para Steam.
AUTHDIR=$(/usr/bin/mktemp -d /var/run/steam-xauth.XXXXXX)

/usr/sbin/chown root:wheel "$AUTHDIR"
/bin/chmod 711 "$AUTHDIR"

AUTH_COPY="$AUTHDIR/Xauthority"

/usr/bin/install -o "$STEAM_USER" -g "$STEAM_GROUP" -m 600 \
    "$AUTH_SOURCE" "$AUTH_COPY"

# Conceder acceso temporal al socket.
if ! /usr/bin/chgrp "$STEAM_GROUP" "$SOCKET" ||
   ! /bin/chmod 770 "$SOCKET"; then
    echo "Steam: no se pudo autorizar el socket XWayland"
    exit 1
fi

echo "======================================"
echo "Steam FreeBSD Launcher"
echo "======================================"
echo "Usuario gráfico: $SESSION_USER (UID $SESSION_UID)"
echo "Usuario Steam:   $STEAM_USER (UID $STEAM_UID)"
echo "Grupo Steam:     $STEAM_GROUP"
echo "Display:         $DISPLAY_NUM"
echo "XWayland PID:    $PID"
echo "NVIDIA PRIME:    habilitado"
echo "Vulkan NVIDIA:   preferido"
echo "======================================"

# Iniciar Steam con entorno controlado.
/usr/bin/su -m "$STEAM_USER" -c \
    "/usr/bin/env -i \
    HOME=/home/$STEAM_USER \
    USER=$STEAM_USER \
    LOGNAME=$STEAM_USER \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    LANG=C.UTF-8 \
    LC_CTYPE=C.UTF-8 \
    DISPLAY=$DISPLAY_NUM \
    XAUTHORITY=$AUTH_COPY \
    XDG_RUNTIME_DIR=$STEAM_XDG_DIR \
    PROTON_USE_WOW64=1 \
    __NV_PRIME_RENDER_OFFLOAD=1 \
    __GLX_VENDOR_LIBRARY_NAME=nvidia \
    __VK_LAYER_NV_optimus=NVIDIA_only \
    /usr/local/bin/dbus-run-session -- /usr/local/bin/steam"

some games from steam not working still asking for vulkan 1.2+ when i have 1.4 and sometimes sound issues. next version i also fix that. enjoy.
 

Attachments

  • Screenshot_20261110_183647.png
    Screenshot_20261110_183647.png
    1.4 MB · Views: 8
  • Screenshot_20261110_183711.png
    Screenshot_20261110_183711.png
    1.2 MB · Views: 14
What cat `sysctl -qn compat.linux.emul_path`/etc/os-release gives you?
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.7
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
 
Back
Top