Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Additional tips regarding the 32-bit Chroot Guide for AMD64
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
GetCool
Guru
Guru


Joined: 23 Nov 2003
Posts: 324
Location: Madison, Wisconsin

PostPosted: Fri Jan 27, 2006 11:24 am    Post subject: Additional tips regarding the 32-bit Chroot Guide for AMD64 Reply with quote

Following the official 32Bit Chroot Guide for Gentoo/AMD64, I had a couple of issues that required some minor workarounds. I am posting this here because it seems to be documentation-related.

(1) At the point in the guide where it tells to you perform an "emerge world" while inside of your chrooted environment:

Quote:
Now you have a new 32bits chroot system ready to be updated. Follow the next steps to update it.

Code Listing 9: Updating your new 32bits chroot
--------------------------------------------
Code:
# source /etc/profile
# env-update
# emerge -au world


You may get the following error:

Code:
These are the packages that I would merge, in order:

Calculating world dependencies / \!!! Cannot resolve a virtual package name to an ebuild.
!!! This is a bug, please report it. (virtual/libintl-0)


I fixed this problem by first updating portage, then emerging world (while inside the chroot environment, of course):

Code:
# emerge portage
# emerge -uD world



(2) The guide shows you how to add a script to your default runlevel which mounts all of the virtual filesystems like /proc and /dev to your /mnt/gentoo32 mount points. Below is the content of the script it gives you:

Code:
#!/sbin/runscript

depend() {
   need localmount
   need bootmisc
}

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

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


I ran into some problems running this script. After issuing a "/etc/init.d/gentoo32 start", I would receive errors that certain mount points did not exist. Similarly, after issuing a "/etc/init.d/gentoo32 stop", I would get additional errors about certain mount points being busy, and unable to be unmounted.

I found that I was experiencing these problems because each command in the script was suffixed with "&". This seemed to cause all of the mount and umount command to be run too quickly, and so, for example, /mnt/gentoo32/proc/bus/usb could not be mounted, since /mnt/gentoo32/proc had not yet been mounted successfully.

I fixed it by simply modifying the script accordingly:

Code:
#!/sbin/runscript

depend() {
   need localmount
   need bootmisc
}

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

stop() {
    ebegin "Unmounting 32bits chroot dirs"
    umount -f /mnt/gentoo32/dev/pts >/dev/null
    umount -f /mnt/gentoo32/dev/shm >/dev/null
    umount -f /mnt/gentoo32/dev >/dev/null
    umount -f /mnt/gentoo32/proc/bus/usb >/dev/null
    umount -f /mnt/gentoo32/proc >/dev/null
    umount -f /mnt/gentoo32/sys >/dev/null
    umount -f /mnt/gentoo32/tmp >/dev/null
    umount -f /mnt/gentoo32/usr/portage/ >/dev/null
    eend $? "An error occured while attempting to unmount 32bits chroot directories"
}


(3) Note: This one I haven't figured out yet, so if someone has an idea of what's going on, please let me know.

I also found that while using rxvt-unicode as my VT, after chrooting into my 32-bit environment and trying to perform tasks, I would often get the error:

Code:
WARNING: terminal is not fully functional


Using xterm instead of rxvt-unicode seems to fix this problem. Or, of course the console works too.
Back to top
View user's profile Send private message
tbranham
n00b
n00b


Joined: 20 Mar 2005
Posts: 1
Location: Washington, D.C.

PostPosted: Tue Jul 04, 2006 1:37 am    Post subject: In addition... Reply with quote

I also added a couple of extra mount points:
Code:

...
    mount -o bind /usr/src/linux /mnt/gentoo32/usr/src/linux/ >/dev/null
    mount -o bind /home /mnt/gentoo32/home/ >/dev/null
...
    umount -f /mnt/gentoo32/usr/src/linux/ >/dev/null
    umount -f /mnt/gentoo32/home/ >/dev/null

I couldn't compile mplayer (well, one of its depends anyway) without a link to the kernel sources, and most of my media files are in my home directory. That took care of it.
_________________
Go Vegan!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum