Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-06-2012, 08:14 AM   #1
LQ Newbie
Registered: Mar 2012
Posts: 7

Rep: Reputation: Disabled
chroot sandbox question

I decided to try something which I guess is strange, but I haven't been able to figure out why. Here is what I did.

mkdir -p /home/user/chroot/{bin,lib}
sudo mount --bind /bin /home/user/chroot/bin
sudo mount --bind /lib /home/user/chroot/lib
sudo chroot /home/user/chroot
I get the error:

chroot: failed to run command `/bin/bash': No such file or directory
The thing is /home/user/chroot/bin/bash exists since I bind mounted the directory.

In addition, there are procedures which bind mount proc and sys and then chroot into a livecd or something at which point proc and sys are available.

So basically, why doesn't the chroot know about the bind mounted /bin/bash? Why is this procedure I'm doing incorrect? I figure for what I'm doing I don't need proc or sys and that I would get other errors if not including them int he chroot was causing the problem.
Old 08-09-2012, 08:26 PM   #2
LQ 5k Club
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,827

Rep: Reputation: Disabled
assuming you have unpacked an iso or squashfile etc try this

su (or sudo su)
cd /home/user/chroot
mount --bind /proc proc && mount --bind /sys sys && mount --bind /dev dev && mount --bind /dev/pts dev/pts 
chroot .
Old 08-09-2012, 08:35 PM   #3
LQ Newbie
Registered: Mar 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
The point of this question is to avoid copying the literal programs into the chroot directory, thus saving space, when a sandbox build is required.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sandbox/Chroot Jail and Seperate Filesystem dman777 Linux - Security 1 05-05-2011 01:35 AM
[SOLVED] linux chroot safe to use for sandbox? linux_evangelist Linux - Security 1 02-23-2011 04:13 PM
Chroot - question ef_ Linux - Software 3 10-14-2004 05:57 AM
sandbox execution (compare to: chroot)? prell Linux - Software 1 09-23-2004 02:03 PM
chroot question akwida Linux From Scratch 8 11-05-2003 03:54 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration