Quick chroot

Shell Script

I created a quick simple shell script to help you run chroot without having to type in all the commands to ensure it works.  Just follow the instructions and you’ll be on your way to running programs on another hard drive.  There are a few things to note when chrooting to something:

  • You must be running the same architecture as the device you are chrooting to.  So a x86-64 system can’t chroot into a PPC system.
  • If you want to fix something like grub or reinstall a kernel from chroot, it is highly recommended that you not do this when the drive names are the same.  So for example, if the system failing to boot used to boot from /dev/sda, you should make sure that the chrooted system mounts this drive as /dev/sda.  I personally recommend you run this script from a live CD which can easily avoid this conflict.
  • The /dev, /sys, and /proc folders will be replaced.  Not that you should have anything stored in those anyway, but if you do you might want to back them up.
See other Linux Utilities

One Response to Quick chroot

  1. Your script doesn’t mount additional partitions like /boot, /usr or /home. I suggest you making an /etc/fstab parser to automount them.

Your Feedback