Score:0

chroot:failed to run command '/bin/bash':No such file or directory on debian 12 live

hu flag

I am using the Debian 12 live environment and have created a folder:

mkdir /mnt/boot

When I execute sudo chroot/mnt/boot, the following error is reported:

chroot:failed to run command '/bin/bash':No such file or directory

I have found this problem(https://serverfault.com/questions/162362/chroot-fails-cannot-run-command-bin-bash-no-such-file-or-directory), which looks very similar to my problem, but I followed the above steps and my problem has not been resolved. I don't know where the problem is with me?

1# mounting sda1 to /mnt/boot:

user@debian:sudo mount /dev/sda1 /mnt/boot

2# /bin/bash exists:

user@debian:/mnt/boot$whereis /bin/bash
bash: /usr/bin/bash /user/share/man/man1/bash.1.gz
user@debian:/mnt/boot$ls /bin/bash
/bin/bash

3# cp .so from lib and lib64:

user@debian:/mnt/boot$ls lib
ld-linux-86-64.so.2 libc.so.6 libdl.so.2 libtnfo.so.6 

4# make /mnt/boot/lib64 a symbolic to /mnt/boot/lib:

user@debian:/mnt/boot$sudo mkdir lib64
user@debian:/mnt/boot$sudo ln -s /mnt/boot/lib /mnt/boot/lib64

5# ldd:

user@debian:/mnt/boot$ldd /bin/bash
  linux-vdso.so.1 (0x00007ffdb8d1000)
  libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6(0x00007f3cda309000)
  libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6(0x00007f3cda128000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f3cda493000)
RAMUMSRK avatar
ly flag
Your live environment is running from the computer memory. The files loaded are a kernel and an intramfs respectively. The initramfs gets unpacked to /run. All your attempts to create a new folder are indeed altering the unpacked initramfs which is transient and not persistent. The /run mentioned in the previous line is also from the unpacked initramfs. Creating /mnt/boot and doing a chroot to /mnt/root is creating a loop
ABeginner avatar
hu flag
@GeraldSchneider Successfully, thank you very much for your answer.
Score:1
in flag

You are not checking a bash binary inside your chroot, you are checking one outside of the chroot. Ensure that the binary and all relevant libraries exist inside the chroot directory.

ABeginner avatar
hu flag
Because the debian12 live environment does not have grub install and update grub commands, I have now switched the environment to the ubuntu 19.04 live environment. The same operation, why is there still a problem with ubuntu 19.04 chroot?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.