Restart gvfs after wake to restore FUSE mount

gvfsd-fuse is spawned by gvfsd during init and not respawned if it
dies. After lazy-unmounting in pre-sleep, restart gvfs-daemon.service
in post-sleep so the FUSE mount at /run/user/*/gvfs is restored.
This commit is contained in:
Alan Sikora
2026-03-08 20:58:56 -03:00
parent 505c15e624
commit 24ca8e2bff
+13 -1
View File
@@ -3,7 +3,7 @@
# Lazy-unmount all FUSE filesystems before suspend/hibernate to prevent the
# kernel's process freeze from timing out. FUSE daemons (like gvfsd-fuse from
# Nautilus) can block in uninterruptible sleep during freeze, causing suspend
# to silently fail. The FUSE daemons restart automatically on wake.
# to silently fail. After wake, restart gvfs so the FUSE mount is restored.
if [[ $1 == "pre" ]]; then
while IFS=' ' read -r _ mountpoint fstype _; do
@@ -12,3 +12,15 @@ if [[ $1 == "pre" ]]; then
fi
done < /proc/mounts
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
fi