Re: cross install 64bit target from 32bit host
On 05/29/2016 01:34 AM, Haines Brown wrote: > This is an extension of my initial question, for I'm not sure my initial > conclusion that it is impossible to chroot a 64bit system from a 32bit > system is correct. With a 32bit kernel you need qemu-user-static for this to work - but expect it to be _at least_ a factor of 10 or so slower than your normal system when using qemu. (Especially if your kernel is 32bit x86, which is register-starved, so emulating other platforms is likely going to be really slow.) > Or can chroot be run on a 64 bit system mounted on /mnt/64bit/: > > # dpkg --add-architecture amd64 > # apt-get update > # apt-get install libc6-amd64 > # LANG=C.UTF-8 chroot /mnt/64bit /bin/bash dpkg --add-architecture (and installing libc6-amd64) is never useful for chroots: either you can execute 64bit binaries (directly via a 64bit kernel or indirectly via qemu-user-static), and then chroot will just work (without any 64bit software on the host), or you can't execute them, and then it won't help either. What you can do is: apt-get install qemu-user-static Then you need to setup the x86_64 binfmt manually, because the Debian package doesn't do that automatically anymore [1]: /usr/sbin/update-binfmts --install qemu-x86_64 \ /usr/bin/qemu-x86_64-static \ --magic '\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00' \ --mask '\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' \ --offset 0 --credential yes Then copy the /usr/bin/qemu-x86_64-static binary into the chroot: cp /usr/bin/qemu-x86_64-static /mnt/64bit/usr/bin/ And then you can just use chroot directly: LANG=C.UTF-8 chroot /mnt/64bit /bin/bash (Note that the normal rules for chroots also apply, i.e. that you might need to handle the /proc, /sys and /dev{,/pts,/shm} and /run file systems specially, depending on what you want to do inside the chroot.) But as I said above: with qemu-user-static it's going to be very slow. Especially since your hardware does support 64bit code directly, I would *really* recommend you to just install a 64bit kernel [2] (you can leave the main packages 32bit) and reboot, then you can chroot into either 64bit or 32bit environments without having to resort to emulation. So unless you're just using this as a temporary measure, I really wouldn't recommend it. Regards, Christian [1] See bug #604712, because i386 can be used with 64bit kernels, which is much more common than your use case, and there you don't want to have emulation. [2] Will probably boil down to something like: dpkg --add-architecture amd64 apt-get update apt-get install linux-image-amd64 signature.asc Description: OpenPGP digital signature
Re: cross install 64bit target from 32bit host
This is an extension of my initial question, for I'm not sure my initial conclusion that it is impossible to chroot a 64bit system from a 32bit system is correct. Can it done by installing qemu-user-static and loading a 64-bit live ISO and then from it chroot the 64-bit target mounted on /mnt/64bit/? Or can chroot be run on a 64 bit system mounted on /mnt/64bit/: # dpkg --add-architecture amd64 # apt-get update # apt-get install libc6-amd64 # LANG=C.UTF-8 chroot /mnt/64bit /bin/bash Haines Brown
Re: cross install 64bit target from 32bit host
On 2016-05-27 14:08 -0400, Haines Brown wrote: > On Fri, May 27, 2016 at 07:50:05PM +0200, Sven Joachim wrote: >> On 2016-05-27 13:28 -0400, Haines Brown wrote: >> >> > I'm doing a cross installation. The host system is Wheezy 32 bit, and >> > the target is Jessie 64 bit. So I run this: >> > >> > # debootstrap --no-check-gpg --arch=amd64 --foreign jessie /mnt/debian >> > ... >> > >> > This sucessfully installed first stage files. Then I go to chroot into >> > the target disk and get: >> > >> > # LANG=C.UTF-8 chroot /mnt/debian /bin/bash >> > chroot: failed to run command `/bin/bash': Exec format error >> > >> > I gather the problem is that I'm trying to run 64bit bash code with a >> > 32bit chroot application. How does one then do a cross install a 64 bit >> > operating system with a 32-bit host machine? I did not find help in the >> > chroot manual. >> >> If possible, install and boot a 64-bit kernel (you don't need the >> --foreign option for debootstrap then). If your current processor is >> not capable of that, try qemu-user-static. > > Thanks, Sven. The bottom line seems to be that it cannot be done without > rebooting the system. I suppose my CPU (Core i7-4790K) can handle an > installation of a 64-bit kernel in a new bootable primary partition > created for that purpose (if that is what you meant), but that still > involves rebooting. Actually I meant to install a 64-bit kernel in your current (wheezy) system, e.g. with "apt-get install linux-image-amd64", but a reboot is indeed necessary. Cheers, Sven
Re: cross install 64bit target from 32bit host
On Fri, May 27, 2016 at 07:50:05PM +0200, Sven Joachim wrote: > On 2016-05-27 13:28 -0400, Haines Brown wrote: > > > I'm doing a cross installation. The host system is Wheezy 32 bit, and > > the target is Jessie 64 bit. So I run this: > > > > # debootstrap --no-check-gpg --arch=amd64 --foreign jessie /mnt/debian ... > > > > This sucessfully installed first stage files. Then I go to chroot into > > the target disk and get: > > > > # LANG=C.UTF-8 chroot /mnt/debian /bin/bash > > chroot: failed to run command `/bin/bash': Exec format error > > > > I gather the problem is that I'm trying to run 64bit bash code with a > > 32bit chroot application. How does one then do a cross install a 64 bit > > operating system with a 32-bit host machine? I did not find help in the > > chroot manual. > > If possible, install and boot a 64-bit kernel (you don't need the > --foreign option for debootstrap then). If your current processor is > not capable of that, try qemu-user-static. Thanks, Sven. The bottom line seems to be that it cannot be done without rebooting the system. I suppose my CPU (Core i7-4790K) can handle an installation of a 64-bit kernel in a new bootable primary partition created for that purpose (if that is what you meant), but that still involves rebooting. If I have to reboot I might as well simply install the 64 bit system directly to the target disk from a netboot ISO. Haines
Re: cross install 64bit target from 32bit host
On 2016-05-27 13:28 -0400, Haines Brown wrote: > I'm doing a cross installation. The host system is Wheezy 32 bit, and > the target is Jessie 64 bit. So I run this: > > # debootstrap --no-check-gpg --arch=amd64 --foreign jessie /mnt/debian ... > > This sucessfully installed first stage files. Then I go to chroot into > the target disk and get: > > # LANG=C.UTF-8 chroot /mnt/debian /bin/bash > chroot: failed to run command `/bin/bash': Exec format error > > I gather the problem is that I'm trying to run 64bit bash code with a > 32bit chroot application. How does one then do a cross install a 64 bit > operating system with a 32-bit host machine? I did not find help in the > chroot manual. If possible, install and boot a 64-bit kernel (you don't need the --foreign option for debootstrap then). If your current processor is not capable of that, try qemu-user-static. Cheers, Sven
cross install 64bit target from 32bit host
I'm doing a cross installation. The host system is Wheezy 32 bit, and the target is Jessie 64 bit. So I run this: # debootstrap --no-check-gpg --arch=amd64 --foreign jessie /mnt/debian ... This sucessfully installed first stage files. Then I go to chroot into the target disk and get: # LANG=C.UTF-8 chroot /mnt/debian /bin/bash chroot: failed to run command `/bin/bash': Exec format error I gather the problem is that I'm trying to run 64bit bash code with a 32bit chroot application. How does one then do a cross install a 64 bit operating system with a 32-bit host machine? I did not find help in the chroot manual. Haines Brown