Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 504368 - app-backup/bacula-5.2.13-r2 - systemctl start bacula-dir: Failed at step EXEC spawning /usr/sbin/bacula-dir: Permission denied
Summary: app-backup/bacula-5.2.13-r2 - systemctl start bacula-dir: Failed at step EXEC...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Beierlein
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 23:44 UTC by Fabian Köster
Modified: 2016-07-06 04:56 UTC (History)
1 user (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 Fabian Köster 2014-03-12 23:44:18 UTC
The Bacula director cannot be started using systemd:

# systemctl start bacula-dir
Job for bacula-dir.service failed. See 'systemctl status bacula-dir.service' and 'journalctl -xn' for details.


Journalctl -xn says:

Failed at step EXEC spawning /usr/sbin/bacula-dir: Permission denied

Systemd tries to execute /usr/sbin/bacula-dir as user 'bacula' (as configured in systemd unit file) but the permissions do not allow this:

# ls -la /usr/sbin/bacula-dir 
-rwxr-x--- 1 root root 516128 12. Mär 20:52 /usr/sbin/bacula-dir

My workaround is

chmod o+rx /usr/sbin/bacula-dir

After this, bacula-dir starts successfully.

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2014-04-05 06:45:46 UTC
The problem is not really in systemd side because the value for user comes from:
--with-dir-user=bacula

configure switch that is passed in src_configure :/
Comment 2 Thomas Beierlein gentoo-dev 2014-04-06 08:11:13 UTC
(In reply to Pacho Ramos from comment #1)
> The problem is not really in systemd side because the value for user comes
> from:
> --with-dir-user=bacula
> 
> configure switch that is passed in src_configure :/

Hmm. Very good question here. 

That switch got changed back in 2006 (version 1.36.3-r3) from --with-dir-user=root to the actual value. No comments about that found in CVS or bugzilla. 

Normally bacula-dir gets still started as user=root, group=bacula (see conf.d/bacula-dir) so maybe it was just a typo. But let me check the sources to get an idea about possible consequences of changing it back to 'root'
Comment 3 Thomas Beierlein gentoo-dev 2014-04-06 08:42:54 UTC
(In reply to Thomas Beierlein from comment #2)
> (In reply to Pacho Ramos from comment #1)
> > The problem is not really in systemd side because the value for user comes
> > from:
> > --with-dir-user=bacula
> > 
> > configure switch that is passed in src_configure :/
> 
> Hmm. Very good question here. 
> 
> That switch got changed back in 2006 (version 1.36.3-r3) from
> --with-dir-user=root to the actual value. No comments about that found in
> CVS or bugzilla. 
> 
> Normally bacula-dir gets still started as user=root, group=bacula (see
> conf.d/bacula-dir) so maybe it was just a typo. But let me check the sources
> to get an idea about possible consequences of changing it back to 'root'

No, it seems not to be only a typo. At the same time pkg_postinst() got changed to
chown /var/lib/bacula to bacula:bacula. Still we have to find out why.
Comment 4 Fabian Köster 2015-02-13 15:51:18 UTC
Bug is still present in app-backup/bacula-7.0.5-r1
Comment 5 Thomas Beierlein gentoo-dev 2016-06-23 05:37:23 UTC
During fix of bug 582442 I did some more historical digging up.

The change to --with-dir-user=bacula mentioned in comment 1 was introduced by a point in baculas manual "Running bacula as non-root user". As it showed up in bug 125729 shortly after it did not work. To fix the bug the /etc/conf.d/bacula-dir got changed to start bacula-dir as root:bacula again.

So from this time on all ebuilds use --with-dir-user=bacula but run bacula as root:bacula. That should be cleaned up in future.

Atm there is a test for bacula-7.4.0-r1 to run bacula-dir as root:bacula under systemd also. If that works it will be backported to all other version still in tree.
Comment 6 Thomas Beierlein gentoo-dev 2016-07-06 04:56:17 UTC
Backported fixes to bacula-5.2.13-r5 and bacula-7.0.5-r2.

> app-backup/bacula: Backport fixes from bug #584442 to let bacula-dir start under systemd