You are not logged in.

#1 2021-10-21 14:55:24

Sadie
Member
Registered: 2021-10-20
Posts: 11

[Solved] chroot: failed to run /bin/bash no such file or script

im trying to restore my timeshift after a kernel update broke my arch install. so i "mkdir /mnt", mount /nvme0n1p2, which is my linux filesystem, to /mnt, and enter "arch-chroot /mnt". the output is: "chroot: failed to run /bin/bash: no such file or script. i did replace my shell with zsh on my arch installation, but i did not remove bash. isnt the live cd using the zsh anyways? does anyone know what the problem is?
edit: if i "chroot /mnt" it says the same thing, but with zsh instead of bash

Last edited by Sadie (2021-10-22 10:04:36)

Offline

#2 2021-10-21 15:30:32

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,336

Re: [Solved] chroot: failed to run /bin/bash no such file or script

stat /mnt/bin/bash

Offline

#3 2021-10-21 15:48:33

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

ok, thanks, turns out bash is fine, i just called my root filesystem /, i thought it was mount. however, i cant chroot into / either, it tells me: mount: /sys: sys already mounted on /sys. this is after mounting the linux filesystem under /. that is what the guides tell me to do, am i doing it wrong?

Offline

#4 2021-10-21 16:12:25

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,336

Re: [Solved] chroot: failed to run /bin/bash no such file or script

i just called my root filesystem /, i thought it was mount. however, i cant chroot into /

That's complete nonsense. "/" is the root of the active OS. If you chroot into /mnt the former /mnt becomes the new "/"
You cannot chroot into "/" because it's the active root.

Mount nvme0n1p2 to /mnt and inspec the /mnt directory - does it hold the expected linux filesystem w/ bin, usr, etc, home …?

Since I'm not really sure what you're trying to do here:

after a kernel update broke my arch instal

How?
And why do you try to use timeshift? Just fix the kernel?

Offline

#5 2021-10-21 17:07:21

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

frankly, i dont know what the issue is. upon turning on the pc, and trying to boot through grub, which did seem to work, it displayed this: failed to mount /boot, now entering emergency mode.it wants me to enter my password but when i do and hit enter, nothing happens.  advice on what to do here ive found by searching this error message is inconclusive to me, how do i find out what the problem could be. pressing control d doesnt do anything either. what can do to find out what the problem even is, or was timeshift the right choice after all. also, im sorry, i completely misunderstood what changing root meant, this is the first time this has happened to me
Edit: I hope this helps https://ibb.co/6DFbpxL

Last edited by Sadie (2021-10-21 17:16:04)

Offline

#6 2021-10-21 17:31:20

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [Solved] chroot: failed to run /bin/bash no such file or script

Go back to the live media.  Mount the root filesystem to /mnt and /boot to /mnt/boot and chroot in.  If that fails post the output of stat /mnt/bin/bash as seth previously requested.

If you can chroot in,  what is the output of

file /boot/vmlinuz-linux-*
pacman -Qo /usr/lib/modules

Offline

#7 2021-10-21 19:08:27

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

from the pacman command i get: /usr/lib/modules/ is owned by linux 5.14.14.arch1-1, /usr/lib/modules/ is owned by nvidia 470.74-10

the other one seems to be where the problem lies. the command you told me to enter told be the file didnt exist, cd-ing into the directory i  got: vmlinuz-linux: linux kernel x86 boot executable bzImage, version 5.14.12-arch1-1 (linux@archlinux) #1 SMP PREEMPT Wed, 13 oct 2021 16:58.16 +0000, RO-rootFS, swap_dev 0x9, Normal VGA.
they display different versions of the kernel. i suspect that thats where the problem lies? should i up- or downgrade something or change what kernel should be used? thanks for your help and sorry for being so hard to work with.

Last edited by Sadie (2021-10-21 19:10:57)

Offline

#8 2021-10-21 19:15:39

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [Solved] chroot: failed to run /bin/bash no such file or script

