1 |
On 1 August 2014 15:28:01 CEST, Dale <rdalek1967@×××××.com> wrote: |
2 |
>Peter Humphrey wrote: |
3 |
>> On Friday 01 August 2014 14:07:08 I wrote: |
4 |
>> |
5 |
>>> I run a couple of chroots on this box to build packages for other |
6 |
>boxes on |
7 |
>>> the LAN. So far, I haven't worked out what I should populate |
8 |
>/etc/mtab with |
9 |
>>> in each chroot. Is it enough to "grep ext4 /etc/mtab > |
10 |
>>> /mnt/chroot/etc/mtab"? That catches all the physical partitions, but |
11 |
>I |
12 |
>>> imagine I need to add some /proc, /sys and /dev entries as well, but |
13 |
>is |
14 |
>>> there a simple formula for doing this? |
15 |
>> I meant to add that one chroot is 32-bit and the other is 64. The |
16 |
>host is an |
17 |
>> i5 running openrc. |
18 |
>> |
19 |
> |
20 |
>It has been a good while since I used this. So, make sure it makes |
21 |
>sense to you before trying this. This may not work if something has |
22 |
>changed in the past several years. Use with caution if at all. |
23 |
> |
24 |
>This is a little script, if you want to call it that, that I used to do |
25 |
>mine. It also lists the command to use to do a 32 bit chroot from a 64 |
26 |
>bit rig. Here it is: |
27 |
> |
28 |
>root@fireball / # cat /root/xx.chroot-mount-32bit |
29 |
> |
30 |
> |
31 |
>mount -o bind /dev /mnt/gentoo32/dev |
32 |
>mount -o bind /dev/pts /mnt/gentoo32/dev/pts |
33 |
>mount -o bind /dev/shm /mnt/gentoo32/dev/shm |
34 |
>mount -o bind /proc /mnt/gentoo32/proc |
35 |
>mount -o bind /proc/bus/usb /mnt/gentoo32/proc/bus/usb |
36 |
>mount -o bind /sys /mnt/gentoo32/sys |
37 |
>mkdir -p /mnt/gentoo32/usr/portage/ |
38 |
>mount -o bind /usr/portage /mnt/gentoo32/usr/portage/ |
39 |
> |
40 |
> |
41 |
>echo " mounting finished" |
42 |
> |
43 |
>echo "run linux32 chroot /mnt/gentoo32 /bin/bash next" |
44 |
>root@fireball / # |
45 |
> |
46 |
> |
47 |
>You may have different mount points at the very least so edit to match |
48 |
>what you have. Again, things could have changed and that no longer |
49 |
>will |
50 |
>work. It may not be a bad idea to let someone who has done this more |
51 |
>recently to give a thumbs up to that. |
52 |
> |
53 |
>That last command should be: |
54 |
> |
55 |
>linux32 chroot /mnt/gentoo32 /bin/bash |
56 |
> |
57 |
>Dale |
58 |
> |
59 |
>:-) :-) |
60 |
|
61 |
That script is too long :) |
62 |
|
63 |
cd /mnt/gentoo |
64 |
mount -o rbind /dev dev |
65 |
mount -o rbind /sys sys |
66 |
mount -o rbind /proc proc |
67 |
cp -L /etc/resolv.conf etc/resolv.conf |
68 |
cd .. |
69 |
chroot gentoo /bin/bash |
70 |
|
71 |
To undo: |
72 |
cd /mnt/gentoo |
73 |
umount -l proc sys dev |
74 |
|
75 |
If you need a 32bit chroot, put linux32 before the chroot like Dale mentioned. |
76 |
|
77 |
-- |
78 |
Joost |
79 |
-- |
80 |
Sent from my Android device with K-9 Mail. Please excuse my brevity. |