Synopsis
During the installation of Gentoo Linux, attempting to chroot into the new environment breaks with the following error:
root #
chroot /mnt/gentoo /bin/bash
chroot: failed to run command `/bin/bash': Exec format error
Environment
This article applies to Gentoo Linux installations on an x86_64 platform (amd64 architecture).
Analysis
The error Exec format error means that the binary being executed is made for a different architecture than the environment currently booted. It usually occurs when the system has been booted on a 32-bit system when a 64-bit environment is trying to load.
Resolution
Reboot the live environment and choose the correct architecture (most LiveCDs support a 64-bit kernel as well as a 32-bit option, although it is not booted by default). Look for entries labeled gentoo64 or linux64 if trying to boot a 64-bit system.
See also
- Chroot — a Unix system utility used to change the apparent root directory to create a new environment logically separate from the main system’s root directory.
- Index
- » Newbie Corner
- » [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Pages: 1
#1 2015-03-13 22:14:10
- stevepa
- Member
- From: Texas USA
- Registered: 2012-02-12
- Posts: 113
[resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Problem: I am getting an error:
chroot: failed to run command ‘/bin/bash’: Exec format error
while attempting to follow wiki topic «Remastering the Install ISO»
My environment is i686 packages on fully updated Arch Linux install.
My arch iso is from here http://mirrors.gigenet.com/archlinux/is … 1-dual.iso
The context of the error is precisely as follows, at the end:
# mkdir /mnt/archiso
# mount -t iso9660 -o loop /home/steve/Downloads/archlinux-2015.03.01-dual.iso /mnt/archiso
mount: /dev/loop0 is write-protected, mounting read-only
$ cd ~
$ mkdir customiso
$ cp -a /mnt/archiso/ ./customiso
$ cd customiso/archiso/arch/x86_64/
$ unsquashfs airootfs.sfs
Parallel unsquashfs: Using 2 processors
1 inodes (262144 blocks) to write
[=============================================================================================|] 262144/262144 100%
created 1 files
created 1 directories
created 0 symlinks
created 0 devices
created 0 fifos
# cd /home/steve/customiso/archiso/arch/x86_64/
# mount -o loop squashfs-root/airootfs.img mnt
# mount -o loop squashfs-root/airootfs.img mnt
# arch-chroot mnt /bin/bash
chroot: failed to run command ‘/bin/bash’: Exec format error
FYI, I have read this info https://wiki.archlinux.org/index.php/Ch … rch-chroot
Plus, I use chroot on every install without this trouble.
Does this error have anything to do with setarch? Here is what I tried:
setarch i686 arch-chroot mnt /bin/bash
chroot: failed to run command ‘/bin/bash’: Exec format error
# setarch x86_64 arch-chroot mnt /bin/bash
setarch: x86_64: Unrecognized architecture
I verified bash is at /bin/bash
The wiki article directories appear to vary slightly from the downloaded iso, but I adjusted to them, I hope, correctly.
Is it even possible to follow the wiki section «Modifying the X86_64 system» on a i686 install?
I hope I have not overlooked something simple.
Any pointers or tips appreciated as always.
Steve.
Last edited by stevepa (2015-03-15 01:31:20)
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#2 2015-03-13 22:19:51
- graysky
- Wiki Maintainer
- From: :wq
- Registered: 2008-12-01
- Posts: 10,472
- Website
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
I believe you need to boot into an i686 install to chroot into an i686 system.
#3 2015-03-13 22:55:41
- falconindy
- Developer
- From: New York, USA
- Registered: 2009-10-22
- Posts: 4,111
- Website
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
graysky wrote:
I believe you need to boot into an i686 install to chroot into an i686 system.
No, this isn’t true. You can use linux32 to emulate an i686 environment from x86_64. You can’t do the reverse however (chroot into x86_64 from i686) which is what the OP is attempting.
Last edited by falconindy (2015-03-13 23:00:14)
#4 2015-03-13 23:00:13
- stevepa
- Member
- From: Texas USA
- Registered: 2012-02-12
- Posts: 113
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Thank you Mr. Falcon. That was my suspicion.
I did not see that proviso on the wiki page but maybe it was common sense.
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#5 2015-03-13 23:19:27
- jasonwryan
- Anarchist
- From: .nz
- Registered: 2009-05-09
- Posts: 30,376
- Website
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Oh, so it is Mr Falcon now?
Arch + dwm • Mercurial repos • Surfraw
Registered Linux User #482438
#6 2015-03-13 23:20:41
- Raynman
- Member
- Registered: 2011-10-22
- Posts: 1,467
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
stevepa wrote:
Thank you Mr. Falcon. That was my suspicion.
I did not see that proviso on the wiki page but maybe it was common sense.
It does say
Requirements:
Matching architecture environments; i.e. the chroot from and chroot to. The architecture of the current environment can be discovered with: uname -m (e.g. i686 or x86_64).
#7 2015-03-13 23:44:59
- karol
- Archivist
- Registered: 2009-05-06
- Posts: 25,440
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
#8 2015-03-14 02:23:30
- stevepa
- Member
- From: Texas USA
- Registered: 2012-02-12
- Posts: 113
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
If I may update my experience about archiso.
First, I love it! Thanks to those who created or maintain archiso.
As my first foray, I just added the package ‘vim-minimal’ to packages.both and ran the build script (because I dislike nano).
After about 10 minutes, it quit, and I burned the image to a flash drive, booted it, and vim was in the live system.
Kind of gives a beginner a taste of creating an Arch Linux install ‘spin’. Granted, a hardly improved spin.
Update 2: Just thought I would add some build times on a modern laptops
Lenovo Thinkpad T440p i5 4GB SSD profile=releng
time ./build.sh -v
[mkarchiso] INFO: Done! | 611M out/archlinux-2015.03.14-dual.iso
real 6m38.869s
user 12m38.920s
sys 0m48.213s
Lenovo X220 i5 8GB SSD profile=baseline
time ./build.sh -v
[mkarchiso] INFO: Done! | 223M out/archlinux-2015.03.14-x86_64.iso
real 2m10.040s
user 4m53.380s
sys 0m26.313s
Lenovo X220 i5 8GB SSD profile=releng (stock)
[mkarchiso] INFO: Done! | 595M out/archlinux-2015.03.14-dual.iso
real 7m37.280s
user 14m21.257s
sys 1m8.783s
Last edited by stevepa (2015-03-15 04:09:17)
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#9 2015-03-14 03:35:17
- stevepa
- Member
- From: Texas USA
- Registered: 2012-02-12
- Posts: 113
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Raynman wrote:
stevepa wrote:
Thank you Mr. Falcon. That was my suspicion.
I did not see that proviso on the wiki page but maybe it was common sense.
It does say
Requirements:
Matching architecture environments; i.e. the chroot from and chroot to. The architecture of the current environment can be discovered with: uname -m (e.g. i686 or x86_64).
You are absolutely right! My bad.
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#10 2015-03-14 04:07:45
- stevepa
- Member
- From: Texas USA
- Registered: 2012-02-12
- Posts: 113
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
On the wiki https://wiki.archlinux.org/index.php/Ta … not_enough
Regarding «Rebuilding the iso…not enough»
I can confirm this is correct.
The error I get is
[mkarchiso] INFO: Configuration settings
[mkarchiso] INFO: Command: run
[mkarchiso] INFO: Architecture: i686
[mkarchiso] INFO: Working directory: work/i686
[mkarchiso] INFO: Installation directory: arch
[mkarchiso] INFO: Run command: /root/customize_airootfs.sh
Generating locales...
en_US.UTF-8... done
Generation complete.
usermod: no changes
useradd: user 'arch' already exists
Will look for a solution.
Tks
Last edited by stevepa (2015-03-14 04:09:05)
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
ARCH=Debian is not valid there is no such thing, ARCH is architect which is arm type
…
Sent from my iPhone
On Jul 12, 2018, at 5:24 PM, SparrOSDeveloperTeam ***@***.***> wrote:
Hi
I have been having serious problems with building images.
When I launch sudo make REPO=Debian DIST=stretch ARCH=Debian I get this error:
chroot: failed to run command ‘/bin/bash’: Exec format error
rootfs.mak:112: recipe for target ‘/home/localhost/Desktop/rpi-img-builder-master/rootfs’ failed
make[1]: *** [/home/localhost/Desktop/rpi-img-builder-master/rootfs] Error 126
Makefile:21: recipe for target ‘build-rootfs’ failed
make: *** [build-rootfs] Error 2
I am using Ubuntu Xenial 16.04 LTS amd64. I installed all programs your readme.md specified and no luck.
I attached the full log from the terminal below. I do not know what I am doing wrong. I have not modified any files in the folder.
log.txt
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
I’m traveling for the next few days when I get back home I’ll install Ubuntu on a vps and test it, seems like qemu binary isn’t right maybe
…
Sent from my iPhone
On Jul 12, 2018, at 5:50 PM, SparrOSDeveloperTeam ***@***.***> wrote:
I am still running into the same problem. This time, I’m using sudo make REPO=Debian DIST=stretch and still that chroot: failed to run command ‘/bin/bash’: Exec format error keeps showing up after processing files. What do I need to do now?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
ahhh so it’s just an ubuntu issue with a dated multistrap then?
I only every run Debian so I’m not up to date with my ubuntu versions of things.
I’ll find a good place for gnupg to be added, does it need to be gnupg or does gnupg2 work?
against I’m not sure when it comes to ubuntu, I still need to setup an ubuntu VM, but since I»m not an ubuntu fan I’m dragging my feet, hopefully I’ll have time this weekend to set one up.
suppose it depends how you install it mine are rarely over 1 gig ;). Regardless, I’ll try and get some time to install the bloated ubuntu and test it
as long as the link it right that should work but I have no idea about launchpad not an ubuntu guy remember
You might want to hard code the SUITE depending on how launchpad works. And the keyring is the package that holds the signing key for that deb so I doubt that is correct.
can I see a bit more of the log? I can’t tell what stage it’s at so know where it should go.
TheSin-
added a commit
that referenced
this issue
Jul 26, 2018
Odd there is no bug report for this, seems like the trigger script for libc-bin requires gnupg but there is no depth or even recommends on it.
Just added it to the 3 Repos that would require it incase they are all broken this way.
Test it out and let me know please
TheSin-
added a commit
that referenced
this issue
Jul 26, 2018
I thought I fixed that bug a while ago, I added an extra test before running apt-key, let me know if that does it.
When I run the chroot
command an error is given:
failed to run command ‘/bin/bash’: No such file or directory
asked May 6, 2014 at 6:57
3
This error means that there is no /bin/bash
directory inside chroot. Make sure you point it to where bash
(or other shell’s) executable is in chroot
directory.
If you have /mnt/somedir/usr/bin/bash
then execute chroot /mnt/somedir /usr/bin/bash
.
Apart from the above, you also need to add libc
directory dependencies, as mentioned in the answer here.
answered May 6, 2014 at 7:04
ek9ek9
2,8173 gold badges17 silver badges25 bronze badges
9
I had /bin/bash
inside chrooted directory, but I didn’t have /lib
and /lib64
inside it. The message from chroot
could be more descriptive. «no such file or directory» really means «I can’t run this…».
/bin/bash
depends of course on libc
, ld-linux
, libdl
etc., you can use ldd /bin/bash
to see which libraries it requires.
- You can
mount -o bind
these directories underchroot
- Or you can copy these libraries to
chroot
, if you don’t trust the chrooted env to not corrupt them, like so:cp -a /usr rootfs/ cp -a /lib rootfs/ cp -a /lib64 rootfs/
AdminBee
20.8k17 gold badges47 silver badges69 bronze badges
answered Jan 12, 2018 at 11:08
4
chroot
tries to start the shell that is set in your $SHELL
environment variable by default, but it looks for it in your new root dir, which seems not to contain /bin/bash
, so it cannot start.
You can tell chroot to start another program inside the new root by simply adding it as a parameter:
chroot /your/new/root /bin/foo --options...
Note that the path of the command is interpreted inside your new root, so in this example the called program is in fact in /your/new/root/bin/foo
answered May 6, 2014 at 7:05
crater2150crater2150
3,7062 gold badges22 silver badges25 bronze badges
1
I was getting the same error when trying to ssh to a chrooted account on a remote server. In my case, I was missing the following file in the remote lib64 directory. Server is Centos6.9
ld-linux-x86-64.so.2
It was fixed by executing the following:
cp /lib64/ld-linux-x86-64.so.2 /secure/jail/lib64/
answered Nov 15, 2017 at 14:18
shawnshawn
1511 silver badge1 bronze badge
1
In case you are doing a cross compilation you need to use qemu simulator which can run /mnt/somedir/bin/bash. Below are the steps for armhf cross compilation. Steps for other architectures should be similar.
- First install qemu-user-static
sudo apt-get install qemu-user-static
- Then copy the ‘qemu-arm-static’ binary into the chroot directory
sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
Once you copy the qemu-arm-static into the /mnt/usr/bin you will be able to do chroot.
Check this out for more details: https://blog.lazy-evaluation.net/posts/linux/debian-armhf-bootstrap.html
answered Jul 25, 2019 at 11:39
3
you need to run ldd against bash ldd $(which bash)
, then you might find a missing dependency, for example if you didn’t mount/copy lib64, for 64 systems, it will through this error.
answered Apr 8, 2019 at 18:08
ErrorError
3631 gold badge3 silver badges13 bronze badges
Something no one has mentioned yet, if the goal is not to keep copies of libraries you locate with ldd. When you build busybox it respects LDFLAGS=--static
per their FAQ. This will build all necessary libraries into your binaries. This does increase the size of the binaries, but… you’d need most of this disk space to store what you’re locating with ldd anyway.
Note that you may still need to copy your c library (libc.so.6), core math library (libm.so.6), namespace resolution library (libresolv.so.2), and kernel library (in my case, since I am using a raspberry pi, ld-linux-armhf.so.3) . You can use the ldd tool as directed in other answers on your static busybox binary to discover whether this is the case.
These may in turn depend on other libraries. To discover whether this is the case you can use the file tool. I am using the full path to raspberry pi’s libm.so.6 as an example :
file /chroot/lib/arm-linux-gnueabihf/libm.so.6
In my case, since ARM processors need many libraries, I copied my entire arm-linux-gnueabihf folder into my lib folder, allowing me to access my chroot.
answered Jan 20, 2020 at 0:24
The bash elf
is not available in /bin
, /usr/bin/
etc.
cp -rf --preserve=links /usr/bin/* myroot/usr/bin/; cp --preserve=links -rf /lib64/* myroot/lib64/;..
copy all libraries and ELFs.
Kevdog777
3,15418 gold badges42 silver badges64 bronze badges
answered Jan 29, 2020 at 13:41
- Run
ldd /bin/bash
to see dependences. Wiil reply like follows:
linux-vdso.so.1 (0x00007ffd057eb000) libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f83183bc000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f83183b6000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f83181c4000) /lib64/ld-linux-x86-64.so.2 (0x00007f8318536000)
-
Then for each run
diff
. Likediff /lib/x86_64-linux-gnu/libtinfo.so.6 /mnt/lib/x86_64-linux-gnu/libtinfo.so.6
etc. (Change/mnt
to your mount path.)Also run diff for the bash, like
diff /usr/bin/bash /mnt/usr/bin/bash
.Skip
linux-vdso.so.1
because it inserted into kernel. -
If will found differences then make replace these by files from Live CD.
-
Also check that the symlink links
/lib
,/lib32
,/lib64
lead to the correct directories (to/usr/lib
etc).
answered Aug 29, 2020 at 1:52
bl79bl79
1011 bronze badge
sudo nano /etc/passwd
After that, look for the user that gives you the problems and verify that in front of / bin / bash there are no spaces or any other character, in case of chroor, verify the root user.
nano can be replaced by any text editor.
αғsнιη
39.8k15 gold badges67 silver badges110 bronze badges
answered May 2, 2021 at 21:30
SarcoSarco
11 bronze badge
Shortcut command to copy all the lib that’s require by a command
for this example /bin/bash (You have to replace {CHROOT PATH}
with the path of your chroot)
the file usually paste into lib
lib64
depends on the /bin/bash
requirement
list="$(ldd /bin/bash | egrep -o '/lib.*.[0-9]')"
for i in $list; do cp -v --parents "$i" "{CHROOT PATH}"; done
answered Sep 6, 2021 at 4:29
Since the root has been changed the relative links to bash and other libraries no longer work. You need to copy those libraries into your DIR_TO_CHROOT
- Copy bash
mkdir /DIR_TO_CHROOT/bin cp /bin/bash /DIR_TO_CHROOT/bin # copy bash
- Copy bash’s dependencies
- create
lib
andlib64
to host these dependenciesmkdir /DIR_TO_CHROOT/lib{,64} # create lib and lib64 folders
- Find the exact dependencies needed (example output from my installation):
ldd /bin/bash linux-vdso.so.1 (0x00007fffa89d8000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f6fb8a07000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6fb8803000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6fb8412000) /lib64/ld-linux-x86-64.so.2 (0x00007f6fb8f4b000)
- So in my own case, I copy the dependencies like this:
cp /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libc.so.6 /DIR_TO_CHROOT/lib #lib cp /lib64/ld-linux-x86-64.so.2 /DIR_TO_CHROOT/lib64 #lib64
- create
Now you should be able to use bash
chroot /my-new-root bash
AdminBee
20.8k17 gold badges47 silver badges69 bronze badges
answered Sep 15, 2021 at 20:22
I was getting this error as well, but the solution turned out to be much simpler for me than many of the above answers. I was simply chroot’ing to the wrong directory.
On modern versions of the product my team supports, the product chroot is /opt/productname
,
hence we use sudo chroot /opt/productname
.
On very old versions of the product, the product chroot is named /opt/productname-x-y-z
. ie it has the version appended to the product chroot name.
So sudo chroot /opt/productname
on the old system, gave me the "chroot: command failed ... "
error. On the old system, /opt/productname
existed, but was not actually a chroot directory.
answered Mar 30, 2022 at 22:59
Make it sure /lib is a symlink to usr/lib
.
In my case, in ubuntu 22.04, after I tried to checkinstall vmwareplayer, the /lib
got messed up when it failed saying there was a new version installed. Then I guess that when checkinstall tried to revert the changes, it (or vmwareplayer installer) messed up /lib.
So the /lib
was not a symlink to usr/lib
, it was actually a real empty folder!
That also caused a serious problem making ubuntu22.04 unbootable because of /sbin/init or /etc/init not found: run-init: can't execute '/sbin/init': No such file or directory
and /etc/init permission denied
It caused also kernel panic attempted to kill init
on boot time.
answered May 30, 2022 at 6:03
Aquarius PowerAquarius Power
3,9595 gold badges36 silver badges55 bronze badges
Содержание
- Arch Linux
- #1 2015-03-13 22:14:10
- [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #2 2015-03-13 22:19:51
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #3 2015-03-13 22:55:41
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #4 2015-03-13 23:00:13
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #5 2015-03-13 23:19:27
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #6 2015-03-13 23:20:41
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #7 2015-03-13 23:44:59
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- #8 2015-03-14 02:23:30
- Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
- Thread: chroot: failed to run command ‘/bin/bash’: Exec format error
- chroot: failed to run command ‘/bin/bash’: Exec format error
- Re: chroot: failed to run command ‘/bin/bash’: Exec format error
- During a chroot attempt, I got this error: «chroot: failed to run command ‘/bin/bash’: Exec format error»
- 6 Answers 6
- Failed to run command bin bash exec format error chroot
Arch Linux
You are not logged in.
#1 2015-03-13 22:14:10
[resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Problem: I am getting an error:
while attempting to follow wiki topic «Remastering the Install ISO»
My environment is i686 packages on fully updated Arch Linux install.
The context of the error is precisely as follows, at the end:
FYI, I have read this info https://wiki.archlinux.org/index.php/Ch … rch-chroot
Plus, I use chroot on every install without this trouble.
Does this error have anything to do with setarch? Here is what I tried:
I verified bash is at /bin/bash
The wiki article directories appear to vary slightly from the downloaded iso, but I adjusted to them, I hope, correctly.
Is it even possible to follow the wiki section «Modifying the X86_64 system» on a i686 install?
I hope I have not overlooked something simple.
Any pointers or tips appreciated as always.
Steve.
Last edited by stevepa (2015-03-15 01:31:20)
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#2 2015-03-13 22:19:51
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
I believe you need to boot into an i686 install to chroot into an i686 system.
Online
#3 2015-03-13 22:55:41
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
I believe you need to boot into an i686 install to chroot into an i686 system.
No, this isn’t true. You can use linux32 to emulate an i686 environment from x86_64. You can’t do the reverse however (chroot into x86_64 from i686) which is what the OP is attempting.
Last edited by falconindy (2015-03-13 23:00:14)
#4 2015-03-13 23:00:13
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Thank you Mr. Falcon. That was my suspicion.
I did not see that proviso on the wiki page but maybe it was common sense.
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
#5 2015-03-13 23:19:27
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Oh, so it is Mr Falcon now?
Registered Linux User #482438
#6 2015-03-13 23:20:41
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
Thank you Mr. Falcon. That was my suspicion.
I did not see that proviso on the wiki page but maybe it was common sense.
Requirements:
Matching architecture environments; i.e. the chroot from and chroot to. The architecture of the current environment can be discovered with: uname -m (e.g. i686 or x86_64).
#7 2015-03-13 23:44:59
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
#8 2015-03-14 02:23:30
Re: [resolved]chroot: failed to run command ‘/bin/bash’: Exec format error
If I may update my experience about archiso.
First, I love it! Thanks to those who created or maintain archiso.
As my first foray, I just added the package ‘vim-minimal’ to packages.both and ran the build script (because I dislike nano).
After about 10 minutes, it quit, and I burned the image to a flash drive, booted it, and vim was in the live system.
Kind of gives a beginner a taste of creating an Arch Linux install ‘spin’. Granted, a hardly improved spin.
Update 2: Just thought I would add some build times on a modern laptops
Lenovo Thinkpad T440p i5 4GB SSD profile=releng
Lenovo X220 i5 8GB SSD profile=baseline
Lenovo X220 i5 8GB SSD profile=releng (stock)
Last edited by stevepa (2015-03-15 04:09:17)
Arch — LVM — ext4 — gnome (T60p 14.1 1400p x86_64), (T60 15 flexview 1400p i686)
Источник
Thread: chroot: failed to run command ‘/bin/bash’: Exec format error
Thread Tools
Display
chroot: failed to run command ‘/bin/bash’: Exec format error
I started up my computer today to notice that its not going to grub. Its dual boot with windows and ubuntu. It fails to find OS, isntead of goijng to grub. It just stats
I am not sure why because it worked last night, but i didnt do anything change wise.
So i got a live cd to reinstall grub
the error i get when i try to chroot into my os from the live cd is
chroot: failed to run command ‘/bin/bash’: Exec format error
the commands to chroot i am using are
sda5 is my linux partition
This has always worked for me before. I am not sure why it cannot find bash?
EDIT:
i searched online and found someone else said that it was a result of 32/62 bit conflict. The live cd is a 64 bit, so then i tried a 32 bit live cd, and got the same thing. So its not that.
EDIT2
I am actually selling this computer. The person that wants it only wants windows, but does not care if linux is installed. So another question is there a way to remove the partition of linux and have windows boot as normal without grub? What would be hte process. I would not want to remove linux and then not be able to have a linux os on to fix grub, etc. and not be able to boot even windows. However i cant get into windows to fix windows boot loader, because grub is messed up.
Last edited by micahpage; October 21st, 2015 at 08:38 PM .
Re: chroot: failed to run command ‘/bin/bash’: Exec format error
I started up my computer today to notice that its not going to grub. Its dual boot with windows and ubuntu. It fails to find OS, isntead of goijng to grub. It just stats
I am not sure why because it worked last night, but i didnt do anything change wise.
So i got a live cd to reinstall grub
the error i get when i try to chroot into my os from the live cd is
chroot: failed to run command ‘/bin/bash’: Exec format error
the commands to chroot i am using are
sda5 is my linux partition
This has always worked for me before. I am not sure why it cannot find bash?
EDIT:
i searched online and found someone else said that it was a result of 32/62 bit conflict. The live cd is a 64 bit, so then i tried a 32 bit live cd, and got the same thing. So its not that.
EDIT2
I am actually selling this computer. The person that wants it only wants windows, but does not care if linux is installed. So another question is there a way to remove the partition of linux and have windows boot as normal without grub? What would be hte process. I would not want to remove linux and then not be able to have a linux os on to fix grub, etc. and not be able to boot even windows. However i cant get into windows to fix windows boot loader, because grub is messed up.
Reboot and go back into Windows, and then go to control panel -> administrative tools -> computer management -> disk management.
Delete the Linux partitions, extend the Windows partition, and you should be good to go.
Источник
During a chroot attempt, I got this error: «chroot: failed to run command ‘/bin/bash’: Exec format error»
I was following the instructions of this tutorial HOWTO: Purge and Reinstall Grub 2 from the Live CD, when I encountered an error at step 1, as I launched the command
The error was the following:
Where does that come from? How do I get through?
6 Answers 6
Verify that you are using the right Live CD. For example, verify you are not using a 32bit CD instead of a 64bit CD. You need a 64bit kernel to run 64bit code, so check your architecture.
Assuming you mounted your system to be chrooted in /media/sda1, to determine the architecture you can:
if you see lib64 in the output, it’s probably a 64bit system
I had the same problem when making an image for armhf arch. I had to install qemu-user-static and then copy it to chroot bin folder.
You may have to run
then you should be able to chroot into the environment
The error means that your jail ( /mnt/temp ) does not contain a bash shell, or does not contain the libraries required to run the bash shell.
If you created your jail using something like this:
You probably meant to do this instead:
However, as a technical answer to your problem, try:
This should allow you to chroot successfully, at which point you can do other things.
There are about a million things wrong with doing that though, and almost certainly you do not want to do that. Use minbase when you create your jail, or install ubuntu on a blank target (eg. a virtual machine) and create a tar archive of the entire system which you then decompress into /mnt/temp .
Источник
Failed to run command bin bash exec format error chroot
Всем привет!
Гуру дайте дельный совет. Не знаю почему, но хочу Grub 2 на Slackware 13.1 вместо LILO по умолчанию. Использую в качестве инструмента Live CD с MINT. Информации в инете полно, здесь например http://ru.wikibooks.org/wiki/Grub_2#GRUB2_-_.D0.BF.D0.B5.D1. .
Коротко, надо так; слака стоит на /sda1
sudo mount /dev/sda1 /mnt
sudo mount —bind /dev /mnt/dev
sudo mount —bind /proc /mnt/proc
sudo chroot /mnt
grub-install /dev/sda
На деле
sudo mount /dev/sda1 /mnt
sudo mount —bind /dev /mnt/dev
sudo mount —bind /proc /mnt/proc
до сих пор все ОК, но при попытке перейти в chroot окружение, консоль меня выкидывает с такой ошибкой
chroot: cannot run command ‘ /bin/bash’ : Exec format error
Почему так? Где погорячился?
Наверняка ответ примитивен, но я как то впал в ступор.
Заранее спасибо за помощь.
Высказать мнение | Ответить | Правка | Cообщить модератору
- Прошу help забуксовал с установкой Grub 2, ImPressed, 19:22 , 02-Окт-10, (1)
- Прошу help забуксовал с установкой Grub 2, egv67, 11:04 , 03-Окт-10, (4)
- Прошу help забуксовал с установкой Grub 2, Gramozeka, 23:30 , 02-Окт-10, (2)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 23:56 , 02-Окт-10, (3)
- Прошу help забуксовал с установкой Grub 2, egv67, 13:48 , 03-Окт-10, (5)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 14:55 , 03-Окт-10, (6)
- Прошу help забуксовал с установкой Grub 2, egv67, 15:05 , 03-Окт-10, (7)
- Прошу help забуксовал с установкой Grub 2, egv67, 22:32 , 04-Окт-10, (8)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 10:38 , 05-Окт-10, (9)
- Прошу help забуксовал с установкой Grub 2, egv67, 23:49 , 06-Окт-10, (10)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 10:33 , 07-Окт-10, (11)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 19:17 , 07-Окт-10, (12)
- Прошу help забуксовал с установкой Grub 2, egv67, 15:11 , 15-Окт-10, (14)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 20:32 , 15-Окт-10, ( 17 )
- Прошу help забуксовал с установкой Grub 2, egv67, 15:11 , 15-Окт-10, (14)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 19:17 , 07-Окт-10, (12)
- Прошу help забуксовал с установкой Grub 2, tux2002, 12:09 , 09-Окт-10, (13)
- Прошу help забуксовал с установкой Grub 2, egv67, 15:44 , 15-Окт-10, ( 15 )
- Прошу help забуксовал с установкой Grub 2, gramozeka, 18:24 , 15-Окт-10, ( 16 )
- Прошу help забуксовал с установкой Grub 2, tux2002, 12:12 , 23-Окт-10, ( 18 )
- Прошу help забуксовал с установкой Grub 2, egv67, 15:44 , 15-Окт-10, ( 15 )
- Прошу help забуксовал с установкой Grub 2, gramozeka, 10:33 , 07-Окт-10, (11)
- Прошу help забуксовал с установкой Grub 2, egv67, 23:49 , 06-Окт-10, (10)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 10:38 , 05-Окт-10, (9)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 14:55 , 03-Окт-10, (6)
- Прошу help забуксовал с установкой Grub 2, egv67, 13:48 , 03-Окт-10, (5)
- Прошу help забуксовал с установкой Grub 2, gramozeka, 23:56 , 02-Окт-10, (3)
Сообщения по теме | [Сортировка по времени | RSS] |
>[оверквотинг удален]
> На деле
> sudo mount /dev/sda1 /mnt
> sudo mount —bind /dev /mnt/dev
> sudo mount —bind /proc /mnt/proc
> до сих пор все ОК, но при попытке перейти в chroot окружение,
> консоль меня выкидывает с такой ошибкой
> chroot: cannot run command ‘ /bin/bash’ : Exec format error
> Почему так? Где погорячился?
> Наверняка ответ примитивен, но я как то впал в ступор.
> Заранее спасибо за помощь.
Без chroot сделайте file /mnt/bin/bash (с вашего окружения chroot) и просто file /bin/bash (с livecd).
Сдается мне вы с 32-х битным ядром пытаетесь запустить 64х битный бинарник. Уж очень похоже.
1. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от ImPressed (ok) on 02-Окт-10, 19:22 | |
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
4. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
На счет 32-х битного ядра, это верно. Вот где собака порылась. Со своего chroot окружения войти уже не могу, в ходе эксперементов LILO таки загубил. Начну наверное с чистого листа и воспользуюсь рекомендацией Gramozeka. Что получится отпишусь. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
2. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от Gramozeka |
|
http://slackbuilds.org/repository/13.1/system/grub2/ — скачайте , соберите ( внимательно читайте строчку «This requires . » ! это важно !) и не парьтесь со всякими chroot’ами да ещё из посторонних систем , всё делается в рабочем окружении штатно . и картинки показывает и работает очень стабильно — без глюков . |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
3. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka |
|
. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
5. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Идеологически верно! Конечно не надо было заморачиваться со всяческой экзотикой. Но LILO к сожалению загубил и что бы не переустанавливать систему, все же попробую качнуть что то под 64 бита и проблему таки победить. Если не срастется, сделаю как Вы рекомендуете. И вообще this way постоянно. Еще вопрос, на сайте который Вы указали, можно выбирать между версиями ОС, но нельзя между архитектурами. А ведь это важно? Я правильно понимаю, что если явно не указана архитектура, то по умолчанию будет под 32-х битную? |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
6. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka |
|
У Вас 64-х битная система ? Это не страшно — это замечательно ! А про то , что вы убили LILO , нет ничего проще . Итак по порядку : Второй вопрос по SlackBuild’у . тут всё элементарно , в последних редакциях SlackBuild’ов вставлена конструкция автоматического определения архитектуры системы , так что можете не волноваться по этому поводу , SlackBuild сам определит какая у Вас система .. Можно конечно и проверить , чтобы лишний раз убедиться , открываем SlackBuild в любом текстовом редакторе и находим соответствующие строки должно быть как-то так : Подробнее как работать с SlackBuild можно почитать здесь : http://slackbuilds.org/howto/ |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
7. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Спасибо, все очень подробно. Сейчас нет времени заниматься, на недельке потренируюсь. Надеюсь похвастаться, что все получилось. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
8. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Ura LILO blagodorya Vam ozil. S Grub segodnya zamorachivatysya ne ne budu, ya i tak schastliv. Izvenayus za svinyachiy vostorg, no ya hot» i ot ushol ot Win goda poltora nazad. Na rabochey mashine stoit Ubuntu, zene postavil MINT. A eto drugoe, ne mne Vam ob»yasnyat».A hochetsya znat» Linux, a ne kak v konfiguryalah galki rasstavlyat». Poetomu, Slacku pobedyu.No slab poka, ochen» slab. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
9. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka |
|
Создаём три файла в любом редакторе : 1. rc.font : 2. lang.sh : 3. lang.csh : аналогично даем права на выполнение и кидаем его в папку /etc/profile.d (заменяем оригинальный) Перезагружаемся , заходим в свою учетную запись , в меню , в параметрах системы Это к тому чтобы транслитом не писать 🙂 . |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
10. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Слаку русифицировал. Правда до того как прочел Ваш пост, наткнулся на совет bugmaker с этой страницы; http://otvety.google.ru/otvety/thread?tid=78c52f8f8d72f9af&t. . Позднее переделал как Вы расписали. Но с раскладкой клавы, ровно не все. Может за одно подскажите куда копать. В /etc/X11/xorg.conf-vesa опцию «XkbOptions» «grp:ctrl_shift_toggle» прописал, значит по идее должно было заработать без настройки в «языки и стандарты»? но не заработало, когда настраиваю в конфигурялке, работает до перезагрузки Х’ов или системы. Лезу в конфигурялку, галки все на месте, переключение оживает когда их снимешь и заново расставишь. Что такая за беда? |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
11. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka |
|
это явный глюк , . хотя , попробуйте так — первое: удалите всю байду из /etc/X11/xorg.conf-vesa что Вы туда понаписали это всё не нужно , т.к. в последних версиях Slackware xorg практически не используется , всё работает через udev , поэтому не нужно ничего править в xorg.conf , второе : в конфигураторе системы найдите «Управление сеансами» и выставте » начинать с пустого сеанса» , должно пройти . |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
12. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka |
|
Это всё прелюдия была , мало имеющая отношение по существу заданного вопроса , в конце концов KDE самодостаточный DE имеющий в себе всё , что необходимо для нормальной спокойной работы , рано или поздно Вы в нём освоитесь и привыкнете — дело времени . Хотя и бытует мнение что Grub в Slackware нет , это далеко не так , первая версия Grub идет вместе с установочным образом , откройте образ зайдите в папку extra и убедитесь сами. При желании можно использовать его . 3.Создадим маленький скриптик в любом текстовом редакторе для упрощения задачи и назовём к примеру startgrub.sh: Вот и все дела , в моём первом посте описано как установить Grub2 в MBR . |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
14. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Меня еще ни кто так подробно не инструктировал. Тем не менее, на выходные наупражнявшись до отрыжки, задачку так и не решил. Проблема в том, что я инструкции, конечно, выполняю, но при этом, что делаю, не всегда понимаю. В горечах было решил, что зря я с суконным рылом в калашный ряд полез. Сидел себе на Debian’о подобных, там и буду жить. Потом успокоился, подумал, да нет, наоборот, спасибо Слаке, вернула на грешную землю. А то привык в юзерофильных системах проблемы побеждать кавалерийским наскоком, с шашкой наголо. Tут такие номера номера не проходят. Ладно, оно и к лучшему, значит шашку в ножны, хрен с ним с Grub’ом, не в нем вобщем то соль. Буду изучать азы, что да КАК ‘самое главное’. Плохо только, что по Слаке информации дельной на русском, ну уж очень мало, а толмач из меня тоже не какой. А скриптик Ваш http://unixforum.org/index.php?showtopic=118389 я таки нарыл. Правда не пробовал, и не знаю, буду ли. Не вкусно по-моему вместо того чтоб до сути докопаться, пользоваться тем, что само на блюде подъезжает. Вобщем спасибо за помощь, буду дальше колбасться. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
17 . «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka (ok) on 15-Окт-10, 20:32 | |
ничего страшного , многие так начинали (. зы-ы сам такой был) , что не получается спрашивайте , Slackware — старейший и заслужено уважаемый дистр именно за простоту и гибкость , но граблями заставлен только вход , когда начнете понимать суть происходящего увидите и убедитесь сами она очень простая в управлении и использовании . Вот несколько ссылок для начальной адаптации : |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
13. «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от tux2002 (ok) on 09-Окт-10, 12:09 | |
Графическая оболочка может перезадавать настройки X сервера. Поэтому то что вы конфигурируете в xorg.conf может не работать после запуска графической оболочки/окружения рабочего стола. Выбор графической оболочки дело личное. Я больше пользуюсь Xfce, так как Xfce меньше на себя берёт перезадания системных настроек и функций и впринципе мне приятно работать в нём. И по поводу загрузчика — лично я для себя не вижу причин переходить на grub. В lilo мне нехватало splash, вернее мне не нравились сообщения ядра на экране во время загрузки системы. Я отключил это использованием параметра ядра quiet. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
15 . «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от egv67 |
|
Я вобщем то против LILO не чего не имею. Задача заключалась в решении задачи. |
|
Высказать мнение | Ответить | Правка | ^ | Наверх | Cообщить модератору |
16 . «Прошу help забуксовал с установкой Grub 2» | + / – |
Сообщение от gramozeka (ok) on 15-Окт-10, 18:24 | |
Меню запуска приложений —> Настройки —> Редактор настроек Источник Adblock |
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- New to Ubuntu
- [SOLVED] chroot: failed to run command ‘/bin/bash’: Exec format error
-
chroot: failed to run command ‘/bin/bash’: Exec format error
I started up my computer today to notice that its not going to grub. Its dual boot with windows and ubuntu. It fails to find OS, isntead of goijng to grub. It just stats
loading operating system….boot error
I am not sure why because it worked last night, but i didnt do anything change wise.
So i got a live cd to reinstall grub
the error i get when i try to chroot into my os from the live cd ischroot: failed to run command ‘/bin/bash’: Exec format errorthe commands to chroot i am using are
Code:
sudo mount /dev/sda5 /mnt sudo mount -t proc none /mnt/proc sudo mount -o bind /dev /mnt/dev sudo mount -o bind /sys /mnt/sys sudo chroot /mnt
sda5 is my linux partition
This has always worked for me before. I am not sure why it cannot find bash?
EDIT:
i searched online and found someone else said that it was a result of 32/62 bit conflict. The live cd is a 64 bit, so then i tried a 32 bit live cd, and got the same thing. So its not that.EDIT2
I am actually selling this computer. The person that wants it only wants windows, but does not care if linux is installed. So another question is there a way to remove the partition of linux and have windows boot as normal without grub? What would be hte process. I would not want to remove linux and then not be able to have a linux os on to fix grub, etc. and not be able to boot even windows. However i cant get into windows to fix windows boot loader, because grub is messed up.Last edited by micahpage; October 21st, 2015 at 08:38 PM.
-
Re: chroot: failed to run command ‘/bin/bash’: Exec format error
Originally Posted by micahpage
I started up my computer today to notice that its not going to grub. Its dual boot with windows and ubuntu. It fails to find OS, isntead of goijng to grub. It just stats
I am not sure why because it worked last night, but i didnt do anything change wise.
So i got a live cd to reinstall grub
the error i get when i try to chroot into my os from the live cd ischroot: failed to run command ‘/bin/bash’: Exec format errorthe commands to chroot i am using are
Code:
sudo mount /dev/sda5 /mnt sudo mount -t proc none /mnt/proc sudo mount -o bind /dev /mnt/dev sudo mount -o bind /sys /mnt/sys sudo chroot /mnt
sda5 is my linux partition
This has always worked for me before. I am not sure why it cannot find bash?
EDIT:
i searched online and found someone else said that it was a result of 32/62 bit conflict. The live cd is a 64 bit, so then i tried a 32 bit live cd, and got the same thing. So its not that.EDIT2
I am actually selling this computer. The person that wants it only wants windows, but does not care if linux is installed. So another question is there a way to remove the partition of linux and have windows boot as normal without grub? What would be hte process. I would not want to remove linux and then not be able to have a linux os on to fix grub, etc. and not be able to boot even windows. However i cant get into windows to fix windows boot loader, because grub is messed up.If you want to just have Windows, then it is easy.
Boot up using a Windows Installation disk, choose repair computer, troubleshoot, then to the command prompt.
Run
Reboot and go back into Windows, and then go to control panel -> administrative tools -> computer management -> disk management.
Delete the Linux partitions, extend the Windows partition, and you should be good to go.Does not work with EFI
Don’t waste your energy trying to change opinions … Do your thing, and don’t care if they like it.
-
Re: chroot: failed to run command ‘/bin/bash’: Exec format error
I figured the problem. On a whim i took out the SATA and power from the HDD, blew the dust, and reinserted and it worked.