Fixing chroot & mount troubleshooting in Rescue Mode (and resetting the root password)

5 Easy Steps to Fix chroot Errors in Rescue Mode (Reset Root Password)

A practical, step-by-step recovery guide for Linux administrators and DevOps engineers.

Introduction: Understanding chroot Errors in Rescue Mode

When a Linux server fails to boot, rescue mode (a provider rescue image or a live CD) is the usual route to recover the system. A common stumbling block is chroot errors such as:

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

This guide explains why these errors happen, how to find and mount the correct partition, prepare a working chroot environment, and safely reset the root password.

 

Step 1: Why chroot Errors Occur

The rescue environment provides its own root filesystem. To operate on the installed system, you must mount the installed system’s root partition (often under /mnt) and then chroot into it. If you mount the wrong partition (for example /boot), /bin/bash will be missing and chroot fails.

Step 2: Identify the Correct Root Partition

lsblk -f

Look for the largest Linux partition (ext4/xfs/ext3) containing the system tree. On RAID systems, the root is usually the largest filesystem (not /boot or swap).

Step 3: Unmount Previous Mounts (Resolve “Target is Busy”)

umount -l /mnt/dev /mnt/proc /mnt/sys /mnt/run 2>/dev/null
umount -l /mnt 2>/dev/null

Check active mounts:

mount | grep /mnt
fuser -vm /mnt
lsof | grep /mnt

Note: Use lazy unmount -l in rescue environments.

Step 4: Mount the Correct Root Filesystem

mount /dev/md3 /mnt
# or single disk
mount /dev/sda3 /mnt

Verify contents with ls /mnt. If only vmlinuz or grub files appear, you mounted the wrong partition.

Step 5: Bind System Directories and Prepare chroot

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /run /mnt/run

Then enter chroot:

chroot /mnt /bin/bash
# or alternatives:
chroot /mnt /usr/bin/bash
chroot /mnt /bin/sh

Reset the Root Password

Once inside the chroot environment:

passwd root
sync
exit

Exiting returns you to the rescue environment.

Clean Up and Reboot

umount /mnt/dev /mnt/proc /mnt/sys /mnt/run 2>/dev/null
umount /mnt
reboot

Troubleshooting Tips for chroot Errors

  • Check architecture and libraries: file /mnt/bin/bash, ldd /mnt/bin/bash
  • Check RAID status: cat /proc/mdstat
  • Try /usr/bin/bash if /usr is separate
  • Use a full live CD matching your server’s CPU architecture

Conclusion

Most chroot failures are due to mounting the wrong partition or missing virtual filesystem binds. Mount the correct root, bind /dev, /proc, /sys, /run, chroot, reset the root password, and perform clean unmounts before rebooting.

Author: System Recovery Guide • Tags: chroot, rescue, linux, root-password, mount troubleshooting, system recovery

Christian – Linux & Mobile Developer

✍️ Christian H

Senior Linux administrator, web & mobile developer, and security strategist with over 10 years of experience. Specialized in live server recovery, DNS/SPF troubleshooting, and mobile-first web apps.

📡 Follow updates on Facebook or explore guides on CongoCloud.net.

Lisez Avant de Partir !

✅ Rejoignez plus de 6 000 organisations francophones 
🇫🇷 qui nous font déjà confiance.
  • Nous rendons l’hébergement web accessible
  • Équipement moderne pour un prix dérisoire
  • Votre participation nous aide à améliorer l’entrepreneuriat des personnes à faible revenu.
VOIR NOS OFFRES
close-link
// width=
Notre équipe de support client est sur WhatsApp pour répondre à vos questions. Demandez-nous n'importe quoi !