Compare commits

..
Author SHA1 Message Date
The412Banner 42aa7692dc FEX: fall back to openat inside the rootfs when openat2 is missing
Our proot answers openat2 with ENOSYS. FEX opened every rootfs path with
openat2(RESOLVE_IN_ROOT) and only fell back on EXDEV, so in a session
every x86 file lookup missed the rootfs and hit the arm64 guest: bash
under FEX could not find libtinfo. GetEmulatedFDPath already follows
absolute symlinks inside the rootfs, so a plain openat relative to the
rootfs fd is the same lookup. The rootfs also gets an empty
ld.so.preload, so the guest's arm64 preloads are not tried.
2026-10-02 14:38:37 -04:00
The412Banner 5786ddf81f bannerlator-steam-x64: no early FEX run, stop a stale FEXServer
FEX processes take the rootfs from FEXServer. The version probe started
one before FEX_ROOTFS was set, and later clients inherited its empty
rootfs. Still not enough on its own on the device: under investigation.
2026-10-02 14:04:13 -04:00
The412Banner ec3243a997 bannerlator-steam-x64: a finished rootfs download is not a failure
curl -C - on a complete file gets 416, which set -e turned into an abort.
The Ubuntu 24.04 image is 525 MB, not 850.
2026-10-02 13:58:23 -04:00
The412Banner d5ef1c832a Opt-in x86-64 Steam client under FEX
The arm64 Linux client never runs VAC: TF2 and L4D2 are refused by VAC
servers and no client log mentions VAC, because VAC modules are x86 code.
bannerlator-steam-x64 installs Valve's x86-64 client, FEX and FEX's
Ubuntu 24.04 x86 rootfs, and runs the client unchanged under FEX in a
home of its own, sharing only steamapps with the arm64 client. The arm64
client stays the default; the desktop menu gets an experimental entry.
2026-10-02 13:56:22 -04:00
4 changed files with 180 additions and 1 deletions

No files matched your search

