Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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/

Now is there an easy way allready implemeted in a standard Ubuntu install? I am asking about the standard install because most of the time I use the chroot to rescue an existing installation from usb.

share|improve this question

1 Answer

up vote 3 down vote accepted

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
share|improve this answer
1  
You could add references to the manual page and provide examples. – Lekensteyn Mar 28 '11 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 '11 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 '11 at 19:16
yeah that's a good one. I knew and forgot about one line bash 'scripts'. I just seems kind of obvious from Ubuntu's point of view to include something like this in their rescue menu. – turbo Mar 28 '11 at 19:52
2  
@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 '11 at 2:33
show 7 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.