From e490ca7d78279935197f77e2c9e10245e2268601 Mon Sep 17 00:00:00 2001 From: Alan Sikora Date: Sun, 8 Mar 2026 23:14:40 -0300 Subject: [PATCH] Background gvfs restart to avoid blocking user.slice thaw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The post-sleep hook runs before systemd thaws user.slice, so a synchronous systemctl --user restart hangs for ~90 seconds waiting for the frozen user manager to respond — blocking the entire resume. Background the restart with a short delay so it executes after user.slice is thawed. Co-Authored-By: Claude Opus 4.6 --- default/systemd/system-sleep/unmount-fuse | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/default/systemd/system-sleep/unmount-fuse b/default/systemd/system-sleep/unmount-fuse index c15fddf0..64444c1d 100755 --- a/default/systemd/system-sleep/unmount-fuse +++ b/default/systemd/system-sleep/unmount-fuse @@ -14,13 +14,18 @@ if [[ $1 == "pre" ]]; then fi if [[ $1 == "post" ]]; then - for uid_dir in /run/user/*; do - uid=$(basename "$uid_dir") - if [[ -S $uid_dir/bus ]]; then - sudo -u "#$uid" \ - DBUS_SESSION_BUS_ADDRESS="unix:path=$uid_dir/bus" \ - XDG_RUNTIME_DIR="$uid_dir" \ - systemctl --user restart gvfs-daemon.service 2>/dev/null || true - fi - done + # Run in background — user.slice is still frozen at this point, so a + # synchronous restart would block the thaw for up to 90 seconds. + ( + sleep 5 + for uid_dir in /run/user/*; do + uid=$(basename "$uid_dir") + if [[ -S $uid_dir/bus ]]; then + sudo -u "#$uid" \ + DBUS_SESSION_BUS_ADDRESS="unix:path=$uid_dir/bus" \ + XDG_RUNTIME_DIR="$uid_dir" \ + systemctl --user restart gvfs-daemon.service 2>/dev/null || true + fi + done + ) & fi