Yes the kernel version mismatch is the issue,  probably caused by updating the kernel package with /boot unmounted or /boot was mounted but the bootloader is using the kernel from the boot directory on the root filesystem.

Can you chroot in with /boot unmounted and run file on vmlinuz-linux in the /boot directory and see if that matches the packages version?

Offline

#9 2021-10-21 19:22:08

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

with the boot partition not mounted , it still outputs version 1.14.12

Offline

#10 2021-10-21 19:25:46

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [Solved] chroot: failed to run /bin/bash no such file or script

If you chroot in with /boot unmounted reinstall the linux package then reboot does the system still reach the emergency shell?

Offline

#11 2021-10-22 07:56:06

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

before i do any of that i wanna make sure i understand this correctly:
1. my motherboard is uefi, so my kernel should be stored in an efi partition that is mounted to /boot
2. because my uefi partition wasnt mounted to /boot when i tried to update my kernel, the root partition references a version of the kernel that it cant find on my boot-partition as expected.
3. to fix the problem of not being able to boot, i should update the kernel with the efi partition MOUNTED to /boot, right? you say i should unmount it, but other threads seem to suggest i should have it mounted, which makes sense because thats where the now outdated kernel is stored.
did i get any of that wrong? because updating with the boot-partition unmounted makes no sense to me

Offline

#12 2021-10-22 08:31:44

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,336

Re: [Solved] chroot: failed to run /bin/bash no such file or script

You may either be booting from the root partition but updated the kernel on the /boot partition or you're booting from the /boot partition but updated the kernel on the /boot path on the root partition - depends on which partition contains the updated kernel and which one the kernel that matches the output of "uname -a"
Either way, you need to update the kernel that you end up booting, so if the kernel on the ESP matches the booting one (uname -a) you need to mount the ESP and update the kernel to get it placed there.
You may want to adjust your fstab to not run into the same situation on future updates.

Offline

#13 2021-10-22 09:33:45

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

uname -a outputs the 5.14.8 kernel. im still on live disk. pacman tells me that the kernel is already 5.14.14 when trying to update. i tried to update the kernel with linux filesystem mounted to /mnt and esp mounted to /mnt/boot, but the output is /etc/mtab: no such file or directory, as well as could not determine filesystem mountpoints. the mtab file is in the etc folder, it just cant find because apparently still mounted incorrectly.
im starting to consider if fixing this is beyond me, this is the first time ive installed and successfully used an arch based distro through the command line. can you think of anything else i can do?

Last edited by Sadie (2021-10-22 09:40:11)

Offline

#14 2021-10-22 09:43:06

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: [Solved] chroot: failed to run /bin/bash no such file or script

Post the full commands you are using. The mtab error you usually get if you try something like

mount /mnt

without having a relevant fstab entry.

The logical progression from a live system should be:

mount $yourroot /mnt
mount $yourESP /mnt/boot
arch-chroot /mnt
pacman -S linux

replace the two accordingly with the correct partitions/devices .

Last edited by V1del (2021-10-22 09:44:05)

Offline

#15 2021-10-22 10:04:04

Sadie
Member
Registered: 2021-10-20
Posts: 11

Re: [Solved] chroot: failed to run /bin/bash no such file or script

oh, i was using chroot instead of arch-chroot. it did reinstall linux now, booted successfully. shouldnt have gotten discouraged by such a minor thing, the fix was so simple. whats your suggestion for keeping this from happening again, i saw one user say that i should put a write restriction on /boot when its unmounted. thank you all for helping me, marking as solved

Last edited by Sadie (2021-10-22 10:13:39)

Offline

#16 2021-10-22 10:26:28

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: [Solved] chroot: failed to run /bin/bash no such file or script

What no, you should just put your ESP into your /etc/fstab so that it is always mounted to /boot especially when there is a kernel update. If you check /boot without having the ESP mounted you'll likely find a initramfs and a vmlinuz-linux that got generated when you updated the kernel without having the ESP mounted.

Offline

Board footer

Powered by FluxBB