Subject: compile with chroot and union mounts = 1.6ZG kernel panic?
To: None <netbsd-users@netbsd.org>
From: Malcolm Herbert <mjch@mjch.net>
List: netbsd-users
Date: 06/09/2005 17:34:36
I am wanting to build packages and NetBSD distribution sets inside a
chroot environment so that I don't clobber anything important on my
main system however I seem to be fairly reliably hitting a bug somewhere
which is causing my system to panic ... this is under 1.6ZG, which I'm
trying to move away from and get something more current.

OK, have unpacked a basic 1.6ZG environment into /chroot/base-1.6ZG, ran
mtree -eUf etc/mtree/NetBSD.dist and sh MAKEDEV std inside it then 
grabbed -current using CVS and put it in /chroot/compile-current/usr/src.

I then do a union mount such that the content of base-1.6ZG is visible
'under' the content of compile-current and then chroot into /chroot/compile-current.
(using mount_union -b /chroot/base-1.6ZG /chroot/compile-current)

So far so good - I can look around the filesystem and things seem to be
there, however as soon as I want to run build.sh I get errors complaining
about /dev/null permission denied and that my /bin/sh is too old ... 

On looking closer it seems that the union mount hasn't brought through
file permissions properly which is odd, so exit the chroot and then
run mtree and MAKEDEV over /chroot/compile-current (which I wouldn't 
have thought I would have needed to do) ... then hop into the chroot
environment again, run build.sh (without options, just seeing whether
it starts) and immediately get a panic:

login: panic: lockmgr: locking against myself
Stopped in pid 18480.1 (sh) at  netbsd:cpu_Debugger+0x4:        leave
db> reboot
syncing disks... 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 giving up
rebooting...

Previously I'd tried to use cvs to do an update from within the chroot
environment and got essentially the same panic, although the process it
complained about was ssh rather than sh ... 

... does anyone have any idea what I could be doing wrong?  I've had 
this problem with union mounts and chroot for a while and it would
be really nice to be able to do it this way and save disk space ... if
it's really impossible I guess I could just do without the union mount
but that would be giving up ... :)

-- 
Malcolm Herbert                                    System Administrator
ph [990] 54881 rm 28-241                          School of GeoSciences