From a3839551e382e8d62c2be96e5481d2f7e88230ce Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 9 Mar 2026 15:28:20 +0100 Subject: [PATCH] Restrict FUSE unmount to gvfsd-fuse Unmounting all FUSE filesystems breaks xdg-document-portal and AppImages that rely on FUSE to stay mounted. It also doesn't restart them. --- bin/omarchy-hibernation-setup | 2 +- default/systemd/system-sleep/unmount-fuse | 6 +++--- migrations/1773012889.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/omarchy-hibernation-setup b/bin/omarchy-hibernation-setup index 4714bbce..0eba2487 100755 --- a/bin/omarchy-hibernation-setup +++ b/bin/omarchy-hibernation-setup @@ -66,7 +66,7 @@ echo "HOOKS+=(resume)" | sudo tee "$MKINITCPIO_CONF" >/dev/null # Ensure keyboard backlight doesn't prevent sleep sudo cp -p "$OMARCHY_PATH/default/systemd/system-sleep/keyboard-backlight" /usr/lib/systemd/system-sleep/ -# Ensure FUSE mounts don't prevent sleep +# Ensure gvfsd-fuse mounts don't prevent sleep sudo install -m 0755 -o root -g root "$OMARCHY_PATH/default/systemd/system-sleep/unmount-fuse" /usr/lib/systemd/system-sleep/ # Add resume= kernel parameters so the initramfs resume hook knows where to find the diff --git a/default/systemd/system-sleep/unmount-fuse b/default/systemd/system-sleep/unmount-fuse index 125f4cc8..54a4206d 100755 --- a/default/systemd/system-sleep/unmount-fuse +++ b/default/systemd/system-sleep/unmount-fuse @@ -1,13 +1,13 @@ #!/bin/bash -# Lazy-unmount all FUSE filesystems before suspend/hibernate to prevent the +# Lazy-unmount gvfsd-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. After wake, restart gvfs so the FUSE mount is restored. if [[ $1 == "pre" ]]; then while IFS=' ' read -r _ mountpoint fstype _; do - if [[ $fstype == fuse.* ]]; then + if [[ $fstype == fuse.gvfsd-fuse ]]; then mountpoint=$(printf '%b' "$mountpoint") fusermount3 -uz "$mountpoint" 2>/dev/null || fusermount -uz "$mountpoint" 2>/dev/null || true fi @@ -22,7 +22,7 @@ if [[ $1 == "post" ]]; then for uid_dir in /run/user/*; do uid=$(basename "$uid_dir") if [[ -S $uid_dir/bus ]]; then - sudo -u "#$uid" \ + sudo -u "#$uid" env \ DBUS_SESSION_BUS_ADDRESS="unix:path=$uid_dir/bus" \ XDG_RUNTIME_DIR="$uid_dir" \ systemctl --user restart gvfs-daemon.service 2>/dev/null || true diff --git a/migrations/1773012889.sh b/migrations/1773012889.sh index 585df7e0..d8dd1619 100644 --- a/migrations/1773012889.sh +++ b/migrations/1773012889.sh @@ -1,4 +1,4 @@ -echo "Install system-sleep hook to unmount FUSE before suspend/hibernate" +echo "Install system-sleep hook to unmount gvfsd-fuse before suspend/hibernate" sudo mkdir -p /usr/lib/systemd/system-sleep sudo install -m 0755 -o root -g root "$OMARCHY_PATH/default/systemd/system-sleep/unmount-fuse" /usr/lib/systemd/system-sleep/