# DDClient init service keeps stopping

## xevix

For some unexplained reason, my ddclient init script keeps stopping, and then i have to start it up again  manually.  When it's on, it does its job, but then it just seems to shut off and I can't figure out why, I don't know what logs to investigate etc.  Help please.

----------

## PaulBredbury

There's debugging info at the bottom of the homepage.

----------

## chovy

After a poweroutage, when my computer comes back online, ddclient does not boot up. I am seeing these errors: 

I'm using Gentoo and have ddclient added to my default runlevel (If I manually restart it, it then works fine until I have to reboot again). 

Here is from /var/log/messages: 

 *Quote:*   

> 
> 
> Apr 2 19:40:59 hostname ddclient[6269]: WARNING: file /etc/ddclient/ddclient.conf: file /etc/ddclient/ddclient.conf must be accessible only by its owner. 
> 
> Apr 2 19:40:59 hostname ddclient[6269]: WARNING: file /etc/ddclient/ddclient.cache: Cannot open file '/etc/ddclient/ddclient.cache'. (Permission denied) 
> ...

 

----------

## PaulBredbury

 *chovy wrote:*   

> (If I manually restart it, it then works fine until I have to reboot again). 

 

That's the difference between root and ddclient user. Notice "--chuid ddclient" in /etc/init.d/ddclient

 *Quote:*   

> WARNING: file /etc/ddclient/ddclient.conf: file /etc/ddclient/ddclient.conf must be accessible only by its owner. 

 

Read pkg_postinst() in /usr/portage/net-dns/ddclient/ddclient-3.6.6.ebuild

----------

## chovy

thanks, the /etc/init.d/ddclient script gave some pointers.

What I had to do to get ddclient to start on boot:

rc-update add ddclient default

```

touch /etc/ddclient/ddclient.cache

chmod 660 /etc/ddclient/ddclient.cache

chmod 640 /etc/ddclient/ddclient.conf

chmod 750 /etc/ddclient

chown -R root:ddclient /etc/ddclient

```

The goal here is to get it readable by root and ddclient (group) only. ddclient.cache needs the +w for group bit set.

Reboot, and watch.

For debugging the /etc/init.d/ddclient script:

```
change:

start-stop-daemon --start --chuid ddclient --quiet --exec /usr/sbin/ddclient 2&>/dev/null

to:

start-stop-daemon --start --chuid ddclient --quiet --exec /usr/sbin/ddclient #2&>/dev/null

(so you can see error messages)

```

/usr/portage/net-dns/ddclient/ddclient-3.6.6.ebuild should be updated to include the above steps, notable the ddclient.cache needs to be writable by group (ddclient), otherwise it will fail on boot.

----------

## PaulBredbury

 *chovy wrote:*   

> ddclient-3.6.6.ebuild should be updated to include the above steps, notable the ddclient.cache needs to be writable by group (ddclient), otherwise it will fail on boot.

 

I agree. I thought it was stupid when I encountered it a year ago, and I still think it's stupid now. The ebuild should finish off the job of setting these trivially-easy permissions. I'll write the patch and submit it to bugzilla, and post the bugzilla entry here once it's done.

----------

## PaulBredbury

Here is a nice and simple ebuild which works and fixes the permissions  :Smile: 

Put it in your local overlay. The newbie steps to do this are:

```
echo 'PORTDIR_OVERLAY="/usr/local/portage"' >> /etc/make.conf

pkg="net-dns/ddclient"

p="ddclient-3.7.0"

mkdir -p "/usr/local/portage/${pkg}/files"

cd "/usr/local/portage/${pkg}/files"

wget -q -O ddclient.confd http://bugs.gentoo.org/attachment.cgi?id=84417

wget -q -O ddclient.initd http://bugs.gentoo.org/attachment.cgi?id=95055

wget -q -O ddclient-reasonable-security.patch http://bugs.gentoo.org/attachment.cgi?id=84467

cd ..

wget -q -O "${p}.ebuild" http://bugs.gentoo.org/attachment.cgi?id=95056

ebuild "${p}.ebuild" digest

echo "${pkg}" >> /etc/portage/package.keywords

emerge "${pkg}"
```

Edit: This script is no longer required, because the ebuild is in Portage.

----------

