moving my chimera linux install
and setting up rEFInd and ZFSBootMenu with encrypted ZFS
i'm switching laptops and wanted to bring my chimera linux setup
normally i would just do a fresh install then rsync /home/ over,
but since ZFS supports syncing, i figured it would be fun to give that a shot
booted chimera linux off a liveusb... let's get started!
DISCLAIMER: take responsibility of your system! though, if something goes wrong, please reach out so that i can amend the steps ^^
setup
chimera linux docs for reference
live ISO images come with ZFS support
if you have a device-specifc ISO, you'll need to install ZFS. follow the steps in the "Preparation" section ^^
partitioning for rEFInd and ZFSBootMenu with encrypted ZFS
i'll be using rEFInd as my bootloader so no separate /boot partition for me
continue following the steps...
mkdir /media/root zpool create -o ashift=12 \ -O acltype=posixacl \ -O canmount=off \ -O dnodesize=auto \ -O relatime=on \ -O xattr=sa \ -O encryption=on -O keyformat=passphrase -O keylocation=prompt \ # add these -O mountpoint=/ \ -R /media/root \ rpool ${PARTITION}
now if you're doing a fresh install, you can continue with the zfs create stuff and proceed to installing chimera,
then when it asks you to setup GRUB you can come back and install rEFInd instead
as for you weirdos... don't create the volumes just yet! we're gonna sync them over :P
importing the chimera install
make a snapshot:
ssh root@"$REMOTE" zfs snapshot -r rpool@snap1
transfer it:
ssh root@"$REMOTE" zfs send -R rpool@snap1 | pv | zfs recv rpool
if you're on a LAN, you can avoid this ssh'ing around by using netcat:
# receiver
nc -l $PORT | pv | zfs recv rpool
# sender
zfs send rpool@snap1 | nc $RECEIVER_IP $PORT
might take a while so sit back and relax :P
once it's done, run zfs list to make sure that your volumes are as expected!
mounting
the mountpoint info got lost, so i had to set it again:
zfs set mountpoint=/ canmount=noauto rpool/root
zfs set mountpoint=/home rpool/home
now mount the volumes:
zfs mount rpool/root
zfs mount rpool/home
chroot in
check that everything's in order:
chimera-chroot /media/root
you should be able to su into your user, then cd and check that all your stuff is present
installing rEFInd
still in the chroot, but as root again:
apk add refind
if it succeeds, then that means chimera linux has packaged rEFInd, and you can skip ahead to setting it up
if not then we gotta borrow it from alpine repos
stealing rEFInd from alpine
alpine rEFInd depends on lsblk, but chimera doesn't have it because it's packaged under util-linux-mount instead...
virtual packages to the rescue!
apk add -t lsblk util-linux-mount
this tells apk to imagine a package called lsblk that depends on util-linux-mount, effectively acting as an alias!
on to the hacky part:
apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing --allow-untrusted refind
now we have the rEFInd package installed!
setting up rEFInd
mount the EFI partition:
mkdir -p /boot/efi
mount /dev/disk/by-label/ESP /boot/efi
run the install script:
refind-install
installing and setting up ZFSBootMenu
refer to their guide:
apk add --no-interactive curl mkdir -p /boot/efi/EFI/ZBM curl -o /boot/efi/EFI/ZBM/VMLINUZ.EFI -L https://get.zfsbootmenu.org/efi cp /boot/efi/EFI/ZBM/VMLINUZ.EFI /boot/efi/EFI/ZBM/VMLINUZ-BACKUP.EFI
now ZFSBootMenu should be installed in /boot/efi/EFI/ZBM
getting rEFInd to recognize ZFSBootMenu
thankfully they also have a guide for this
cat << EOF > /boot/efi/EFI/ZBM/refind_linux.conf "Boot default" "zbm.prefer=rpool ro quiet loglevel=0 zbm.skip" "Boot to menu" "zbm.prefer=rpool ro quiet loglevel=0 zbm.show" EOF
BONUS: keep passphrase in initramfs so you don't have to enter it twice
echo "${PASSPHRASE}" > /etc/zfs/rpool.key
zfs set keylocation=file:///etc/zfs/rpool.key rpool
that's all :)
reboot and enjoy your system ^^