Frankenchroot/Live NFS Frankenchroot

From Funtoo
Jump to navigation Jump to search

Exporting Your Remote Mounts with NFS

  • On your target system we must setup our directories to be network exported to the host system.
   /etc/exports - NFS file systems being exported
# /etc/exports: NFS file systems being exported.  See exports(5).
/      192.168.0.0/24(insecure,no_root_squash,nohide,rw,sync,no_subtree_check)
/boot/ 192.168.0.0/24(insecure,no_root_squash,nohide,rw,sync,no_subtree_check)
/dev/  192.168.0.0/24(insecure,no_root_squash,nohide,rw,sync,no_subtree_check,fsid=77)

Mounting Your NFS Exports Locally and Binding Pseudo Filesystems

  • We must then mount our exported directories on our host system and bind mount our pseudo filesystems.
root # mount foo.local:/ /mnt/piroot
root # mount -t proc /proc /mnt/piroot/proc
root # mount --rbind /sys /mnt/piroot/{sys,dev} 
root # mount --make-rslave /mnt/piroot/{sys,dev} 
root # mount -t devpts none /mnt/piroot/dev/pts
   Note

You can safely ignore setting up NFS exports and mount the target filesystem locally with an sdcard reader if you desire. Mounting over NFS just makes for a more versatile setup without the need to transfer sdcards.

   Tip

(For Better Performance!) mount a tmpfs on top of /mnt/piroot/var/tmp/portage

root # mount -v -t tmpfs -o size=8G,mode=775,uid=portage,gid=portage,nr_inodes=0 tmpfs /mnt/piroot/var/tmp/portage


Local Configuration

Editing make.conf

  • First, add the following to /etc/portage/make.conf on the host system :
   /etc/portage/make.conf - Portage make.conf file
QEMU_USER_TARGETS="aarch64 arm"
FEATURES="-sandbox -ipc-sandbox -usersandbox candy"

Chrooting and Letting the Magic Happen

Entering Franken Chroot

root # mv -v /mnt/piroot/etc/resolv.conf{,.orig}
root # cp -v -L /etc/resolv.conf /mnt/piroot/etc/
root # env -i HOME=/root TERM=$TERM /bin/chroot /mnt/piroot /bin/bash -l
root # export PS1="(Franken_Chroot) $PS1"

Exiting Franken Chroot and Final Thoughts

root # rm /etc/resolv.conf
root # mv -v /etc/resolv.conf{.orig,}
root # exit
root # umount -v /mnt/piroot/var/tmp/portage
root # umount -lR /mnt/piroot
root # sync