From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1ECjsV-0001ss-Cb for garchives@archives.gentoo.org; Tue, 06 Sep 2005 20:17:12 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j86KBM0L026715; Tue, 6 Sep 2005 20:11:22 GMT Received: from pop04.mail.atl.earthlink.net (pop04.mail.atl.earthlink.net [207.69.200.28]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j86KBLse029860 for ; Tue, 6 Sep 2005 20:11:21 GMT Received: from h-66-167-14-65.dnvtco56.dynamic.covad.net ([66.167.14.65]) by pop04.mail.atl.earthlink.net with esmtp (Exim 3.36 #10) id 1ECjq6-0006p2-00 for gentoo-amd64@lists.gentoo.org; Tue, 06 Sep 2005 16:14:43 -0400 Subject: Re: [gentoo-amd64] Re: Installing into a 32-bit chroot? From: Tres Melton To: gentoo-amd64@lists.gentoo.org In-Reply-To: References: <200509041702.07690.prh@gotadsl.co.uk> Content-Type: text/plain Date: Tue, 06 Sep 2005 14:14:41 -0600 Message-Id: <1126037681.10070.47.camel@thor.tres.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-amd64@gentoo.org Reply-to: gentoo-amd64@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 Content-Transfer-Encoding: 7bit X-Archives-Salt: 794a3114-7162-46b3-bf68-4f63a30b9eba X-Archives-Hash: 1122c37b55882d2b639c0611451a9d72 On Sun, 2005-09-04 at 14:14 -0700, Duncan wrote: > Peter Humphrey posted <200509041702.07690.prh@gotadsl.co.uk>, excerpted > below, on Sun, 04 Sep 2005 17:02:07 +0100: > > > I'd like to see if I can install gambas into my 32-bit chroot jail. It's > > masked out of everything but vanilla x86 systems, which I think is what I > > have in /mnt/gentoo32 (the chroot jail). > > > > Using emerge to install gambas brings all sorts of other things, including > > a duplicate xorg-x11 installation, which seems a bit excessive to me. How > > do I go about emerging into /mnt/gentoo32 with full X functionality etc, > > but without all the baggage? Perhaps someone's already done this and can > > advise me. > > > > I don't really understand properly how chroots work, and in particular > > whether it's possible to install, e.g., gambas in /mnt/gentoo32 and have > > it use libraries etc. elsewhere. Or do I really have to install a > > virtually complete gentoo 32-bit system to enable it to work? You don't need to install the complete 32 bit system if you want to take the time to dig through it and remove the unneeded stuff. In fact you don't really need any X-server stuff in the 32 bit chroot jail if you enable sharing the /tmp directory the gambas will use the 64 bit libraries to do the drawing via X calls. Compiling may be difficult though as Duncan points out below. chroot is a command that can only be executed by root since if you could (as a user) create your own chroot jail it would be easy to compromise the system from there. The only real thing it does is change the root of the file system to prevent unauthorized access to other parts of the filesystem (outside the chroot) by things running inside the jail. You have to be root to enter the jail but it is a good idea to drop root privs shortly after. > I don't really know what that is, but esearch says "a RAD tool for BASIC". > Is it X based? If so, you'll need the 32-bit xlibs and whatever else it > needs, withh appropriate headers, accessible from the 32-bit chroot so it > (or whatever dependencies it has) can compile against them. > > The 32-bit chroot stuff in the technotes explain a bit about how to set it > up and what you can remount in your chroot and what not. The > compatibility packages do contain the 32-bit xlibs in binary form, but I'm > not sure they have all the headers and the like for you to actually > compile against. Thus, I'm not sure whether you have to compile X in the > chroot or whether you can short-circuit that by making the binary compat > packages available in the chroot. Do note, in any case, that the compat > packages aren't all that optimized, so you might be better off compiling x > in 32-bit anyway, if just to get the optimized libs. Opinion seconded. > Here's how all that works in terms of X. You'll be running the 64-bit > X-server. That's fine. 32-bit stuff can connect to it. However, you > can't mix 32-bit and 64-bit executables and libraries. You can't load > 64-bit X client-libs into your 32-bit X-client app. That just doesn't > work, for the same reason you can't load 32-bit codecs in a 64-bit mplayer > or 32-bit plugins in a 64-bit browser (tho konqueror has a plugin proxy > that does the job). As I said, the 32-bit binary compatibility libs do > contain the necessary X client-libs. However, they may not contain the > headers necessarily to actually compile against them, thus being useful > for 32-bit precompiled stuff only. > > So... for now, you'll likely have to compile all of X in 32-bit mode as > well. It is easier to do so but can be avoided with a lot of work. I took the easier way. > FWIW, that's going to change with xorg-7.0, the modular-X now under > development (there's an -rc in portage, hard-masked for testing). > Upstream is splitting the monolithic package into a rather large number of > component modules, and Gentoo is doing likewise. When it's all done, > packages won't depend on X, but on the specific X-modules they need, the > client-libs for most X client-apps, and specific other modules as needed. > Thus, most folks will be able to avoid compiling at least all the extra > drivers for hardware they don't have, and in cases like this, only the > bare minimum necessary packages would be compiled to fill the > dependencies, likely only xlib. Yes, spyderous is doing amazing work here. I've looked over some of his stuff and Donnie is going to make X in Gentoo awesome. There is a good paper on the topic here: http://www.rahul.net/kenton/module.html There is also a great write up on the current state of X and where it needs to go by Jon here: http://www.freedesktop.org/~jonsmirl/graphics.html > Back to the now. If gambas isn't an X app, the dependency may be down the > dependency chain a bit. It's possible you could avoid it by tweaking > your 32-bit chroot USE flags. You'll probably want them fairly minimal, > anyway, certainly in the 32-bit make.conf, and make use of package.use to > turn on specific flags where you /do/ want them. > > -- > Duncan - List replies preferred. No HTML msgs. > "Every nonfree program has a lord, a master -- > and if you use the program, he is your master." Richard Stallman in > http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html > Somewhere in this thread is the mention of ssh to run a 32 bit program. That is a poor solution in my opinion. The suggestion was made to mount the /tmp dirs and other things and I do this at boot. Further I have written a program that will allow any user (approved by the sudoers file in the chroot and the regular root) to run any program from wherever they are without the headache of becoming root, etc.. Here ya go: #!/bin/bash # # Written and Copyright by Tres Melton (2005) # # Run a 32 bit program from 64 bit space # # If parameters given then execute the command instead of /bin/bash # If no parameters then create a new 32 bit chroot jail shell # JAIL_DIR="/mnt/sdb3/Gentoo-32" if [ $# -eq 0 ] ; then echo "Starting 32 bit shell..." /bin/linux32 sudo chroot ${JAIL_DIR} /usr/bin/sudo -u "#${UID}" bash -c "( cd ~ ; /bin/bash )" else echo "Starting a 32 bit shell to run \"$*\"" /bin/linux32 sudo chroot ${JAIL_DIR} /usr/bin/sudo -u "#${UID}" bash -c "( cd ~ ; $* )" fi Hope that helps some. Regards, -- Tres Melton IRC & Gentoo: RiverRat -- gentoo-amd64@gentoo.org mailing list