注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Frankenchroot/Live NFS Frankenchroot"

From Funtoo
Jump to navigation Jump to search
(Created page with "===''Exporting Your Remote Mounts with NFS''=== * On your target system we must setup our directories to be network exported to the host system. {{file|name=/etc/exports|de...")
 
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
{{file|name=/etc/exports|desc=NFS file systems being exported|body=
{{file|name=/etc/exports|desc=NFS file systems being exported|body=
# /etc/exports: NFS file systems being exported.  See exports(5).
# /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)
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)
/boot/  
/dev/ 192.168.0.0/24(insecure,no_root_squash,nohide,rw,sync,no_subtree_check,fsid=77)
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''===
===''Mounting Your NFS Exports Locally and Binding Pseudo Filesystems''===


* We must then mount our exported directories on our host system and bind mount our psuedo filesystems.
* We must then mount our exported directories on our host system and bind mount our pseudo filesystems.


{{console|body=
{{console|body=
Line 45: Line 42:
QEMU_USER_TARGETS="aarch64 arm"
QEMU_USER_TARGETS="aarch64 arm"
FEATURES="-sandbox -ipc-sandbox -usersandbox candy"
FEATURES="-sandbox -ipc-sandbox -usersandbox candy"
}}
==''Chrooting and Letting the Magic Happen''==
===Entering Franken Chroot===
{{console|body=
###i## mv -v /mnt/piroot/etc/resolv.conf{,.orig}
###i## cp -v -L /etc/resolv.conf /mnt/piroot/etc/
###i## env -i HOME=/root TERM=$TERM /bin/chroot /mnt/piroot /bin/bash -l
###i## export PS1="(Franken_Chroot) $PS1"
}}
===Exiting Franken Chroot and Final Thoughts===
{{console|body=
###i## rm /etc/resolv.conf
###i## mv -v /etc/resolv.conf{.orig,}
###i## exit
###i## umount -v /mnt/piroot/var/tmp/portage
###i## umount -lR /mnt/piroot
###i## sync
}}
}}

Latest revision as of 21:52, February 24, 2019

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