From owner-freebsd-questions@FreeBSD.ORG Tue Sep 30 21:35:42 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 118221065689 for ; Tue, 30 Sep 2008 21:35:42 +0000 (UTC) (envelope-from zozo@q.gid0.org) Received: from smtp7-g19.free.fr (smtp7-g19.free.fr [212.27.42.64]) by mx1.freebsd.org (Postfix) with ESMTP id B287D8FC22 for ; Tue, 30 Sep 2008 21:35:41 +0000 (UTC) (envelope-from zozo@q.gid0.org) Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id 5725AB0137; Tue, 30 Sep 2008 23:35:40 +0200 (CEST) Received: from q.gid0.org (s.gid0.org [88.163.116.140]) by smtp7-g19.free.fr (Postfix) with ESMTP id BB671B0151; Tue, 30 Sep 2008 23:35:39 +0200 (CEST) Received: (from zozo@localhost) by q.gid0.org (8.14.3/8.14.3/Submit) id m8ULZbD4024685; Tue, 30 Sep 2008 23:35:37 +0200 (CEST) (envelope-from zozo) Date: Tue, 30 Sep 2008 23:35:37 +0200 From: Olivier Smedts To: Mel Message-ID: <20080930213536.GA24601@q.gid0.org> References: <20080930184401.GA23783@q.gid0.org> <200809302128.40212.fbsd.questions@rachie.is-a-geek.net> <20080930195721.GA24099@q.gid0.org> <200809302238.10566.fbsd.questions@rachie.is-a-geek.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200809302238.10566.fbsd.questions@rachie.is-a-geek.net> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: questions@freebsd.org Subject: Re: chrooting in a 32-bit world from a 64-bit kernel+world X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2008 21:35:42 -0000 On Tue, Sep 30, 2008 at 10:38:10PM +0200, Mel wrote: > On Tuesday 30 September 2008 21:57:22 Olivier Smedts wrote: > > On Tue, Sep 30, 2008 at 09:28:39PM +0200, Mel wrote: > > > On Tuesday 30 September 2008 20:44:02 Olivier Smedts wrote: > > > > So far I've got a working FreeBSD (kernel+world) in a 512MB image I can > > > > dump on a CompactFlash card : > > > > # cd /usr/src > > > > # make buildworld TARGET=i386 > > > > # make buildkernel TARGET=i386 > > > > # mount /dev/md0a /mnt > > > > (md0 is a 512MB file backed image I bsdlabel'd and newfs'd before) > > > > # make installworld TARGET=i386 DESTDIR=/mnt > > > > # make distribution TARGET=i386 DESTDIR=/mnt > > > > # make installkernel TARGET=i386 DESTDIR=/mnt > > > > > > > > The problem is that I can't chroot in this 32-bit world. > > > > Say I want to install the sysutils/screen port in /mnt : > > > > > > > > # mkdir /mnt/usr/ports > > > > # mount -t nullfs /usr/ports /mnt/usr/ports > > > > # mount -t devfs devfs /mnt/dev > > > > > > It's a guess, but at this point: > > > chroot /mnt /etc/rc.d/ldconfig start > > > > First, thank you for replying so fast ! > > > > /etc/rc.d/ldconfig is a /bin/sh script, and I can't run /bin/sh in this > > chroot. Same errors. > > > > > If that don't work: > > > /sbin/ldconfig -32 -s -f /mnt/var/run/ld-elf.so.hints /mnt/lib \ > > > /mnt/usr/lib > > > > After that command, the shared libraries are found, but ld refers to /mnt : > > # ldconfig -rf /mnt/var/run/ld-elf.so.hints > > /mnt/var/run/ld-elf.so.hints: > > search directories: /mnt/lib:/mnt/usr/lib > > 0:-lc.7 => /mnt/lib/libc.so.7 > > 1:-lcrypt.4 => /mnt/lib/libcrypt.so.4 > > [...] > > Right. > cd /mnt > rmdir mnt > ln -s . mnt > > The old chroot symlink hack. > > > And then when trying to chroot, still the same problem. I also can't launch > > ldconfig in the jail : > > # chroot /mnt/ /sbin/ldconfig -32 -s -f /var/run/ld-elf.so.hints /lib > > /usr/lib ELF interpreter /libexec/ld-elf.so.1 not found > > Abandon > > If you have /rescue there, maybe chroot /mnt /rescue/ldconfig /lib /usr/lib > will help you. I'm pretty sure it's the missing hints causing this. > > If all this fails, I'd try running /mnt as a jail. Thanks for the advices. At least statically compiled binaries in /rescue work. # chroot /mnt /rescue/sh # /rescue/ldconfig /lib /usr/lib # /rescue/ldconfig -r /var/run/ld-elf.so.hints: search directories: /lib:/usr/lib 0:-lc.7 => /lib/libc.so.7 1:-lcrypt.4 => /lib/libcrypt.so.4 [...] # sh ELF interpreter /libexec/ld-elf.so.1 not found Abort trap # No luck with the symlink hack or a jail : Configuring jails:. Starting jails:ELF interpreter /libexec/ld-elf.so.1 not found cannot start jail "fanless": Abort trap . I'll try to boot directly in the 32-bit world with my 64-bit kernel. I think it should work. In that case, there's maybe something to configure in the amd64 host's ldconfig or ld-elf.so.1 before chrooting in a 32-bit world. > -- > Mel > > Problem with today's modular software: they start with the modules > and never get to the software part. -- Olivier Smedts _ ASCII ribbon campaign ( ) e-mail: olivier@gid0.org - against HTML email & vCards X www: http://www.gid0.org - against proprietary attachments / \ "Il y a seulement 10 sortes de gens dans le monde : ceux qui comprennent le binaire, et ceux qui ne le comprennent pas."