How to create a bootable system with a squashfs root

Posted by cldfzn on Ask Ubuntu See other posts from Ask Ubuntu or by cldfzn
Published on 2012-01-14T14:13:57Z Indexed on 2012/04/15 23:46 UTC
Read the original article Hit count: 195

Filed under:
|
|
|
|

My goal is to be able to take a customized root file system loaded with the software I want. So far I've created a squashed filesystem using debootstrap and chroot to install the software I want on the system.

The problem I am now running in to.. whenever I boot in to the system, my user accounts that were set up in the chroot do not work. First boot everything works out, second boot I can't log in. That is baffling to me.

Any one know a reason or a place to start looking?

Update

To get a working system with a squashfs filesystem:

sudo apt-get install live-boot live-boot-initramfs-tools extlinux
sudo update-initramfs -u

Create a squashfs file from a bootstrapped or running ubuntu filesystem with whatever packages you want available. https://help.ubuntu.com/community/LiveCDCustomizationFromScratch provides good instructions for creating a debootstrapped system to build on. Format the target drive with ext2/3/4 and enable the bootable flag. Create the folder layout on the target drive and install extlinux:

mkdir -p ${TARGET}/boot/extlinux ${TARGET}/live
extlinux -i ${TARGET}/boot/extlinux
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdX #X is the drive letter
cp /boot/vmlinuz-$(uname -r) ${TARGET}/boot/vmlinuz
cp /boot/initrd.img-$(uname -r) ${TARGET}/boot/initrd
cp filesystem.squashfs ${TARGET}/live

Create ${TARGET}/boot/extlinux/extlinux.conf with the following contents:

DEFAULT Live
LABEL Live
  KERNEL /boot/vmlinuz
  APPEND initrd=/boot/initrd boot=live toram=filesystem.squashfs
TIMEOUT 10
PROMPT 0

Now you should be able to boot from the target drive in to your squashed system.

© Ask Ubuntu or respective owner

Related posts about boot

Related posts about grub2