#1065054 pbuilder: Allow manual umount'ing after login

#1065054#5
Date:
2024-02-29 09:11:00 UTC
From:
To:
Hi

When using cowbuilder --login with a bindmount, I occasionally hit a
problem where umounting fails on exiting from the chroot.

Here, pbuilder/cowbuilder as a precaution aborts the exit and forces you
to solve the problem to avoid trashing your files. This is great.

In my case, I cannot always figure out why the mount point refuses to
unmount but a lazy unmount (umount -l) gets the job done enough that my
files are no longer in danger.  Doing that causes pbuilder to still fail
on exit now with:

umount: /var/cache/pbuilder/build/cow.XXX/path/to/mp: not mounted.

And then throws me back into the chroot. So, to "unstuck" this, I end up
having first to umount the mountpoint manually and then manually remount
something else at that mountpoint, so pbuilder/cowbuilder get continue.

I think it would be nice if pbuilder could test if the mountpoint is
still a mountpoint.  Since `mountpoint` is in `util-linux` (Essential:
yes), this could be done with:


   IS_MOUNTED=true
   mountpoint -q "$MP" || RC=$?
   if [ "${RC}" = "32" ]; then
       IS_MOUNTED=false
   fi


For safety, I would recommend always doing umount, if that fails but
mountpoint says the path is not a mountpoint, then it can progress.

Best regards,
Niels

#1065054#10
Date:
2024-02-29 17:21:39 UTC
From:
To:
Niels Thykier dixit:

There’s also the option of getting a fresh view of the sub-mounts
from /proc/mounts; see e.g. the debchroot_umtree code in
https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=shellsnippets/shellsnippets.git;a=blob;f=posix/sysadmin/debchroot.sh;hb=HEAD
which umounts everything under a given directory (in reverse order)
and is even POSIX sh. I’m in the position to dual-licence that if
needed.

bye,
//mirabilos

#1065054#15
Date:
2026-01-10 10:10:41 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.