Chroot Suggested Mounts for Rescue
Luke Hebert
- 2 minutes read - 264 wordsWhen a libvirt guest will not boot and you need to drop into its filesystem, the tricky part is getting all the mounts right before you chroot. virt-rescue can do the heavy lifting for you.
Getting the Suggested Mounts
Run virt-rescue in suggest mode against your guest. This prints the exact mount commands you need without actually starting a session:
virt-rescue --suggest -d instance-000086e2For a typical single-disk guest you will see output like this:
mount /dev/vda1 /mnt/sysroot/
mount --bind /dev /mnt/sysroot/dev
mount --bind /dev/pts /mnt/sysroot/dev/pts
mount --bind /proc /mnt/sysroot/proc
mount --bind /sys /mnt/sysroot/sysCopy those commands into your shell (or a script) and run them in order. Once the filesystem is mounted, you can chroot into it:
chroot /mnt/sysrootStarting an Interactive Rescue Session
If you prefer virt-rescue to handle the mounts and drop you straight into a shell, skip the manual steps and launch an interactive session:
virt-rescue -d instance-000086e2This gives you a minimal shell inside the guest with /dev, /proc, and /sys already bound. You can edit configs, reset passwords, or inspect logs, then exit when you are done.
Replace instance-000086e2 with the actual domain name or UUID of your guest. You can list available domains with virsh list --all.
A Few Tips
- Run virt-rescue as root or a user in the
libvirtgroup. - If the guest uses LVM or a logical volume, the suggest output will include the appropriate device path instead of a raw partition.
- After you are done, unmount in reverse order or simply reboot the guest; libvirt will release the disk.