From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2ED6B13877A for ; Fri, 1 Aug 2014 21:44:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3E827E0B5A; Fri, 1 Aug 2014 21:44:33 +0000 (UTC) Received: from mail-ie0-f169.google.com (mail-ie0-f169.google.com [209.85.223.169]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 294FEE0B35 for ; Fri, 1 Aug 2014 21:44:31 +0000 (UTC) Received: by mail-ie0-f169.google.com with SMTP id rd18so6891571iec.28 for ; Fri, 01 Aug 2014 14:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=Yh1w4sMTr6R5ttG9QoSxXBDdL/DTuKCtW9gi3WcRbd8=; b=zvgnl3BkQbJPVh86YXFtVNT8KqyEyMSdvz6siXvgA8WQI1lL2P4HhKkt6YSvWxOmLS yx57phNpbv6tftyIWC5+lIjCXIQOnO6kDckYQ3tB6JJWh73/GOZOJUe9x2Z7DO1JgXuZ j5oGUGEcF3pKDgak+3eHwbrMRPt/KJwnINkUpj5c7LW8MYShWoL17ZjtTHY8nqBsc1XE tW4hQd8asTwOkHzrKk1WfCSUD+2YFxbE2e/2NTk+GywAbw5XMeIht5f5251bV+Sytrdz 4GMFYLLVCZ7wAQMeQBjo/36nBy+EOqRytCc8bQzlmNl+CeRz1l5FOWuusJT2+V4hyiPk jVAw== X-Received: by 10.43.104.132 with SMTP id dm4mr10840256icc.56.1406929471304; Fri, 01 Aug 2014 14:44:31 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.107.12.5 with HTTP; Fri, 1 Aug 2014 14:44:11 -0700 (PDT) In-Reply-To: <9a05ccce-1c76-4c5b-9093-8d8652d58e65@email.android.com> References: <3566559.YT61t9IyHV@wstn> <6536155.f0GWtIUbSO@wstn> <53DB95E1.5010709@gmail.com> <9a05ccce-1c76-4c5b-9093-8d8652d58e65@email.android.com> From: =?UTF-8?B?Q2FuZWsgUGVsw6FleiBWYWxkw6lz?= Date: Fri, 1 Aug 2014 16:44:11 -0500 Message-ID: Subject: Re: [gentoo-user] What to put in chroot mtab To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 3cb42e47-6661-4d0b-9b71-70b60530d149 X-Archives-Hash: c9bdd104338dc678aad04f2328033aaf On Fri, Aug 1, 2014 at 4:39 PM, J. Roeleveld wrote: > On 1 August 2014 23:33:05 CEST, "Canek Pel=C3=A1ez Vald=C3=A9s" wrote: >>On Fri, Aug 1, 2014 at 4:31 PM, Canek Pel=C3=A1ez Vald=C3=A9s >>wrote: >>> On Aug 1, 2014 3:46 PM, "J. Roeleveld" wrote: >>>> >>>> On 1 August 2014 15:28:01 CEST, Dale wrote: >>>> >Peter Humphrey wrote: >>>> >> On Friday 01 August 2014 14:07:08 I wrote: >>>> >> >>>> >>> I run a couple of chroots on this box to build packages for >>other >>>> >boxes on >>>> >>> the LAN. So far, I haven't worked out what I should populate >>>> >/etc/mtab with >>>> >>> in each chroot. Is it enough to "grep ext4 /etc/mtab > >>>> >>> /mnt/chroot/etc/mtab"? That catches all the physical partitions, >>but >>>> >I >>>> >>> imagine I need to add some /proc, /sys and /dev entries as well, >>but >>>> >is >>>> >>> there a simple formula for doing this? >>>> >> I meant to add that one chroot is 32-bit and the other is 64. The >>>> >host is an >>>> >> i5 running openrc. >>>> >> >>>> > >>>> >It has been a good while since I used this. So, make sure it makes >>>> >sense to you before trying this. This may not work if something >>has >>>> >changed in the past several years. Use with caution if at all. >>>> > >>>> >This is a little script, if you want to call it that, that I used >>to do >>>> >mine. It also lists the command to use to do a 32 bit chroot from >>a 64 >>>> >bit rig. Here it is: >>>> > >>>> >root@fireball / # cat /root/xx.chroot-mount-32bit >>>> > >>>> > >>>> >mount -o bind /dev /mnt/gentoo32/dev >>>> >mount -o bind /dev/pts /mnt/gentoo32/dev/pts >>>> >mount -o bind /dev/shm /mnt/gentoo32/dev/shm >>>> >mount -o bind /proc /mnt/gentoo32/proc >>>> >mount -o bind /proc/bus/usb /mnt/gentoo32/proc/bus/usb >>>> >mount -o bind /sys /mnt/gentoo32/sys >>>> >mkdir -p /mnt/gentoo32/usr/portage/ >>>> >mount -o bind /usr/portage /mnt/gentoo32/usr/portage/ >>>> > >>>> > >>>> >echo " mounting finished" >>>> > >>>> >echo "run linux32 chroot /mnt/gentoo32 /bin/bash next" >>>> >root@fireball / # >>>> > >>>> > >>>> >You may have different mount points at the very least so edit to >>match >>>> >what you have. Again, things could have changed and that no longer >>>> >will >>>> >work. It may not be a bad idea to let someone who has done this >>more >>>> >recently to give a thumbs up to that. >>>> > >>>> >That last command should be: >>>> > >>>> >linux32 chroot /mnt/gentoo32 /bin/bash >>>> > >>>> >Dale >>>> > >>>> >:-) :-) >>>> >>>> That script is too long :) >>>> >>>> cd /mnt/gentoo >>>> mount -o rbind /dev dev >>>> mount -o rbind /sys sys >>>> mount -o rbind /proc proc >>>> cp -L /etc/resolv.conf etc/resolv.conf >>>> cd .. >>>> chroot gentoo /bin/bash >>>> >>>> To undo: >>>> cd /mnt/gentoo >>>> umount -l proc sys dev >>> >>> That's still too long :) >>> >>> With systemd-nspawn, you only do: >>> >>> systemd-nspawn -D /mnt/gentoo >>> >>> Systemd takes care of /dev, /sys, etc. If the container has systemd >>> installed, you can do >>> >>> systemd-nspawn -bD /mnt/gentoo >>> >>> and the services inside the container will be started like in a >>regular boot >>> (you'll need to set the root password for the container). >>> >>> Also, if you want to share the /usr/portage directory between host >>and >>> container, you only need to >>> >>> systemd-nspawn --bind=3D/usr/portage -bD /mnt/gentoo >> >>Oh, and I forgot: to stop the container, just log out if the container >>runs OpenRC, or run systemctl poweroff if the container runs systemd. >> >>Regards. > > That script could easily be written in C and compiled and then called in = a similar way as systemd-nspawn. And yet nobody has done it and got it included in most distributions. > What your command does is basically the same apart from doing something d= ifferent from using chroots. True, but still it's shorter ;) > Converting a perfectly working and efficiently running system to use some= thing like systemd just to have a chroot environment is overly complex and = convoluted. I agree; but as many of us are already using systemd, is good to know that the possibility exists. > These solutions often cause more issues then the problem it tried to solv= e. I was only offering options. The OP will use whatever he decides to use. Regards. --=20 Canek Pel=C3=A1ez Vald=C3=A9s Profesor de asignatura, Facultad de Ciencias Universidad Nacional Aut=C3=B3noma de M=C3=A9xico