Bug 1372978

Summary: ddclient systemd service does not start properly due to incorrect ownership of /var/cache/ddclient/ddclient.cache
Product: [Fedora] Fedora Reporter: John O'Dwyer <johnrory.odwyer>
Component: ddclientAssignee: Scott Talbert <swt>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: alin, i, jrowens.fedora, swt, thomas
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-29 16:12:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John O'Dwyer 2016-09-04 12:02:23 UTC
Description of problem:

systemd is unable to start the ddclient service

Version-Release number of selected component (if applicable):

ddclient-3.8.3-1.fc24.noarch

How reproducible:

Easily reproducible

Steps to Reproduce: 

Run the following:

systemctl status ddclient.service

Actual results:

● ddclient.service - A Perl Client Used To Update Dynamic DNS
   Loaded: loaded (/usr/lib/systemd/system/ddclient.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2016-09-04 12:17:39 IST; 6s ago
  Process: 2479 ExecStartPre=/bin/touch /var/cache/ddclient/ddclient.cache (code=exited, status=1/FAILURE)

Sep 04 12:17:39 laptop systemd[1]: Starting A Perl Client Used To Update Dynamic DNS...
Sep 04 12:17:39 laptop touch[2479]: /bin/touch: cannot touch '/var/cache/ddclient/ddclient.cache': Permission denied
Sep 04 12:17:39 laptop systemd[1]: ddclient.service: Control process exited, code=exited status=1
Sep 04 12:17:39 laptop systemd[1]: Failed to start A Perl Client Used To Update Dynamic DNS.
Sep 04 12:17:39 laptop systemd[1]: ddclient.service: Unit entered failed state.
Sep 04 12:17:39 laptop systemd[1]: ddclient.service: Failed with result 'exit-code'.


Expected results:

Service should start

Additional info:

see previous bug https://bugzilla.redhat.com/show_bug.cgi?id=860310

Comment 1 John O'Dwyer 2016-09-04 12:59:07 UTC
Also as stated in previous bug 860310

Remove in /etc/sysconfig/ddclient the line:

DDCLIENT_OPTIONS="-daemon 300"

because the default config file in /etc/ddclient.conf already has

daemon=300


Changing the time in /etc/ddclient.conf has no effect as the setting in /etc/sysconfig/ddclient overrides the setting in the config file!

If you want to demonstrate the use of /etc/sysconfig/ddclient, then better use instead the default config file location:

DDCLIENT_OPTIONS="-file /etc/ddclient.conf"

because this setting is independent of the settings in the config file.

Comment 2 Scott Talbert 2016-09-05 02:41:05 UTC
I am not able to reproduce this.

[talbert@easel ~]$ sudo ls -ld /var/cache/ddclient
ls: cannot access '/var/cache/ddclient': No such file or directory

[talbert@easel ~]$ sudo dnf install ddclient
Last metadata expiration check: 2:17:58 ago on Sun Sep  4 20:12:59 2016.
Dependencies resolved.
================================================================================
 Package                 Arch          Version              Repository     Size
================================================================================
Installing:
 ddclient                noarch        3.8.3-1.fc24         fedora         64 k
 perl-Digest-SHA1        x86_64        2.13-17.fc24         fedora         55 k

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 120 k
Installed size: 316 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): perl-Digest-SHA1-2.13-17.fc24.x86_64.rpm 360 kB/s |  55 kB     00:00    
(2/2): ddclient-3.8.3-1.fc24.noarch.rpm         380 kB/s |  64 kB     00:00    
--------------------------------------------------------------------------------
Total                                           108 kB/s | 120 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : perl-Digest-SHA1-2.13-17.fc24.x86_64                        1/2 
  Installing  : ddclient-3.8.3-1.fc24.noarch                                2/2 
  Verifying   : ddclient-3.8.3-1.fc24.noarch                                1/2 
  Verifying   : perl-Digest-SHA1-2.13-17.fc24.x86_64                        2/2 

Installed:
  ddclient.noarch 3.8.3-1.fc24       perl-Digest-SHA1.x86_64 2.13-17.fc24      

Complete!

[talbert@easel ~]$ sudo ls -ld /var/cache/ddclient
drwx------. 2 ddclient ddclient 4096 Mar 31 22:58 /var/cache/ddclient

[talbert@easel ~]$ systemctl status ddclient
● ddclient.service - A Perl Client Used To Update Dynamic DNS
   Loaded: loaded (/usr/lib/systemd/system/ddclient.service; disabled; vendor pr
   Active: active (running) since Sun 2016-09-04 22:35:39 EDT; 1min 34s ago
  Process: 25254 ExecStart=/usr/sbin/ddclient $DDCLIENT_OPTIONS (code=exited, st
  Process: 25246 ExecStartPre=/bin/touch /var/cache/ddclient/ddclient.cache (cod
 Main PID: 25255 (ddclient - slee)
    Tasks: 1 (limit: 512)
   CGroup: /system.slice/ddclient.service
           └─25255 ddclient - sleeping for 210 second

Comment 3 Scott Talbert 2016-10-29 16:12:13 UTC
Closing due to lack of reproducibility and/or further clarification from the originator.

Comment 4 Al O 2016-12-30 04:38:17 UTC
daemon=300 configuration was indeed a problem. Additionally, when running ddclient in debug mode for the initial configuration validation, it creates /var/cache/ddclient/ddclient.cache that prevents service (re)start:

-- Unit ddclient.service has begun starting up.
Dec 30 15:07:24 iceberg.sol.id.au touch[24403]: /bin/touch: cannot touch ‘/var/cache/ddclient/ddclient.cache’: Permission denied
Dec 30 15:07:24 iceberg.sol.id.au systemd[1]: ddclient.service: control process exited, code=exited status=1
Dec 30 15:07:24 iceberg.sol.id.au systemd[1]: Failed to start A Perl Client Used To Update Dynamic DNS.
-- Subject: Unit ddclient.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ddclient.service has failed.

Simply removing /var/cache/ddclient/ddclient.cache allows systemctl (re)start without any problems.

Comment 5 Scott Talbert 2016-12-30 16:42:25 UTC
(In reply to Al O from comment #4)
> daemon=300 configuration was indeed a problem. Additionally, when running
> ddclient in debug mode for the initial configuration validation, it creates
> /var/cache/ddclient/ddclient.cache that prevents service (re)start:
> 
> -- Unit ddclient.service has begun starting up.
> Dec 30 15:07:24 iceberg.sol.id.au touch[24403]: /bin/touch: cannot touch
> ‘/var/cache/ddclient/ddclient.cache’: Permission denied
> Dec 30 15:07:24 iceberg.sol.id.au systemd[1]: ddclient.service: control
> process exited, code=exited status=1
> Dec 30 15:07:24 iceberg.sol.id.au systemd[1]: Failed to start A Perl Client
> Used To Update Dynamic DNS.
> -- Subject: Unit ddclient.service has failed
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit ddclient.service has failed.
> 
> Simply removing /var/cache/ddclient/ddclient.cache allows systemctl
> (re)start without any problems.

What do you mean by 'running ddclient in debug mode' - did you run it as root and that's how the /var/cache/ddclient/ddclient.cache file got created with incorrect permissions?

Comment 6 Al O 2017-01-02 09:38:58 UTC
Yes, running 'sudo ddclient -daemon=0 -noquiet -debug' will create /var/cache/ddclient/ddclient.cache, owned by root, which will stop systemctl from starting the service.
Thanks