+4 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/bash
# Runs INSIDE an Arch Linux ARM container (menci/archlinuxarm:base-devel) on an arm64 runner.
# Builds FEX for the runtime (Arch Linux ARM ships no package and FEX publishes no Linux
# Builds FEX for the runtime, with tools/fex/patches, (Arch Linux ARM ships no package and FEX publishes no Linux
# binaries), plus the runtime's own unsquashfs to unpack FEX's x86 rootfs image, and packs both
# as fex.tzst (usr/local/...) for bannerlator-steam-x64 to stage. No thunks: they need an x86
# cross toolchain, and the x86-64 Steam client only needs FEX to run, not host GPU drivers.
@@ -15,6 +15,9 @@ mv /etc/pacman.d/mirrorlist.new /etc/pacman.d/mirrorlist
pacman -Syu --noconfirm --needed git zstd binutils cmake ninja clang lld llvm python squashfs-tools file
rm -rf fex-src out && git clone -q --depth 1 --branch "$VERSION" --recurse-submodules --shallow-submodules https://github.com/FEX-Emu/FEX.git fex-src
# Our proot answers openat2 with ENOSYS (tools/proot/PATCHES.md, 0008); FEX opened every rootfs
# path with openat2 and fell through to the arm64 guest's files on anything but EXDEV.
for p in tools/fex/patches/*.patch; do patch -d fex-src -p1 --no-backup-if-mismatch < "$p"; done
# TUNE_CPU none: the default (native) would tune for the runner's Neoverse cores, not the device.
cmake -S fex-src -B fex-build -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
@@ -0,0 +1,42 @@
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp
index 7172460..d566e3b 100644
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp
@@ -674,9 +674,10 @@ uint64_t FileManager::Open(const char* pathname, int flags, uint32_t mode) {
};
fd = ::syscall(SYSCALL_DEF(openat2), Path.FD, Path.Path, &how, sizeof(how));
- if (fd == -1 && errno == EXDEV) {
- // This means a magic symlink (/proc/foo) was involved. In this case we
- // just punt and do the access without RESOLVE_IN_ROOT.
+ if (fd == -1 && (errno == EXDEV || errno == ENOSYS)) {
+ // EXDEV: a magic symlink (/proc/foo) was involved. ENOSYS: no openat2 here (proot).
+ // Either way, do the access without RESOLVE_IN_ROOT; GetEmulatedFDPath has already
+ // followed absolute symlinks inside the rootfs.
fd = ::syscall(SYSCALL_DEF(openat), Path.FD, Path.Path, flags, mode);
}
}
@@ -927,9 +928,10 @@ uint64_t FileManager::Openat([[maybe_unused]] int dirfs, const char* pathname, i
.resolve = (Path.FD == AT_FDCWD) ? 0u : RESOLVE_IN_ROOT, // AT_FDCWD means it's a thunk and not via RootFS
};
fd = ::syscall(SYSCALL_DEF(openat2), Path.FD, Path.Path, &how, sizeof(how));
- if (fd == -1 && errno == EXDEV) {
- // This means a magic symlink (/proc/foo) was involved. In this case we
- // just punt and do the access without RESOLVE_IN_ROOT.
+ if (fd == -1 && (errno == EXDEV || errno == ENOSYS)) {
+ // EXDEV: a magic symlink (/proc/foo) was involved. ENOSYS: no openat2 here (proot).
+ // Either way, do the access without RESOLVE_IN_ROOT; GetEmulatedFDPath has already
+ // followed absolute symlinks inside the rootfs.
fd = ::syscall(SYSCALL_DEF(openat), Path.FD, Path.Path, flags, mode);
}
}
@@ -967,6 +969,9 @@ uint64_t FileManager::Openat2(int dirfs, const char* pathname, FEX::HLE::open_ho
// This means a magic symlink (/proc/foo) was involved. In this case we
// just punt and do the access without RESOLVE_IN_ROOT.
fd = ::syscall(SYSCALL_DEF(openat2), Path.FD, Path.Path, how, usize);
+ } else if (fd == -1 && errno == ENOSYS && how->resolve == 0) {
+ // No openat2 here (proot): the plain openat inside the rootfs, as above.
+ fd = ::syscall(SYSCALL_DEF(openat), Path.FD, Path.Path, (int)how->flags, (int)how->mode);
}
}
+11
View File
@@ -119,6 +119,17 @@ export BL_DESKTOP=1
ln -sf /usr/local/bin/bannerlator-steam-launch /usr/local/bin/steamdeck-steam 2>/dev/null
ln -sf /usr/local/bin/bannerlator-steam-shim /usr/local/bin/steam 2>/dev/null
python3 /usr/local/bin/bannerlator-desktop-games 2>&1 | sed 's/^/[games] /'
# EXPERIMENT: Valve's x86-64 client under FEX (bannerlator-steam-x64), in a terminal so its
# first-run downloads show. Not a Game entry, so droiddeck-desktop-gpu leaves its Exec alone.
cat > /usr/share/applications/droiddeck-steam-x64.desktop <<'ENTRY'
[Desktop Entry]
Type=Application
Name=Steam x86-64 (FEX, experimental)
Comment=Valve's x86-64 Linux client under FEX, in its own home with its own login
Exec=qterminal -e /usr/local/bin/bannerlator-steam-x64
Icon=steam
Categories=System;
ENTRY
# Player 1 on the controller in every emulator that has no profile of its own yet - now, and again
# every half minute: an emulator started for the first time writes its own config, which is then
# given the controller for its next start without waiting for the next desktop.
+123
View File
@@ -0,0 +1,123 @@
#!/bin/bash
# EXPERIMENT, opt-in: Valve's x86-64 Linux Steam client under FEX, beside the default arm64 one.
# bannerlator-steam-x64 [steam:// URL or client arguments]
#
# Why: the arm64 Linux client never runs VAC (TF2, L4D2: "Connection Blocked ... VAC secured
# server", no VAC line in any client log) - VAC modules are x86 code. The x86-64 client under FEX
# has a module it can run, the way SteamLite does in Wine. This runs Valve's client unchanged.
#
# Everything lives in its own home ($X64_HOME): the x86 client gets its own ~/.steam links, its
# own login and its own config, and never touches the arm64 client's. Games are shared: its
# steamapps is the arm64 client's. Only one client runs at a time (same account), so the arm64
# one is shut down first.
#
# First run downloads FEX (this repo's release), FEX's Ubuntu 24.04 x86 rootfs (~525 MB, unpacked
# ~1.5 GB) and the x86 client (~600 MB). Log: $X64_HOME/steam-x64.log.
set -eu
FEX_TAG=fex-2609-r2
FEX_SHA256=PENDING
FEX_URL=https://github.com/Droid-Deck/DroidDeck/releases/download/$FEX_TAG/fex.tzst
ROOTFS_URL=https://rootfs.fex-emu.gg/Ubuntu_24_04/2026-08-11/Ubuntu_24_04.sqsh
CDN=https://client-update.fastly.steamstatic.com
MANIFEST=steam_client_publicbeta_ubuntu12
REAL_HOME=${HOME:-/root}
X64_HOME=${BL_X64_HOME:-$REAL_HOME/.droiddeck-x64}
ROOTFS=$X64_HOME/rootfs
STEAM_X64=$X64_HOME/.local/share/Steam
ARM_STEAM=${XDG_DATA_HOME:-$REAL_HOME/.local/share}/Steam
LOG=$X64_HOME/steam-x64.log
mkdir -p "$X64_HOME"
step() { echo "== $(date -u +%H:%M:%S) $*" | tee -a "$LOG"; }
# --- FEX -------------------------------------------------------------------------------------
if [ ! -x /usr/local/bin/FEX ] || [ "$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null)" != "$FEX_TAG" ]; then
step "downloading FEX ($FEX_TAG)"
tmp=$(mktemp -d)
curl -fL --progress-bar "$FEX_URL" -o "$tmp/fex.tzst"
if [ "$FEX_SHA256" != PENDING ]; then echo "$FEX_SHA256 $tmp/fex.tzst" | sha256sum -c --quiet; fi
zstd -dc "$tmp/fex.tzst" | tar -C / -x
rm -rf "$tmp"
mkdir -p /usr/local/share/fex-emu && echo "$FEX_TAG" > /usr/local/share/fex-emu/.droiddeck-tag
fi
step "FEX ready ($FEX_TAG)"
# --- x86 rootfs --------------------------------------------------------------------------------
if [ ! -f "$ROOTFS/.droiddeck-complete" ]; then
step "downloading FEX's Ubuntu 24.04 x86 rootfs"
# Resumes a part-done download; a finished one answers 416, which is not a failure here.
curl -fL --progress-bar -C - "$ROOTFS_URL" -o "$X64_HOME/rootfs.sqsh" || {
rc=$?
[ "$rc" = 22 ] && [ -s "$X64_HOME/rootfs.sqsh" ] || { step "rootfs download failed (curl $rc)"; exit 1; }
}
step "unpacking the rootfs"
rm -rf "$ROOTFS"
# Ownership and xattrs mean nothing in this guest; device nodes cannot be made here and are not
# needed (FEX passes /dev through from the host).
/usr/local/bin/unsquashfs -no-xattrs -no-progress -ignore-errors -d "$ROOTFS" "$X64_HOME/rootfs.sqsh" >>"$LOG" 2>&1 || true
[ -x "$ROOTFS/usr/bin/bash" ] || { step "rootfs unpack failed (no usr/bin/bash); see $LOG"; exit 1; }
rm -f "$X64_HOME/rootfs.sqsh"
touch "$ROOTFS/.droiddeck-complete"
fi
# A path missing from the rootfs falls through to the guest: without its own, the x86 loader
# reads the guest's /etc/ld.so.preload and tries to load the session's arm64 preloads.
if [ ! -e "$ROOTFS/etc/ld.so.preload" ]; then
: > "$ROOTFS/etc/ld.so.preload"
fi
# --- the x86-64 client -------------------------------------------------------------------------
if [ ! -x "$STEAM_X64/steamrt64/steam" ] || [ ! -f "$STEAM_X64/package/droiddeck-installed" ]; then
step "downloading the x86-64 Steam client ($MANIFEST)"
work=$(mktemp -d)
curl -fsSL "$CDN/$MANIFEST" -o "$work/manifest"
version=$(awk -F'"' '$2 == "version" { print $4; exit }' "$work/manifest")
# Same parsing as bannerlator-steam-install: every component block's plain zip and sha256.
awk -F'"' '
/^\t"/ && NF >= 3 && $4 == "" { block = $2 }
$2 == "file" { file[block] = $4 }
$2 == "sha2" { sha[block] = $4 }
END { for (b in file) if (b ~ /_all$/ || b ~ /_ubuntu12$/) print b, file[b], sha[b] }
' "$work/manifest" | sort > "$work/parts"
[ -s "$work/parts" ] || { step "no client components in $MANIFEST"; exit 1; }
mkdir -p "$STEAM_X64/package"
total=$(grep -c . "$work/parts")
i=0
while read -r block file sum; do
i=$((i + 1))
step "client: $block ($i/$total)"
curl -fsSL "$CDN/$file" -o "$work/$file"
echo "$sum $work/$file" | sha256sum -c --quiet
unzip -qo "$work/$file" -d "$STEAM_X64"
rm -f "$work/$file"
done < "$work/parts"
rm -rf "$work"
echo publicbeta > "$STEAM_X64/package/beta"
echo "$version" > "$STEAM_X64/package/droiddeck-installed"
chmod +x "$STEAM_X64/steam.sh" "$STEAM_X64/steamrt64/steam" "$STEAM_X64/ubuntu12_32/steam" 2>/dev/null || true
fi
# Shared games: the arm64 client's library, as long as it is not running at the same time.
if [ -d "$ARM_STEAM/steamapps" ] && [ ! -e "$STEAM_X64/steamapps" ]; then
ln -s "$ARM_STEAM/steamapps" "$STEAM_X64/steamapps"
fi
# --- one client at a time ----------------------------------------------------------------------
if pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1; then
step "shutting down the arm64 client first"
"$ARM_STEAM/steamrtarm64/steam" -shutdown >/dev/null 2>&1 || true
for _ in $(seq 1 30); do pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1 || break; sleep 1; done
fi
# --- run ---------------------------------------------------------------------------------------
# The arm64 session's library paths and preloads are aarch64 and mean nothing to x86 processes.
unset LD_LIBRARY_PATH LD_PRELOAD STEAM_RUNTIME STEAM_RUNTIME_PREFER_HOST_LIBRARIES
export HOME=$X64_HOME
export FEX_ROOTFS=$ROOTFS
# A FEX process takes its rootfs from FEXServer, not from its own environment, and a server
# started earlier without FEX_ROOTFS (any FEX run in this guest) answers with no rootfs at all:
# every x86 library lookup then falls through to the arm64 guest. Stop it, so the next FEX
# starts one with this rootfs.
/usr/local/bin/FEXServer -k >/dev/null 2>&1 || true
export STEAM_EXTRA_COMPAT_TOOLS_PATHS=
step "starting the x86-64 client under FEX: steam.sh -no-cef-sandbox $*"
cd "$STEAM_X64"
exec /usr/local/bin/FEX "$ROOTFS/usr/bin/bash" "$STEAM_X64/steam.sh" -no-cef-sandbox "$@" >>"$LOG" 2>&1