Page 1 of 1

[Solved] Problem with chroot

Posted: 12. Jan 2019, 07:35
by travis82
Hi
I'm trying to chroot from Salix to an arch installation on another partition. Here is the steps that I took (Arch has been mounted as /arch)

Code: Select all

sudo mount --bind /proc /arch/proc
sudo mount --bind /sys /arch/sys
sudo mount --bind /dev /arch/dev
sudo mount --bind /dev/pts /arch/dev/pts
sudo cp /etc/resolv.conf /arch/etc/
sudo chroot /arch
And this is the error that I get:

Code: Select all

chroot: failed to run command ‘/bin/bash’: Exec format error
Help please

Re: Problem with chroot

Posted: 12. Jan 2019, 10:20
by mimosa
What is the architecture of your Salix installation, and the Arch? It needs to be the same.

Re: Problem with chroot

Posted: 12. Jan 2019, 11:21
by travis82
Thanks mimosa
I didn't know that the architecture of source and destination distros should be the same. In my case Salix is 32 bit and Arch is 64 bit. Is there any workaround for this situation?

Re: Problem with chroot

Posted: 12. Jan 2019, 12:45
by mimosa
Not that I can think of, though some ingenious person may have come up with a clever wheeze. Your best bet (depending what you want / need to do) may be a live USB, such as the recent Slackel release:
viewtopic.php?f=45&t=7786&p=44822&hilit=slackel#p44822

Or AlienBob's Slackware Live:
https://alien.slackbook.org/blog/slackw ... e-edition/

The reason for the problem is that when you chroot into another system, you are still running the same kernel, so any binaries compiled for the architecture of the other system won't run if it is different - the instruction set is different. Scripts would be ok. But bash itself is a binary, and that's why you see that error.

Re: Problem with chroot

Posted: 12. Jan 2019, 21:21
by gapan
You can't chroot into a 64bit system from a 32bit system. You're running a 32bit kernel and there's no way a 64bit binary would work. You can however do the opposite and chroot from a 64bit system to a 32bit system.

Re: Problem with chroot

Posted: 12. Jan 2019, 22:10
by mimosa
I didn't know you could do that. Does that mean that the x86 machine code is a superset of the 32-bit instruction set?

Unfortunately travis's situation is the other way round, though.

Re: Problem with chroot

Posted: 13. Jan 2019, 05:19
by travis82
Thank you mimosa and gapan. Fortunately I can live without chroot. I just wanted to upgrade Arch while I do my works with Salix. I can't mark the topic Solved as I can't edit the first post anymore. Sorry for taking your time.