Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] mount -o bind /dev /mnt/gentoo/dev David Haller <gentoo@×××××××.de>