systemd-cron: cron-failure@.service outputs "Unit cron\x2ddaily.service could not be found"

cron-failure@.service emails “Unit cron\x2ddaily.service could not be found” when a script in cron.daily fails.

It comes from this line: https://github.com/systemd-cron/systemd-cron/blob/d6c33def3ad1787e848faa6eed360c7ffe3ccc49/src/bin/mail_for_job.sh#L100 because $unit is still escaped after being passed through from cron-failure@.service.

Version: 2.2.0 OS: Gentoo

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 20 (13 by maintainers)

Commits related to this issue

Most upvoted comments

If OP can repro this by doing echo; sleep; exit instead of echo; exit then I’d say this is just a systemd bug and the sd-cron issue is fixed.

Yep this works, I’m happy blaming systemd.

I don’t know how Gentoo manage USE flags: to they retain the old settings that were sets years ago forever even if it’s not the recommended ones anymore ?

It just passes --enable-runparts to the configure script and also ensures debianutils is installed (I assume that’s the package that contains the run-parts script itself).

The build file is here for v2.3.0: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-process/systemd-cron/systemd-cron-2.3.0-r2.ebuild

@daviessm can you try the runparts mode with https://github.com/systemd-cron/systemd-cron/commit/484b0e7309cd9aa7f19ab6cf55af481629ad0788?

Yes, but give me a few days.

With --enable-runparts, the fixed cron-{monthly|...}.service units have

OnFailure=cron-mail@cron\x2dmonthly.service

but the normally-generated units have On%s=cron-mail@%%n:%s, so OnFailure=cron-mail@%n:Failure, which expands to OnFailure=cron-zfsutils-linux-root-0.service:Failure, so this is definitely an issue with the runparts mode.

@daviessm can you try the runparts mode with 484b0e7309cd9aa7f19ab6cf55af481629ad0788?