[Buildd-tools-devel] Bug#463343: Bug#463343: schroot: Does not end sessions automatically.

Roger Leigh rleigh at codelibre.net
Sat Mar 21 23:33:33 UTC 2009


On Sat, Mar 21, 2009 at 10:20:19PM +0100, Carlo Wood wrote:
> I currently have several schroot's mounted and no way
> to get rid of them.
> 
> I just rebooted even, but they persist...
> 
> hikaru:~>df -ha
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/md2              3.7G  846M  2.7G  24% /
> tmpfs                 2.0G     0  2.0G   0% /lib/init/rw
> proc                     0     0     0   -  /proc
> sysfs                    0     0     0   -  /sys
> procbususb               0     0     0   -  /proc/bus/usb
> udev                   10M  264K  9.8M   3% /dev
> tmpfs                 2.0G     0  2.0G   0% /dev/shm
> devpts                   0     0     0   -  /dev/pts
> /dev/md0               92M   78M  8.4M  91% /boot
> /dev/md5              9.2G  7.3G  1.5G  84% /home
> /dev/sdd2              37G   29G  5.9G  84% /opt
> /dev/sdd3             166G  136G   22G  87% /opt/large
> /dev/md8               21G  8.0G   12G  41% /opt2
> /dev/md3               19G  5.8G   12G  34% /usr
> /dev/md6              9.2G  3.4G  5.4G  39% /usr/local
> /dev/md7               55G   28G   26G  52% /usr/src
> /dev/md4              5.6G  1.1G  4.2G  21% /var
> /dev/mapper/encrypted
>                        92G   34G   54G  39% /encrypted
> tmpfs                  10G   32K   10G   1% /tmp
> tmpfs                 1.0G     0  1.0G   0% /var/tmp
> /home                 9.2G  7.3G  1.5G  84% /opt2/sid-386-chroot/home
> /tmp                   10G   32K   10G   1% /opt2/sid-386-chroot/tmp
> proc                     0     0     0   -  /opt2/sid-386-chroot/proc
> /encrypted             92G   34G   54G  39% /opt2/sid-386-chroot/encrypted
> /usr/share/cwautomacros
>                        19G  5.8G   12G  34% /opt2/sid-386-chroot/usr/share/cwautomacros
> /usr/src               55G   28G   26G  52% /opt2/sid-386-chroot/usr/src/64bit
> /dev/pts                 0     0     0   -  /opt2/sid-386-chroot/dev/pts
> /proc                    0     0     0   -  /opt2/mathematica-chroot/proc
> /dev                   10M  264K  9.8M   3% /opt2/mathematica-chroot/dev
> /tmp                   10G   32K   10G   1% /opt2/mathematica-chroot/tmp
> /home                 9.2G  7.3G  1.5G  84% /opt2/mathematica-chroot/home
> /usr/src               55G   28G   26G  52% /opt2/mathematica-chroot/usr/src
> rpc_pipefs               0     0     0   -  /var/lib/nfs/rpc_pipefs
> /opt2/sid-386-chroot   21G  8.0G   12G  41% /var/lib/schroot/mount/sid32-140f50cd-2ec9-414d-8bb1-1d4062f3684c
> /opt2/sid-386-chroot   21G  8.0G   12G  41% /var/lib/schroot/mount/sid32-62f84ac6-10fd-4de9-aaf7-84e3765bdd6d
> /opt2/sid-386-chroot   21G  8.0G   12G  41% /var/lib/schroot/mount/sid32-8ef60377-0f70-44ff-bc6d-926e1f69b94a
> /opt2/sid-386-chroot   21G  8.0G   12G  41% /var/lib/schroot/mount/sid32-fd57a1e1-6b4f-48c9-baa6-69a2dd6b79b6
> nfsd                     0     0     0   -  /proc/fs/nfsd
> binfmt_misc              0     0     0   -  /proc/sys/fs/binfmt_misc
> hikaru:~>ls -l /var/lib/schroot/mount/
> total 24
> drwxr-xr-x 21 root root 4096 2008-09-08 18:49 sid32-140f50cd-2ec9-414d-8bb1-1d4062f3684c/
> drwxr-xr-x  2 root root 4096 2008-01-31 02:51 sid32-1de0ea18-4f8f-4ab9-b6a9-bd4504a00138/
> drwxr-xr-x  2 root root 4096 2008-01-31 02:50 sid32-27f54204-9f76-499f-9aa5-7f6a608703c5/
> drwxr-xr-x 21 root root 4096 2008-09-08 18:49 sid32-62f84ac6-10fd-4de9-aaf7-84e3765bdd6d/
> drwxr-xr-x 21 root root 4096 2008-09-08 18:49 sid32-8ef60377-0f70-44ff-bc6d-926e1f69b94a/
> drwxr-xr-x 21 root root 4096 2008-09-08 18:49 sid32-fd57a1e1-6b4f-48c9-baa6-69a2dd6b79b6/
> hikaru:~>ls -l /var/lib/schroot/session
> total 16
> -rw-r--r-- 1 root carlo 596 2008-11-07 07:32 sid32-140f50cd-2ec9-414d-8bb1-1d4062f3684c
> -rw-r--r-- 1 root carlo 596 2008-08-24 03:12 sid32-62f84ac6-10fd-4de9-aaf7-84e3765bdd6d
> -rw-r--r-- 1 root carlo 596 2008-09-04 05:45 sid32-8ef60377-0f70-44ff-bc6d-926e1f69b94a
> -rw-r--r-- 1 root carlo 596 2008-08-31 20:10 sid32-fd57a1e1-6b4f-48c9-baa6-69a2dd6b79b6
> hikaru:~>schroot --end-session --all
> E: etch32-e1d58450-2d8c-407c-a882-d7486b226643: Failed to unlock chroot: /var/lib/schroot/session/etch32-e1d58450-2d8c-407c-a882-d7486b226643: Failed to unlink session file: No such file or directory
> 
> 
> Any idea how I can get rid of them?

