For sake of clarity this is a schroot command issue related bug report,
all works fine with chroot ordinary command.
As you suggest I try the -M switch, once started schroot's session:
$ kubuntu

then open a new console and run these commands:
~# killall cupsd
~# service cups start

then come back to schroot's console and logout:
~$ logout
E: 10mount: rmdir: failed to remove
'/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c':
Device or resource busy
E: kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c: Chroot setup failed:
stage=setup-stop
$ fuser -M
/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c
Specified filename
/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c is
not a mountpoint.

fuser now tell me that it wasn't a mount point but it was indeed,
although actually not mounted anymore:
$ mount | grep
/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c
$

attempting to manually remove the directory it fails
# LC_ALL=C rmdir
/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c
rmdir: failed to remove
'/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c':
Device or resource busy

knowing that cupsd keeps busy the directory:
# killall cupsd

now removing the directory succeed:
# LC_ALL=C rmdir
/var/lib/schroot/mount/kubuntu-e1c05063-2aca-491c-b5e4-4a4e1c41c65c
#

A more interesting scenario, start a schroot session:
$ kubuntu

then open a new console and run these commands:
~# killall cupsd
~# service cups start

search for mount-point grepping the device name:
# mount | grep /dev/mapper/ld0-lv2
/dev/mapper/ld0-lv2 on
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85 type
ext4 (rw,relatime,stripe=256,data=ordered)

asking fuser which processes keeps busy the mount-point:
# fuser /var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85/
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85:  5681r
# fuser -m
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85/
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85:
5681rce
# fuser -M
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85/
/var/lib/schroot/mount/kubuntu-76da7862-ef1b-4b04-920b-459be3350e85:  5681r
# systemctl status cups
● cups.service - CUPS Printing Service
   Loaded: loaded (/lib/systemd/system/cups.service; enabled)
   Active: active (running) since gio 2016-04-28 21:59:50 CEST; 38s ago
     Docs: man:cupsd(8)
           man:cupsd.conf(5)
 Main PID: 5723 (cupsd)
   CGroup: /system.slice/cups.service
           └─5723 /usr/sbin/cupsd -f

fuser never report cupsd's PID(5723) the 5681 PID number reported refers
to bash:
# pstree -cpan | grep -B2 -A1 5681
  |   |-bash,1148 --rcfile ~/.bashrc_develop -i
  |   |   `-schroot,5608 -c kubuntu --
  |   |       `-bash,5681
  |   `-bash,1152 --rcfile ~/.bashrc_develop -i

HTH best regards

On 25/04/2016 at 04:26, Craig Small wrote:
> The problem is that fuser works off device numbers (it has to otherwise
> symlinks would confuse it) and there is nothing much that makes the
> chroots unique. A chroot is basically saying "start your tree here". My
> chroots for example sit under /var/chroot
> 
> Now, outside the chroot I can work out what process has that open with
> fuser /var/chroot/wheezy (note the lack of -m because these are not
> mount points).
> 
> Remember when you use the -m command you are saying the device ID where
> that file sits. It might be the actual mount point, or just a file (and
> fuser works out where that file sits).
> 
> If you really mean a mount point, then -M is a better idea.
> I don't really understand your setup because you have other mounts
> coming into your chroot. I think your tests are doing simple text
> matching which causes a bunch of failed misses but need to be sure.
> 
> /proc/<pid>/mountinfo isn't the fix, because just like /proc/<pid>/fd it
> can be fooled by symlinks.
> 
>  - Craig
> -- 
> Craig Small (@smallsees)   http://enc.com.au/       csmall at :
> enc.com.au <http://enc.com.au>
> Debian GNU/Linux           http://www.debian.org/   csmall at :
> debian.org <http://debian.org>
> GPG fingerprint:        5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5

-- 
Franco Martelli

Reply via email to