Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 390063 - sys-devel/distcc-3.1-r5: daemon fails to start due to chdir permission error
Summary: sys-devel/distcc-3.1-r5: daemon fails to start due to chdir permission error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: MATSUU Takuto (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-10 08:22 UTC by André-Sebastian Liebe
Modified: 2011-12-27 16:10 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description André-Sebastian Liebe 2011-11-10 08:22:20 UTC
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
Comment 1 Sergey Kondakov 2011-11-13 20:07:57 UTC
thanks for solution! this bug was quite frustrating.
now, if only somebody would read those bug-reports, at least...
Comment 2 Ultrabug gentoo-dev 2011-11-14 12:44:37 UTC
(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
Comment 3 André-Sebastian Liebe 2011-11-14 18:49:22 UTC
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.
Comment 4 Dennis Schridde 2011-11-18 08:46:05 UTC
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.
Comment 5 xiando 2011-12-03 06:20:42 UTC
Bug confired on my box, thanks for solution
Comment 6 Ultrabug gentoo-dev 2011-12-13 11:00:16 UTC
I've mailed Takuto about this before taking action, let's give him a week before I modify the init script myself.

Cheers
Comment 7 Ultrabug gentoo-dev 2011-12-27 16:10:50 UTC
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.
+