8

Most of the time I use chroot to rescue an existing installation from usb.

When I chroot into another system I have to manually bind-mount proc, sys, dev and dev/pts by issuing for example:

mount --bind /proc proc/

Is there an easy way already implemented in a standard Ubuntu install?

1 Answer 1

12

See the schroot package. Man Page

As an alternative, you can shorthand the bind mounting with:

for f in proc sys dev ; do mount --bind /$f /mnt/$f ; done
12
  • 1
    You could add references to the manual page and provide examples.
    – Lekensteyn
    Mar 28, 2011 at 17:42
  • well... that's kindof why I asked about the standard Ubuntu install. Of course there exist tools that do that. But is it as simple as sudo apt-get install schroot && schroot /dest ?
    – turbo
    Mar 28, 2011 at 17:54
  • 1
    @turbo in that case, no. One thing that can help save some typing though is rather than issue 3 separate bind mount commands, you can just do "for f in /sys /proc /dev ; do mount --bind $f /mnt/$f ; done"
    – psusi
    Mar 28, 2011 at 19:16
  • 4
    @turbo, @psusi --bind only mounts the specific named filesystem; it won't include pts or for that matter shm. However if you use mount --rbind it will work.
    – poolie
    Apr 12, 2011 at 2:33
  • 1
    @psusi, you'll probably need to manually umount the things inside it before you can unmount /dev. If that doesn't work, yes, it's a bug. screen would be an example of something that needs a pseudoterminal from /dev/pts, though it might fall back to putting them just under /dev/.
    – poolie
    Apr 13, 2011 at 0:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .