Exit Chromium unmounts all NTFS mounted partitions
Forum member Miminou reported this:
https://forum.puppylinux.com/viewtopic.php?p=172836#p172836
...I posted a quote from Google AI, reproduced here:
This issue is primarily caused by xdg-document-portal (a sub-service of xdg-desktop-portal), which uses FUSE to expose files to sandboxed apps. It is known to aggressively lock files or mismanage its internal FUSE mounts (/run/user/$UID/doc), which can result in recursive hangs or force-unmounting of other active FUSE filesystems.
But no, it turns out that the cause of the problem is the 'umount' script in EasyOS. The Debian 'mount' package has 'mount' and 'umount' executables; however, woofQ2 renames those as 'mount-FULL' and 'umount-FULL', replacing 'mount' and 'umount' as scripts.
I tested, mounted a ntfs partition, then ran Chromium. Running 'mount' with no parameters in a terminal reported these mounted:
/dev/nvme1n1p2 on /mnt/nvme1n1p2 type fuseblk (ro,relatime,user_id=0,group_id=0,default_permissions,blksize=4096)
portal on /home/chromium/.cache/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=25397,group_id=25397)
I inserted an echo into the 'umount' script to report passed parameters, and when I exited Chromium, got these two calls to 'umount':
--no-canonicalize -i --fake /home/firefox/.cache/doc
--no-canonicalize -i --fake /mnt/nvme1n1p2
The important thing to note here, 'umount' is being called with "--fake", which means dry-run only. The xdg-desktop-portal (or whatever) code does the actual unmount in a direct C call to "umount()" function and these calls to the 'umount' script are informational only.
But there is only a direct call to unmount "/home/firefox/.cache/doc", not "/mnt/nvme1n1p2", which makes that second informational call to the 'umount' script very puzzling.
Anyway, I found the problem; the 'umount' script was ignoring the
"--fake" parameter and was unmounting both fuse mounted folders.
The /usr/bin/umount script is a bit long in the tooth, so as well as recognizing "--fake", took the opportunity to completely rewrite the script:
#!/bin/ash
#Copyright Barry Kauler 2026, licence GPL3 (/usr/share/doc/legal)
#20260624 rewritten
#mount-FULL, umount-FULL are the full versions.
#The Busybox versions of mount and umount are available but only by:
# # busybox mount ...
# # busybox umount ...
#mount and umount are scripts.
#if an ntfs partition, EasyOS uses fuse ntfs-3g driver.
[ ! $1 ] && exec busybox umount
. /etc/rc.d/functions4puppy4
. /etc/uimanager #has UI_DESK_MANAGER='jwm' #or rox
. /etc/rc.d/PUPSTATE
MNT0="$(cut -f 1 -d ' ' /proc/mounts | grep '^/dev/[nsmf]')" #ex: /dev/nvme1n1p2
[ -z "$MNT0" ] && exec busybox umount ${*} #precaution
MOUNTSpre="$(echo -n "$MNT0" | sed 's%^/dev/%%')"
#note, xdg-desktop-portal may mount like this:
# portal /home/chromium/.cache/doc fuse.portal rw,nosuid,nodev,relatime,user_id=25397,group_id=25397 0 0
# umount passed params: --no-canonicalize -i --fake /home/chromium/.cache/doc
case "${*}" in
*--fake*) exit 0 ;;
esac
#this will also catch ntfs-3g fuse mounts...
RETVAL=0
Pend="${*#*/}"
Pend="${Pend/ */}"
if [ -n "$Pend" ];then
[ "${Pend##*/}" == "${WKG_DEV}" ] && exit 1 #cannot unmount
MNTdir="$(grep -F "/${Pend} " /proc/mounts | cut -f 2 -d ' ' | tail -n 1)"
grep -F "/${Pend} " /proc/mounts | grep -q 'fuse'
if [ $? -eq 0 ];then
fusermount -u $MNTdir
RETVAL=$?
else
#busybox umount -d $MNTdir
umount-FULL -d ${*}
[ $? -ne 0 ] && busybox umount -d $MNTdir
RETVAL=$?
fi
else
#maybe just ran "umount -a" to unmount everything
umount-FULL ${*}
RETVAL=$?
fi
#check any desktop partition icons showing as mounted, but now unmounted...
[ -z "$DISPLAY" ] && exit $RETVAL
for aDEV in ${MOUNTSpre}
do
[ -z "$aDEV" ] && continue
[ "$aDEV" == "$WKG_DEV" ] && continue #cannot unmount (already screened out above)
grep -qF "/dev/${aDEV} " /proc/mounts
if [ $? -ne 0 ];then
if [ -d /root/.pup_event/drive_${aDEV} ];then
case "$aDEV" in
fd*) DRV_CATEGORY="floppy" ;;
*)
aDRV="$(echo -n "${aDEV}" | sed -e 's%[0-9]$%%' -e 's%[0-9]$%%' -e 's%p$%%')"
DRV_CATEGORY="$(probedisk | grep -F "/dev/${aDRV}|" | cut -f 2 -d '|')"
;;
esac
[ -z "$DRV_CATEGORY" ] && DRV_CATEGORY='drive'
if [ "$UI_DESK_MANAGER" == "rox" ];then
#remove the close-box...
icon_unmounted_func $aDEV $DRV_CATEGORY #see functions4puppy4
else #jwm
/usr/local/ui/jwm/generate-drives-menu
jwm -reload
fi
fi
fi
done
#make sure the symlink stays there...
if [ ! -L /etc/mtab ];then
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
fi
exit $RETVAL
###end###
Probably should revise /usr/bin/mount also; that is also very
old.
Tags: easy