How to enable /dev and /proc in a chroot

I use chroot all the time to rescue or build a linux machine. One niggling problem is that /dev/ and /proc are not propagated automatically to the chroot environment. To solve this do the following before running chroot

mount --bind /dev /path/to/chroot/dev
mount --bind /proc /path/to/chroot/proc

Then you can chroot:

chroot /path/to/chroot/ bash

Pretty simple trick but a useful one.

Syndicate content