In summary: I think the root cause is that the lxc container is not
set up the way sbuild expects.

The named directory becomes $self->get('Location') within sbuild; it's
a dummy value used when (as in this case) the chroot provider does not
have a way to access the within-chroot filesystem from outside it.

It is used in relatively few places.  Searching for more of the error
message found a use in basesetup (in ChrootSetup.pm).  It seems to try
to use it only if the `sbuild' group is not found in the chroot.

Looking at the code, sbuild expects various other preparatory things
to have been done to the chroot.  It expects a /build directory, and
/var/lib/sbuild, and so on.  I can't find any of this documented
anywhere.

Hopefully the following, observed in an schroot of mine, is helpful:

$ id sbuild
uid=120(sbuild) gid=124(sbuild) groups=124(sbuild)
$ find /build/ /var/lib/sbuild/ -ls
   606209      4 drwxrws---   2 sbuild   sbuild       4096 Jun  3  2016 /build/
   344285      4 drwxrws---   3 sbuild   sbuild       4096 Jun  3  2016 
/var/lib/sbuild/
   344838      4 -rw-rw-r--   1 root     sbuild       1417 Jun  3  2016 
/var/lib/sbuild/package-checklist
   344355      4 drwxrws---   2 sbuild   sbuild       4096 Jun  3  2016 
/var/lib/sbuild/srcdep-lock
   344721      4 -rw-------   1 root     sbuild        117 Jun  3  2016 
/var/lib/sbuild/apt.conf
$ 

Is there a script that someone could run in an existing
vm/container/whatever, to prepare it appropriately, before
snapshotting ?

Also, the error message seems poor.

I suggest the following approach:

 * Break out the relevant bits of sbuild-createchroot into an
   advertised script that can be run as root within the master
   image (what schroot calls the source chroot).

 * Replace calls to ->get('Location') with ->get_location($reason)
   and make the latter fail if the access is not supported.
   $reason will be an explanation of what schroot was trying to do.
   So it will say something like
     E: filesystem access to chroot not supported (wanted because: trying to 
add sbuild group)

 * In the longer term, the virt servers should have a way to edit
   the master image.  Then you could say sbuild --setup-the-thing
   --autopkgtest-etc.

Thanks,
Ian.

-- 
Ian Jackson <ijack...@chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.

Reply via email to