Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev
Date: Tue, 23 Jun 2015 14:46:40
Message-Id: 20150623143119.GA16098@grusum.endjinn.de
In Reply to: Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev by Alan McKinnon
1 Hello,
2
3 On Tue, 23 Jun 2015, Alan McKinnon wrote:
4 >On 23/06/2015 09:27, Ran Shalit wrote:
5 >> I am a beginner with Gentoo.
6 >> I have followed the instruction for the installation, and tried to see
7 >> that I really understand all of them.
8 >> There is the command:
9 >> mount -o bind /dev /mnt/gentoo/dev
10 >> Which I'm not sure I really understand.
11 [..]
12 >> 2. Another thing I've noticed is that some tutorial add to the above
13 >> also bind to sys folder , and other do not include it.
14 >> mount -o bind /sys /mnt/gentoo/sys
15 >
16 >The handbook says to do it, and it makes sense to do it.
17 >
18 >Any tutorial that doesn't say it, is wrong/outdated or it's author
19 >doesn't understand.
20 >
21 >If the official handbook says to do it, and some other post from Joe
22 >Random Blogger says not to, which one you gonna believe?
23 >
24 >> Therefore I would like to ask if it is really required ?
25 >
26 >Yes
27
28 ACK. There's more actually. Currently, I run Gentoo mostly in a chroot
29 from my old system[1], and also updated it that way[2]. Currently, I
30 use this script to chroot into gentoo:
31
32 ==== /root/bin/chrooter ====
33 #!/bin/bash
34 root="$1"
35 shift
36
37 ### those test -e check for files/subdirs to not bind-remount if I
38 ### chroot in more than one xterm, /dev/shm/dh is just a subdir I
39 ### create via a custom boot-script on the old system, you'll have to
40 ### revert to grepping /proc/mounts for ${root}/dev/shm if your
41 ### /dev/shm is empty, and mind you: I use /Gentoo as "$root", but it
42 ### appears as /root_ssd2 in /proc/mounts!
43 test -e ${root}/proc/kcore || mount --bind /proc/ ${root}/proc
44 test -e ${root}/sys/block || mount --bind /sys/ ${root}/sys
45 test -e ${root}/dev/zero || mount --bind /dev/ ${root}/dev
46 test -e ${root}/dev/shm/dh || mount --bind /dev/shm ${root}/dev/shm
47 test -e ${root}/dev/pts/0 || mount --bind /dev/pts/ ${root}/dev/pts
48
49 ### convenient way to mount further stuff outside the chroot (with the
50 ### appropriate fstab entries). Ran, you should just ignore these lines
51 for d in "$@"; do
52 grep -q "$d" /proc/mounts || mount "$d"
53 done
54
55 ### adjust the environment (old system still uses iso8859-15)
56 export LANG="en_US.utf8"
57 unset LC_CTYPE
58
59 ### finally do the chroot
60 cd "$root"
61 chroot "$root"
62 ====
63
64 So, basically, I bind-mount the usual /proc, /sys, /dev plus /dev/shm
65 and /dev/pts.
66
67 IIRC compiling some stuff barfed when /dev/shm was not available
68 (icedtea?) and /dev/pts gives proper terminals (cf. output of 'tty').
69
70 HTH & have fun,
71 -dnh
72
73 [1] have not migrated/tested my much used programs under gentoo yet
74 and too much to do, but most stuff runs from the chroot (even X
75 stuff once I copied my ~/.Xauthority :)
76
77 [2] from a 2010 install not touched since then! Had to use the
78 unpacked stage3 a couple of times setting PATH/LD_LIBRARY_PATH
79 to the stage3 directory (due to emerge/glibc stuff), I definitely
80 do _NOT_ recommend this ;) Was fun though and I learned a lot
81 about the inner workings of emerge/gentoo :)
82
83 --
84 No, it's a small country on the South American Ivory Coast, just to
85 the left of the Caucasus, with penguin wool and yucca meat as primary
86 exports. -- H. Ekker on the question if Austria is in Europe

Replies

Subject Author
Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev Christopher Jones <christopher.jones1216@×××××.com>
Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev Paul Tobias <tobias.pal@×××××.com>
Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev Rich Freeman <rich0@g.o>