[Solved] Problem with chroot

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
travis82
Posts: 29
Joined: 17. Jan 2015, 05:48

[Solved] Problem with chroot

Post 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
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Problem with chroot

Post by mimosa »

What is the architecture of your Salix installation, and the Arch? It needs to be the same.
travis82
Posts: 29
Joined: 17. Jan 2015, 05:48

Re: Problem with chroot

Post 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?
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Problem with chroot

Post 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.
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Problem with chroot

Post 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.
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Problem with chroot

Post 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.
travis82
Posts: 29
Joined: 17. Jan 2015, 05:48

Re: Problem with chroot

Post 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.
Post Reply