Preparing to Boot KaarPux

After bootstrapping KaarPux as described in Bootstrapping KaarPux, now prepare KaarPux for booting.

GRUB setup

If you want the target system boot to be controlled by KaarPux you must set up GRUB.

Enter the chroot:

cd ${MNT}/home/kaarpux/kaarpux

Now install GRUB on the target disk.


Be very careful here. If you specify the wrong partition, you may brick the host system.

If you are using legacy MBR partitioning:

DEV=/dev/sdb   # replace with the device name of your target disk

grub-install ${DEV}

If you are using GPT partitioning:


grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=kaarpux --boot-directory=/boot/efi/EFI/kaarpux/ --recheck

Finally, create the GRUB configuration, and verify that it is OK.

You may also edit the configuration file, but it will be overwritten next time grub-mkconfig is run.:

grub-mkconfig -o ${CFG}
cp ${CFG} ${CFG}.ORIG
vi ${CFG}

If you have an UEFI system, you need to register the new bootloader:

FDEV=/dev/sdb   # replace with the device name of your target disk
FPART=1      # replace with the partition number on your target disk

efibootmgr --create --gpt --disk ${FDEV} --part ${FPART} --write-signature --label "KaarPux" --loader "\\\\EFI\\\\kaarpux\\\\grubx86.efi"

Exit the chroot:


Final preparations

Enter the chroot:

cd ${MNT}/home/kaarpux/kaarpux

Setup passwords:

passwd root
passwd kaarpux

Change ownership:

chown -R kaarpux:kaarpux /home/kaarpux

Clean out /tmp:

rm -rf /tmp/*

Optionally, if you are short on diskspace:

rm -rf /home/kaarpux/kaarpux/bootstrap/build

or even:

rm -rf /home/kaarpux/kaarpux/bootstrap

Exit the chroot:


Unmount virtual file systems:

cd /
umount ${MNT}

Create a snapshot

If you want a “snapshot” of the system, create a tarball as described in Create a KaarPux tarball.

Make sure $MNT is mounted, but that the virtual file systems are not mounted. Use settings similar to the following:


Boot into the new system

That’s it! You should now be able to boot into the new system!

When you reboot, you should have a system which obtains it’s IP-address by DHCP, is protected by by iptables, and which allows remote login with ssh, as well as console login.