Distccd daemon fails to start due to a permission error with it's temporary directory. This is because the daemon gets started with user "distcc" but tries to access root's temporary directory, so it fails instantaneously due to a permission error. Reproducible: Always Steps to Reproduce: 1. install sys-devel/distcc-3.1-r5 2. run /etc/init.d/distccd start 3. look in syslog for the error message Actual Results: Syslog shows: (main) ERROR: failed to chdir to /tmp/.private/root: Permission denied (dcc_exit) exit: code 107; self: 0.000000 user 0.000000 sys; children: 0.000000 user 0.000000 sys Expected Results: The daemon should use the correct directory and start successfully. A short investigation lead me to an environment problem - /etc/init.d/distccd gets startet as root, so $TMP points to /tmp.private/root - start-stop-daemon starts distccd as root (still using root's environment) but the "--user distcc" switch (after the double hyphen) tells distccd to switch user to distcc - now distccd tries to access it's $TMP directory which does not belong to it and fails To keep the long story short, my solution is to move the "--user distcc" argument before the double hyphen (--), so start-stop-daemon switches user and envrionment correctly
thanks for solution! this bug was quite frustrating. now, if only somebody would read those bug-reports, at least...
(In reply to comment #0) > Steps to Reproduce: > 1. install sys-devel/distcc-3.1-r5 > 2. run /etc/init.d/distccd start > 3. look in syslog for the error message > Actual Results: > Syslog shows: > > (main) ERROR: failed to chdir to /tmp/.private/root: Permission denied > (dcc_exit) exit: code 107; self: 0.000000 user 0.000000 sys; children: 0.000000 > user 0.000000 sys > > Expected Results: > The daemon should use the correct directory and start successfully. Hello, I just did try the steps mentioned above but I'm unable to reproduce this bug, it seems that for me it doesn't try to switch to /tmp/.private/root Do you have any special config set somewhere about this, mind you give us also a copy of your emerge --info just in case ? Am I missing something ? Here are the logs I get fyi : Nov 14 13:38:59 distccd (debug): (main) chdir to /tmp Nov 14 13:38:59 distccd (info): (dcc_setup_daemon_path) daemon's PATH is /usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin Nov 14 13:38:59 distccd (info): (dcc_listen_by_addr) listening on 0.0.0.0:3632 Nov 14 13:38:59 distccd (debug): (dcc_defer_accept) TCP_DEFER_ACCEPT turned on Nov 14 13:38:59 distccd (info): (dcc_standalone_server) 6 CPUs online on this server Nov 14 13:38:59 distccd (info): (dcc_standalone_server) allowing up to 8 active jobs Nov 14 13:38:59 distccd (debug): (dcc_ignore_sighup) ignoring SIGHUP Nov 14 13:38:59 distccd (debug): (dcc_detach) setsid to session 14827 Nov 14 13:38:59 distccd (info): (dcc_log_daemon_started) preforking daemon started (3.1 x86_64-pc-linux-gnu, built Nov 14 2011 13:32:24) Nov 14 13:38:59 distccd (debug): (dcc_create_kids) up to 1 children Nov 14 13:39:00 distccd (debug): (dcc_create_kids) up to 2 children Nov 14 13:39:01 distccd (debug): (dcc_create_kids) up to 3 children Nov 14 13:39:02 distccd (debug): (dcc_create_kids) up to 4 children Nov 14 13:39:03 distccd (debug): (dcc_create_kids) up to 5 children Nov 14 13:39:04 distccd (debug): (dcc_create_kids) up to 6 children Nov 14 13:39:05 distccd (debug): (dcc_create_kids) up to 7 children Nov 14 13:39:06 distccd (debug): (dcc_create_kids) up to 8 children
Looks like my $TMP is other than yours, my one's points to /tmp/.private/$USER which makes me think it's somehow related to sys-auth/pam_mktemp-1.1.1, which is installed on my system.
The bug hit me in a slightly different way: start-stop-daemon seems to start services as "nobody" here and sets the env accordingly. distccd then tries to access /tmp/.private/nobody and fails, like you described. I thus changed the init.d file from: --- start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" -- \ --daemon --pid-file "${DISTCCD_PIDFILE}" --user distcc \ ${DISTCCD_OPTS} --- to: --- start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" --user distcc -- \ --daemon --pid-file "${DISTCCD_PIDFILE}" --user distcc \ ${DISTCCD_OPTS} --- (note the --user argument to s-s-d) which made it work.
Bug confired on my box, thanks for solution
I've mailed Takuto about this before taking action, let's give him a week before I modify the init script myself. Cheers
Timeout. I added the change to the 3.1 series. Thanks to all for your help and patience. + 27 Dec 2011; Ultrabug <ultrabug@gentoo.org> files/3.1/init: + Fix 3.1 series init script wrt #390063 thanks to André-Sebastian Liebe. +