zhaofengli/colmena

key.service fails, when key's parent directory does not exist

Opened this issue · 0 comments

I tend to push keys into scoped subdirectories below /run/keys.

For example my nameservers has its secrets below /run/keys/knot/. But that directory does not exist, until the key upload creates it.

The relevant ...-key.service fails, because inotifywait cannot watch a non-existent directory.

Couldn't watch /run/keys/knot: No such file or directory

By the time the key gets uploaded, the service already failed.

Full key.service log:

Aug 08 12:45:46 juno systemd[1]: Starting knot-tsig-keys.conf-key.service...
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-pre-start[693]: Couldn't watch /run/keys/knot: No such file or directory
Aug 08 12:45:46 juno systemd[1]: Started knot-tsig-keys.conf-key.service.
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-start[726]: flapped up
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-start[729]: Couldn't watch /run/keys/knot/knot-tsig-keys.conf: No such file or directory
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Deactivated successfully.
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Scheduled restart job, restart counter is at 1.
Aug 08 12:45:46 juno systemd[1]: Stopped knot-tsig-keys.conf-key.service.
Aug 08 12:45:46 juno systemd[1]: Starting knot-tsig-keys.conf-key.service...
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-pre-start[756]: Couldn't watch /run/keys/knot: No such file or directory
Aug 08 12:45:46 juno systemd[1]: Started knot-tsig-keys.conf-key.service.
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-start[762]: flapped up
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Deactivated successfully.
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Scheduled restart job, restart counter is at 2.
Aug 08 12:45:46 juno systemd[1]: Stopped knot-tsig-keys.conf-key.service.
Aug 08 12:45:46 juno systemd[1]: Starting knot-tsig-keys.conf-key.service...
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-pre-start[794]: Couldn't watch /run/keys/knot: No such file or directory
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Found left-over process 794 (inotifywait) in control group while starting unit. Ignoring.
Aug 08 12:45:46 juno systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Aug 08 12:45:46 juno systemd[1]: Started knot-tsig-keys.conf-key.service.
Aug 08 12:45:46 juno knot-tsig-keys.conf-key-start[799]: flapped up
Aug 08 12:45:46 juno systemd[1]: knot-tsig-keys.conf-key.service: Deactivated successfully.
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Scheduled restart job, restart counter is at 3.
Aug 08 12:45:47 juno systemd[1]: Stopped knot-tsig-keys.conf-key.service.
Aug 08 12:45:47 juno systemd[1]: Starting knot-tsig-keys.conf-key.service...
Aug 08 12:45:47 juno knot-tsig-keys.conf-key-pre-start[824]: Couldn't watch /run/keys/knot: No such file or directory
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Found left-over process 824 (inotifywait) in control group while starting unit. Ignoring.
Aug 08 12:45:47 juno systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Aug 08 12:45:47 juno systemd[1]: Started knot-tsig-keys.conf-key.service.
Aug 08 12:45:47 juno knot-tsig-keys.conf-key-start[826]: flapped up
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Deactivated successfully.
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Scheduled restart job, restart counter is at 4.
Aug 08 12:45:47 juno systemd[1]: Stopped knot-tsig-keys.conf-key.service.
Aug 08 12:45:47 juno systemd[1]: Starting knot-tsig-keys.conf-key.service...
Aug 08 12:45:47 juno knot-tsig-keys.conf-key-pre-start[839]: Couldn't watch /run/keys/knot: No such file or directory
Aug 08 12:45:47 juno systemd[1]: Started knot-tsig-keys.conf-key.service.
Aug 08 12:45:47 juno knot-tsig-keys.conf-key-start[842]: flapped up
Aug 08 12:45:47 juno knot-tsig-keys.conf-key-start[843]: Couldn't watch /run/keys/knot/knot-tsig-keys.conf: No such file or directory
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Deactivated successfully.
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Scheduled restart job, restart counter is at 5.
Aug 08 12:45:47 juno systemd[1]: Stopped knot-tsig-keys.conf-key.service.
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Start request repeated too quickly.
Aug 08 12:45:47 juno systemd[1]: knot-tsig-keys.conf-key.service: Failed with result 'start-limit-hit'.
Aug 08 12:45:47 juno systemd[1]: Failed to start knot-tsig-keys.conf-key.service.