Using proc in chroot environments
Hi all :)
I'm using a chroot environment on my main disk as a 'crash test
dummy', and I need to access the proc filesystem inside it. Since hard links are not allowed for directories, the only solution I can think of is to mount proc inside the chroot environment just after chrooting. This works, I've tested, but I have two problems:
- Any change in the chroot proc happens too in the main one (like
using /proc/sys/kernel variables). Not a big deal, since I want the chroot environment to mimic the main filesystem where the original proc is mounted, but is annoying.
- I must mount copies of devpts, usbfs, etc... under the 'second'
proc, too, and this is even more annoying.
The perfect solution for me is to hardlink the proc directory of
the chrooted environment to the proc directory on the true root dir, but since this is not possible, whan can I do instead of remounting a second copy of proc (which, by the way, makes /proc/mounts a little bit weird...)?
Thanks a lot in advance :))
Raúl Núñez de Arenas Coronado
Signature · 2 lines
Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Ville :)
* Ville Herva <[email protected]> dixit:
Quoted 3 lines
Quoted 2 lines
- I must mount copies of devpts, usbfs, etc... under the 'second'
proc, too, and this is even more annoying.Mount them under /.../chroot/proc ? Hm.
That's what I'm doing right now (well I mount them under the /dev
directory of the chroot environment ;)
Quoted 7 lines
Quoted 5 lines
The perfect solution for me is to hardlink the proc directory of
the chrooted environment to the proc directory on the true root dir, but since this is not possible, whan can I do instead of remounting a second copy of proc (which, by the way, makes/proc/mountsa little bit weird...)?mount --bind is closest to hardlink you can get and it works. But I don't know if that is that much different from mounting proc second time.
For other filesystems I don't know, for proc is more or less the
same, except maybe that --bind maybe doesn't show proc mounted twice :???
Thanks :))
Raúl Núñez de Arenas Coronado
Signature · 2 lines
Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/
Quoted 11 lines · DervishD
I'm using a chroot environment on my main disk as a 'crash test
dummy', and I need to access the proc filesystem inside it. Since hard links are not allowed for directories, the only solution I can think of is to mount proc inside the chroot environment just after chrooting. This works, I've tested, but I have two problems:
...
The perfect solution for me is to hardlink the proc directory of
the chrooted environment to the proc directory on the true root dir, but since this is not possible, whan can I do instead of remounting a second copy of proc (which, by the way, makes/proc/mountsa little bit weird...)?
It sounds to me, as if you want something like UML... :-)
chroot environments are traditionally quite minimal, meaning that they usually don't require /dev/pts, /proc, etc.
One approach that I have seen taken, is for privileged information to be queried through a non-chroot'ed process by the chroot'ed process.
mark
Signature · 9 lines
[email protected]/[email protected]/[email protected] __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/
Hi Mark :)
* Mark Mielke <[email protected]> dixit:
Quoted 3 lines
Quoted 2 lines
I'm using a chroot environment on my main disk as a 'crash test
dummy', and I need to access the proc filesystem inside it. SinceIt sounds to me, as if you want something like UML... :-)
More or less. It's just the chroot is easier for me, but I would
like to test UML someday O:))
Quoted 2 lines
chroot environments are traditionally quite minimal, meaning that they usually don't require
/dev/pts, /proc, etc.
I know, but I think that UML is unnecessarily complex for me. I
can go with just a chrooted env.
Raúl Núñez de Arenas Coronado
Signature · 2 lines
Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/
Hi ;),
Quoted 5 lines
I'm using a chroot environment on my main disk as a 'crash test
dummy', and I need to access the proc filesystem inside it. Since hard links are not allowed for directories, the only solution I can think of is to mount proc inside the chroot environment just after chrooting. This works, I've tested, but I have two problems:
Have you tried the --bind mount option? It's great to solve this kind of problem, accesing to a directory within a chrooted enviroment. I've used it successly with a ftp server ;).
Signature · 4 lines
David Gómez "The question of whether computers can think is just like the question of whether submarines can swim." -- Edsger W. Dijkstra
Hi David :)
* David <[email protected]> dixit:
Quoted 8 lines
Quoted 5 lines
I'm using a chroot environment on my main disk as a 'crash test
dummy', and I need to access the proc filesystem inside it. Since hard links are not allowed for directories, the only solution I can think of is to mount proc inside the chroot environment just after chrooting. This works, I've tested, but I have two problems:Have you tried the --bind mount option? It's great to solve this kind of problem, accesing to a directory within a chrooted enviroment. I've used it successly with a ftp server ;).
I haven't tried, but I'm afraid it won't solve my problem. First,
if I do a 'binded' mount of /proc, any change in the chrooted proc will reflect in the original one, so I'm in trouble anyway. Second, if I do 'mount' or 'cat /proc/mounts' the proc filesystem will be shown twice anyway (correct me here if I'm wrong).
By now I'm going to keep using two independent mounts until I
find a better approach... Thanks for your answer :)
Raúl Núñez de Arenas Coronado
Signature · 2 lines
Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/