Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it safe to start services inside a chroot?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Jul 24, 2010 1:25 pm    Post subject: Is it safe to start services inside a chroot? Reply with quote

I've got a 32bit chroot install on my amd64 machine, and I want to have distccd running in it for my laptop.

I'm not sure how openrc will react in a chroot though, can I just do "rc-service distccd start" without side effects, or does it need to be run manually? Or even, does anyone know a better way to get a 32bit-gcc distcc working on it?
Back to top
View user's profile Send private message
lxg
Veteran
Veteran


Joined: 12 Nov 2005
Posts: 1019
Location: Aachen, Germany

PostPosted: Sat Jul 24, 2010 5:35 pm    Post subject: Reply with quote

I would say: no, it's not safe. About distcc, I don't know, but I'd say it's usually a bad idea.

Because services may uses specific files for interprocess communication (take for example /var/lock and /var/run … many services create files there to indicate that they're running).

For example: If you start Apache in the chroot, it will grab port 80 and create the file /var/run/apache2.pid, where it puts its process ID. Now if you try to start another Apache from outside the chroot, first thing it does is to check /var/run/apache2.pid for an already running process. It won't find this file, so it will try to start and grab port 80, but will fail with a cryptic error message.

This is only one example, and I haven't even verified it, but this is the kind of stuff that can happen.
_________________
lxg.de – codebits and tech talk
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9559
Location: beyond the rim

PostPosted: Fri Jul 30, 2010 3:39 am    Post subject: Reply with quote

The most obvious problem would likely be that openrc in the chroot wouldn't know which services are already running, so it would try to start basic stuff like networking as well (which is a bad idea).
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Fri Jul 30, 2010 7:29 am    Post subject: Reply with quote

though chroot-prison is (in general) a good idea security wise, it a bad idea to emulate an entire system inside a chroot...

secondly, distcc should support crosscomplie between archs, and therefore is no need in running it inside a chroot.
DistCC Guide, DistCC Crosscompile Guide

To be honest, I have not tried it.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Fri Jul 30, 2010 8:01 am    Post subject: Reply with quote

Veldrin wrote:


secondly, distcc should support crosscomplie between archs, and therefore is no need in running it inside a chroot.
DistCC Guide, DistCC Crosscompile Guide

To be honest, I have not tried it.


I'm doing this for a long time now and it works flawlessly. Definitely the way to go.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum