I ran into this earlier when upgrading a few packages, but when using distcc through ccache, builds would fail with an error along the lines of "ccache: failed to create /root/.ccache (Permission Denied)". To test, I used two of my machines, both running distcc-0.15 (and 0.14-r1 as well, to test) and ccache-1.9-r2. Using the /etc/init.d/distcc script installed with the emerge, the distccd daemon is chuid'd to the user 'nobody', but the environment variable HOME lingers, and ccache apparently uses it to create ~/.ccache/stats, even when run over distcc. This in practice causes the distccd daemon run as 'nobody' with the HOME environment of root to try to create /root/.ccache/stats. A solution was simple enough once testing it was the HOME environment causing the problem: append HOME="/tmp" to the front of the distccd init.d script. The diff is as follows: ----BEGIN----- --- /etc/init.d/distccd 2003-01-10 02:35:29.000000000 -0700 +++ /etc/init.d/._cfg0000_distccd 2003-01-10 02:44:39.000000000 -0700 @@ -7,7 +7,7 @@ start() { rm -rf /var/tmp/distccd.pid ebegin "Starting distccd" - HOME="/tmp" start-stop-daemon --start --quiet --startas /usr/bin/distccd \ + start-stop-daemon --start --quiet --startas /usr/bin/distccd \ -c nobody --pidfile /var/tmp/distccd.pid \ -- --pid-file /var/tmp/distccd.pid eend $? "Failed to Start distccd" -----END-----
Here's the problem I'm having with this....ccache doesn't have anything to do with distccd afaik...the cache is parsed and headers etc and sent via distcc on the machine doing the compiling. Distccd is the daemon on the "helper machines" and doesn't read ccache. Distcc is run as root on the compiling box, only distccd on the helper machines is setuid 'nobody'.
What was happening was that ccache was somehow being called on the remote distccd host, even though it wasn't storing any objects. So when ccache was called, it would try to create ~/.ccache, which was $HOME/.ccache The reason for ccache being called is because /usr/bin/ccache was listed in the PATH env before /usr/i686-pc-linux-gnu/gcc-bin/3.2 when distccd was started, and thus inherited. I suppose the best method to get around this would be to not set the HOME env, but rather set the PATH to be strictly /usr/i686-pc-linux-gnu/gcc-bin/3.2 So this would be the result to ensure distccd was started with only that path.. --- distccd.old 2003-01-11 23:50:55.000000000 -0700 +++ distccd 2003-01-11 23:48:40.000000000 -0700 @@ -7,7 +7,7 @@ start() { rm -rf /var/tmp/distccd.pid ebegin "Starting distccd" - start-stop-daemon --start --quiet --startas /usr/bin/distccd \ + PATH="/usr/i686-pc-linux-gnu/gcc-bin/3.2" /sbin/start-stop-daemon --start --quiet --startas /usr/bin/distccd \ -c nobody --pidfile /var/tmp/distccd.pid \ -- --pid-file /var/tmp/distccd.pid eend $? "Failed to Start distccd"
added your latest init script to distcc-1.0