A "session" is just a single configuration file under
/var/lib/schroot/session.  It's exactly the same format as you use in
schroot.conf.  In your case, it looks like you are using "plain" or
"directory" chroots.  They persist over a reboot because on startup
schroot runs with --all-sessions --recover which makes it remount
everything.  It always mounts everything under
/var/lib/schroot/mount/<session-id>.

Just umount the filesystems under /var/lib/schroot/mount, and then              delete the corresponding session files under /var/lib/schroot/session.
You can then rmdir the empty directories under /var/lib/schroot/mount           and they will all be gone for ever.

schroot --end-session --all-sessions /should/ end all the currently
active sessions.  It does little more than the steps I described in
the previous paragraph.  Do try --all-sessions rather than all; one
older version of schroot used the dynamic session-id with non-session
chroots when using --all, which broke session ending.  --all-sessions
makes sure it only ends sessions.

What's strange is this message:

E: etch32-e1d58450-2d8c-407c-a882-d7486b226643: Failed to unlock chroot: /var/
lib/schroot/session/etch32-e1d58450-2d8c-407c-a882-d7486b226643: Failed to unlink session file: No such file or directory

Does that file actually exist?  If there's a mismatch between the
session filename, and the chroot name actually /inside/ that file,
that could be potentially one reason for the failure.  But, that's
unlikely to happen unless it's physically edited by the user.

You can also try ending each in turn, like the init script does:
    for chroot in `schroot --all-sessions --list --quiet`
    do
      schroot --chroot=$chroot --end-session || true
      echo "$chroot"
    done

After you've done this, see which ones are left with
schroot --list --all-sessions
You might just find there's one dodgy one which was getting the
rest "stuck" (since it aborts on failure).


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20090321/a09d9fe4/attachment-0001.pgp 


More information about the Buildd-tools-devel mailing list