Help! /bin/bash not found on chroot
Colin Watson
cjwatson at ubuntu.com
Wed Dec 1 13:01:55 UTC 2021
On Sat, Nov 27, 2021 at 04:47:27PM +0100, Volker Wysk wrote:
> Something happened to my system. Suddenly, next to nothing worked any
> more. For instance "ls" won't be found any longer.
>
> I made a reboot and the system asks for the disk password, and
> afterwards dies. When going into the recovery, then there are messages
> stating that /sbin/init and /etc/init aren't found. Then the system
> stops with a kernel panic.
>
> I'm trying to fix the problem by booting from an USB stick. Then I
> mount the faulty system at /mnt/rootneu and do this:
>
> mount BOOTPART /mnt/rootneu/boot
> mount EFIPART /mnt/rootneu/boot/efi
> mount --rbind /dev /mnt/rootneu/dev
> mount --rbind /proc /mnt/rootneu/proc
> mount --rbind /sys /mnt/rootneu/sys
>
> I do this so I can "update-initramfs -u", "grub-install ..." and
> "update-grub" later.
>
> So far, it works. But then I try to chroot to the system that fails
> with:
>
> chroot /mnt/rootneu
>
> This FAILS with:
>
> chroot: failed to run command '/bin/bash': No such file or directory
>
> Even though /bin/bash and /mnt/rootneu/bin/bash are both present and
> can be started.
In general, when you see this sort of problem, it's because one of the
other files needed by that executable is broken.
Running a program usually requires opening more than one file. For
example, on a 64-bit x86 system, /bin/bash requires first the dynamic
linker (/lib64/ld-linux-x86-64.so.2), followed by a number of libraries
it's linked against: /lib/x86_64-linux-gnu/libc.so.6,
/lib/x86_64-linux-gnu/libdl.so.2, and
/lib/x86_64-linux-gnu/libtinfo.so.6. ("ldd /bin/bash" lists these,
along with "linux-vdso.so.1" which is a magic thing provided by the
kernel.) If any of these is broken, then you'll get the error above.
Unfortunately the program execution interface generally squashes these
so that it isn't possible to report exactly which one went wrong, though
in some cases you can work it out using tools such as strace; so I don't
know exactly what your problem is, but maybe that will provide some kind
of clue.
--
Colin Watson (he/him) [cjwatson at ubuntu.com]
More information about the ubuntu-users
mailing list