Hello,

On Tue, 23 Jun 2015, Alan McKinnon wrote:
>On 23/06/2015 09:27, Ran Shalit wrote:
>> I am a beginner with Gentoo.
>> I have followed the instruction for the installation, and tried to see
>> that I really  understand all of them.
>> There is the command:
>> mount -o bind /dev /mnt/gentoo/dev
>> Which I'm not sure I really understand.
[..]
>> 2. Another thing I've noticed is that some tutorial add to the above
>> also bind to sys folder , and other do not include it.
>> mount -o bind /sys /mnt/gentoo/sys
>
>The handbook says to do it, and it makes sense to do it.
>
>Any tutorial that doesn't say it, is wrong/outdated or it's author
>doesn't understand.
>
>If the official handbook says to do it, and some other post from Joe
>Random Blogger says not to, which one you gonna believe?
>
>> Therefore I would like to ask if it is really required ?
>
>Yes

ACK. There's more actually. Currently, I run Gentoo mostly in a chroot
from my old system[1], and also updated it that way[2]. Currently, I
use this script to chroot into gentoo:

==== /root/bin/chrooter ====
#!/bin/bash
root="$1"
shift

### those test -e check for files/subdirs to not bind-remount if I
### chroot in more than one xterm, /dev/shm/dh is just a subdir I
### create via a custom boot-script on the old system, you'll have to
### revert to grepping /proc/mounts for ${root}/dev/shm if your
### /dev/shm is empty, and mind you: I use /Gentoo as "$root", but it
### appears as /root_ssd2 in /proc/mounts!
test -e ${root}/proc/kcore || mount --bind /proc/ ${root}/proc
test -e ${root}/sys/block  || mount --bind /sys/ ${root}/sys
test -e ${root}/dev/zero   || mount --bind /dev/ ${root}/dev
test -e ${root}/dev/shm/dh || mount --bind /dev/shm ${root}/dev/shm
test -e ${root}/dev/pts/0  || mount --bind /dev/pts/ ${root}/dev/pts

### convenient way to mount further stuff outside the chroot (with the
### appropriate fstab entries). Ran, you should just ignore these lines
for d in "$@"; do
    grep -q "$d" /proc/mounts || mount "$d"
done

### adjust the environment (old system still uses iso8859-15)
export LANG="en_US.utf8"
unset LC_CTYPE

### finally do the chroot
cd "$root"
chroot "$root"
====

So, basically, I bind-mount the usual /proc, /sys, /dev plus /dev/shm
and /dev/pts.

IIRC compiling some stuff barfed when /dev/shm was not available
(icedtea?) and /dev/pts gives proper terminals (cf. output of 'tty').

HTH & have fun,
-dnh

[1] have not migrated/tested my much used programs under gentoo yet
    and too much to do, but most stuff runs from the chroot (even X
    stuff once I copied my ~/.Xauthority :)

[2] from a 2010 install not touched since then! Had to use the
    unpacked stage3 a couple of times setting PATH/LD_LIBRARY_PATH
    to the stage3 directory (due to emerge/glibc stuff), I definitely
    do _NOT_ recommend this ;) Was fun though and I learned a lot
    about the inner workings of emerge/gentoo :)

-- 
No, it's a small country on the South American Ivory Coast, just to
the left of the Caucasus, with penguin wool and yucca meat as primary
exports.          -- H. Ekker on the question if Austria is in Europe

Reply via email to