From a13f5a425938734ffab6a87325d2e999cac6f236 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 7 Jul 2026 11:43:50 +0200 Subject: [PATCH] Fix Claude Desktop Selkies startup --- claude_desktop/CHANGELOG.md | 4 ++++ claude_desktop/config.yaml | 2 +- .../rootfs/etc/cont-init.d/20-folders.sh | 23 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/claude_desktop/CHANGELOG.md b/claude_desktop/CHANGELOG.md index 335008021a..b69bbf90aa 100644 --- a/claude_desktop/CHANGELOG.md +++ b/claude_desktop/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2 (07-07-2026) + +- Fix Selkies startup by creating the s6 environment directory and XDG runtime directory before services start. + ## 1.0 (07-07-2026) - Minor bugs fixed # Changelog diff --git a/claude_desktop/config.yaml b/claude_desktop/config.yaml index 3195b4ae41..1db2114bd5 100644 --- a/claude_desktop/config.yaml +++ b/claude_desktop/config.yaml @@ -71,5 +71,5 @@ slug: claude_desktop tmpfs: true udev: true url: https://github.com/alexbelgium/hassio-addons -version: "1.0" +version: "1.2" video: true diff --git a/claude_desktop/rootfs/etc/cont-init.d/20-folders.sh b/claude_desktop/rootfs/etc/cont-init.d/20-folders.sh index f07503ba9f..4eb5030c3e 100755 --- a/claude_desktop/rootfs/etc/cont-init.d/20-folders.sh +++ b/claude_desktop/rootfs/etc/cont-init.d/20-folders.sh @@ -28,6 +28,17 @@ fi bashio::log.info "Setting data location to $LOCATION" +# LinuxServer Selkies services expect the s6 envdir at /run/s6/container_environment. +# Home Assistant add-on startup can run without s6-overlay PID1, so create the envdir +# ourselves before those services start and before scripts write required variables. +S6_ENVDIR="/run/s6/container_environment" +mkdir -p "$S6_ENVDIR" +chmod 755 /run/s6 "$S6_ENVDIR" + +XDG_RUNTIME_DIR="/run/user/$PUID" +mkdir -p "$XDG_RUNTIME_DIR" +chmod 700 "$XDG_RUNTIME_DIR" + for file in /etc/s6-overlay/s6-rc.d/*/run; do if [ "$(sed -n '1{/bash/p};q' "$file")" ] && ! grep -q '^export XDG_CACHE_HOME=/tmp/cache$' "$file"; then sed -i "1a export HOME=$LOCATION" "$file" @@ -44,9 +55,10 @@ done sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd -if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi -if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi -if [ -d /var/run/s6/container_environment ]; then printf "%s" "/tmp/cache" > /var/run/s6/container_environment/XDG_CACHE_HOME; fi +printf "%s" "$LOCATION" > "$S6_ENVDIR/HOME" +printf "%s" "$LOCATION" > "$S6_ENVDIR/FM_HOME" +printf "%s" "/tmp/cache" > "$S6_ENVDIR/XDG_CACHE_HOME" +printf "%s" "$XDG_RUNTIME_DIR" > "$S6_ENVDIR/XDG_RUNTIME_DIR" grep -qxF "export HOME=\"$LOCATION\"" ~/.bashrc 2>/dev/null || { printf "%s\n" "export HOME=\"$LOCATION\"" printf "%s\n" "export FM_HOME=\"$LOCATION\"" @@ -54,8 +66,9 @@ grep -qxF "export HOME=\"$LOCATION\"" ~/.bashrc 2>/dev/null || { } >> ~/.bashrc bashio::log.info "Creating $LOCATION" -mkdir -p "$LOCATION" /tmp/cache +mkdir -p "$LOCATION" /tmp/cache "$XDG_RUNTIME_DIR" chmod 755 /tmp/cache +chmod 700 "$XDG_RUNTIME_DIR" if [ -e "$LOCATION/.cache" ] && [ ! -L "$LOCATION/.cache" ]; then rm -rf "$LOCATION/.cache" @@ -63,5 +76,5 @@ fi ln -sfn /tmp/cache "$LOCATION/.cache" bashio::log.info "Setting ownership to $PUID:$PGID" -chown -R "$PUID":"$PGID" "$LOCATION" /tmp/cache +chown -R "$PUID":"$PGID" "$LOCATION" /tmp/cache "$XDG_RUNTIME_DIR" chmod -R 700 "$LOCATION"