[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Updates to ash and busybox



> > I've been using this trick from more than one year and it works very well.
> > I have also illustrated the chroot solution in my proposal of Jul 10 1999
> > to this list about the debian automatic installation, but apparently nobody
> > noticed it.
> 
> chroot works differently and has noticeable effects on the chroot
> running system:
> 
> Just an example:
> 
> $ mount root.bin.ungziped /floppy -oloop
> $ chroot /floppy /bn/ash
> $ mount -t proc proc /mnt
> $ cat /mnt/mounts
> 
> /dev/root / ext2 rw 0 0
> proc /proc proc rw 0 0
> devpts /dev/pts devpts rw 0 0
> /dev/hda8 /var ext2 rw 0 0
> /dev/hda9 /home ext2 rw 0 0
> /dev/hda10 /usr ext2 rw 0 0
> /dev/hda11 /usr/local ext2 rw 0 0
> /dev/loop0 /floppy/ ext2 rw 0 0
> proc /mnt proc rw 0 0
> 
> Huh? Where do they all come from? Lets unmount those during shutdown.
> You will have a nice time when /etc/mtab links to /proc/mounts and in
> the reverse if it doesn´t you also will have a nice time.
> 
> Also in another xterm (outside the chroot) at the same time:
> 
> # cat /proc/mounts
> 
> /dev/root / ext2 rw 0 0
> proc /proc proc rw 0 0
> devpts /dev/pts devpts rw 0 0
> /dev/hda8 /var ext2 rw 0 0
> /dev/hda9 /home ext2 rw 0 0
> /dev/hda10 /usr ext2 rw 0 0
> /dev/hda11 /usr/local ext2 rw 0 0
> /dev/loop0 /floppy/ ext2 rw 0 0
> proc /mnt proc rw 0 0
> 
> So if anything in the chroot mounts something and forgets to unmount
> it you have big trouble coming along.
> Maybe the proc fs should be chroot aware.
> 
> Also last time I run the bootdisks in a chroot I think they didn´t
> work but I have to test that with a working current version and maybe
> write fixes so it runs in chroot.
> 
> May the Source be with you.
> 			Goswin

The trick is to unmount everything except / and /target and then remount
/proc and all the mounts previously configured in the new fstab from inside
the chroot. This seems to work well, in the sense that you can install the
rest of the system and run the various applications as they were run from a
real root. The only program which notices some difference is squid.

Note also that you don't want to exit from the chroot after you have mounted
other filesystems on it and started a lot of standard services. The only way
to get out of it should be a real reboot. The jump into the target chroot is
one-way and you shouldn't be allowed to go back. So the chroot can't be used
for testing inside a running system but only for a real debian installation.
This is one of the reasons why I dropped the dinstall, written in C, and made
a new installer in zsh. Much easier to write and it can be debugged from a
ramdisk.

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


Reply to: