This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Project Talk:AMD64/32-bit Chroot Guide

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
Note
This is a talk page. Please add newer comments below older ones, and sign your comments using four tildes (~~~~). When adding a new section (at the bottom of the page), please mark it as "open for discussion" by using {{talk|open}} so it will show up in the list of open discussions.

Init script update

Talk status
This discussion is done.

Just set up my own 32 bit chroot using this guide. Many thanks to Luis Medinas!

I replaced the original OpenRC script with a version containing a little less boilerplate. Additionally, I removed the lines having to do with the deprecated usbfs filesystem:

FILE /etc/init.d/gentoo32Creating a 32-bit chroot switcher
#!/sbin/openrc-run

chroot_dir=/mnt/gentoo32

depend() {
   need localmount
   need bootmisc
}

start() {
    ebegin "Mounting 32-bit chroot directories"
    mount -o bind /dev ${chroot_dir}/dev >/dev/null
    mount -o bind /dev/pts ${chroot_dir}/dev/pts >/dev/null &
    mount -o bind /dev/shm ${chroot_dir}/dev/shm >/dev/null &
    mount -o bind /proc ${chroot_dir}/proc >/dev/null
    mount -o bind /sys ${chroot_dir}/sys >/dev/null &
    mount -o bind /tmp ${chroot_dir}/tmp >/dev/null &
    mount -o bind /usr/portage ${chroot_dir}/usr/portage/ >/dev/null &
    eend $? "An error occured while attempting to mount 32bit chroot directories"
    ebegin "Copying 32bit chroot files"
    cp -pf /etc/resolv.conf ${chroot_dir}/etc >/dev/null &
    cp -pf /etc/passwd ${chroot_dir}/etc >/dev/null &
    cp -pf /etc/shadow ${chroot_dir}/etc >/dev/null &
    cp -pf /etc/group ${chroot_dir}/etc >/dev/null &
    cp -pf /etc/gshadow ${chroot_dir}/etc >/dev/null &
    cp -pf /etc/hosts ${chroot_dir}/etc > /dev/null &
    cp -Ppf /etc/localtime ${chroot_dir}/etc >/dev/null &
    eend $? "An error occured while attempting to copy 32 bits chroot files."
}

stop() {
    ebegin "Unmounting 32-bit chroot directories"
    umount -f ${chroot_dir}/dev/pts >/dev/null
    umount -f ${chroot_dir}/dev/shm >/dev/null
    umount -f ${chroot_dir}/dev >/dev/null &
    umount -f ${chroot_dir}/proc >/dev/null &
    umount -f ${chroot_dir}/sys >/dev/null &
    umount -f ${chroot_dir}/tmp >/dev/null &
    umount -f ${chroot_dir}/usr/portage/ >/dev/null &
    eend $? "An error occured while attempting to unmount 32bit chroot directories"
}

I think it would be nice to change the script in the article as well. — The preceding unsigned comment was added by Iriomotejin (talkcontribs) 21:54, September 8, 2016‎

I updated the script and made a few other changes including the point of this change. --Grknight (talk) 00:41, 8 November 2018 (UTC)