Ubuntu – How to boot from a debootstrap based install

bootchrootdebootstrap

I would like to boot a testing Ubuntu release from a directory (which contains a debootstrap based install).

As far as I understand I just need someway to tell the boot process (initrd scripts?) that it should chroot() into the specified dir immediately after mounting the root partition, and then resume the regular upstart/init start.

Could someone provide some instructions on how to achieve this?

Best Answer

You can boot a sub directory by replacing your sbin init with a script which uses pivot_root, the process is sketchy and various people have reported failure as much as sucesses. So try it and see, but keep a live cd handy in case your system becomes unbootable.

Details here: http://linux.die.net/man/8/pivot_root

What we could do with, is an automatic system for being able to boot multiple roots from the same drive. It should be programatically possible to do.