filiparag / hetzner_ddns

Hetzner Dynamic DNS (DDNS, DynDNS) daemon
BSD 2-Clause "Simplified" License
49 stars 8 forks source link

Problem installing on Raspberry Pi #11

Closed SatIPwithRPi closed 7 months ago

SatIPwithRPi commented 7 months ago

Hello, thanks for the code, that's exactly what I'm looking for! Sorry, I'm kind of a n00b here. I sucessfully installed it on one Raspberry Pi, but on the other one I get the following error:

Job for hetzner_ddns.service failed because the control process exited with error code.
See "systemctl status hetzner_ddns.service" and "journalctl -xe" for details.

where status yields:

● hetzner_ddns.service - Hetzner Dynamic DNS
     Loaded: loaded (/etc/systemd/system/hetzner_ddns.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-02-10 11:55:00 CET; 5s ago
       Docs: man:hetzner_ddns(1)
    Process: 17068 ExecStartPre=/usr/bin/touch /var/log/hetzner_ddns.log (code=exited, status=0/SUCCESS)
    Process: 17069 ExecStartPre=/usr/bin/chown daemon:root /var/log/hetzner_ddns.log (code=exited, status=203/EXEC)`

and journalctl:
`Feb 10 11:56:32 openpihole systemd[17123]: hetzner_ddns.service: Failed at step EXEC spawning /usr/bin/chown: No such file or>
░░ Subject: Process /usr/bin/chown could not be executed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The process /usr/bin/chown could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Feb 10 11:56:32 openpihole systemd[1]: hetzner_ddns.service: Control process exited, code=exited, status=203/EXEC
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStartPre= process belonging to unit hetzner_ddns.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 203.
Feb 10 11:56:32 openpihole systemd[1]: hetzner_ddns.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit hetzner_ddns.service has entered the 'failed' state with result 'exit-code'.
Feb 10 11:56:32 openpihole systemd[1]: Failed to start Hetzner Dynamic DNS.
░░ Subject: A start job for unit hetzner_ddns.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit hetzner_ddns.service has finished with a failure.
░░
░░ The job identifier is 1018797 and the job result is failed.

Do you have any idea on how to solve this? Thanks!

filiparag commented 7 months ago

Which version of Raspbian OS are you running? You can obtain this info using the following command:

cat /etc/os-release
SatIPwithRPi commented 7 months ago

Hi, thanks for the reply; both installations were on Raspbian 11 bullseye; one worked, the other didn't - although it could be iirc that the one where it failed was manually upgraded from an older version; maybe something went wrong there?

SatIPwithRPi commented 7 months ago

update: maybe that helps? when stopped, status yields:

Feb 10 16:58:24 openpihole systemd[1]: Failed to start Hetzner Dynamic DNS.
Feb 10 16:58:35 openpihole systemd[1]: hetzner_ddns.service: Scheduled restart job, restart counter is at 3.
Feb 10 16:58:35 openpihole systemd[1]: Stopped Hetzner Dynamic DNS.
Feb 10 16:58:35 openpihole systemd[1]: Starting Hetzner Dynamic DNS...
Feb 10 16:58:35 openpihole systemd[929]: hetzner_ddns.service: Failed to locate executable /usr/bin/chown: No such file or directory
Feb 10 16:58:35 openpihole systemd[929]: hetzner_ddns.service: Failed at step EXEC spawning /usr/bin/chown: No such file or directory
Feb 10 16:58:35 openpihole systemd[1]: hetzner_ddns.service: Control process exited, code=exited, status=203/EXEC
Feb 10 16:58:35 openpihole systemd[1]: hetzner_ddns.service: Failed with result 'exit-code'.
Feb 10 16:58:35 openpihole systemd[1]: Failed to start Hetzner Dynamic DNS.
Feb 10 16:58:41 openpihole systemd[1]: Stopped Hetzner Dynamic DNS.

so what's the problem with /usr/bin/chown ?

filiparag commented 7 months ago

Yeah, it looks that way. I'm not sure why it would be missing or located in another directory, but you can get its path by running one of the following commands:

command -v chown
which chown

If it's located in another directory you can link it to /usr/bin, or modify hetzner_ddns's service file to point to the correct path on your system.

SatIPwithRPi commented 7 months ago

wow, I'm sorry if that is very low key support but at least I'm learning a lot. So I successfully created a softlink to chown. (to /bin/chown, thats the path on my system) That seems to have worked, but now I still have an issue with permissions, I guess:

Feb 10 18:34:55 openpihole systemd[1]: hetzner_ddns.service: Scheduled restart job, restart counter is at 27.
Feb 10 18:34:55 openpihole systemd[1]: Stopped Hetzner Dynamic DNS.
Feb 10 18:34:55 openpihole systemd[1]: Starting Hetzner Dynamic DNS...
Feb 10 18:34:55 openpihole systemd[1]: Started Hetzner Dynamic DNS.
Feb 10 18:34:55 openpihole hetzner_ddns[4711]: [2024-02-10 18:34:55] Started Hetzner DDNS daemon
Feb 10 18:34:55 openpihole hetzner_ddns[4714]: [2024-02-10 18:34:55] Error: unable to read configuration file /usr/local/etc/hetzner_ddns.conf
Feb 10 18:34:55 openpihole hetzner_ddns[4707]: Error: unable to read configuration file /usr/local/etc/hetzner_ddns.conf
Feb 10 18:34:55 openpihole systemd[1]: hetzner_ddns.service: Main process exited, code=exited, status=78/CONFIG
Feb 10 18:34:55 openpihole systemd[1]: hetzner_ddns.service: Failed with result 'exit-code'.
Feb 10 18:34:57 openpihole systemd[1]: Stopped Hetzner Dynamic DNS.

The configuration file is there and contains the correct information; but what should the permissions be?

-rw-r----- 1 root staff 300 Feb 10 18:31 hetzner_ddns.conf

thanks!

filiparag commented 7 months ago

It expects daemon:root file owner, but it can be any other as long as it is readable by that user. I strongly suggest avoiding 777 permission, even though it will fix your problem. Also, check the permissions of the parent directory tree - all of them should allow listing and reading files by that user.

I am not sure whether daemon user exists on PiHole, but you can also modify the systemd service file to suit your needs.

SatIPwithRPi commented 7 months ago

yes! so I changed the conf file to daemon:root, now everything works. I have no clue why on the other system none of that was necessary, as I tought they'd be basically almost the same. Thanks a lot for the quick support and your patience with me!