When a cron job fails, the notification email is not sent. The fail notification sevice (ie. cron-failure@cron-lubos-lubos-0.service) fails on python errors. eselect python list Available Python interpreters, in order of preference: [1] python3.5 [2] python2.7 # emerge -pv systemd-cron These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-process/systemd-cron-1.5.12-r1::gentoo USE="-cron-boot -etc-crontab-systemd -minutely -setgid {-test} -yearly" PYTHON_SINGLE_TARGET="python3_5 -pypy3 -python3_4 -python3_6" PYTHON_TARGETS="python3_5 -pypy3 -python3_4 -python3_6" 0 KiB cron-failure@cron-lubos-lubos-0.service - systemd-cron OnFailure for cron-lubos-lubos-0 Loaded: loaded (/lib/systemd/system/cron-failure@.service; static; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2018-06-08 07:50:03 CEST; 3 days ago Docs: man:systemd.cron(7) Main PID: 8098 (code=exited, status=1/FAILURE) Jun 08 07:50:03 vhp mail_on_failure[8098]: File "/usr/lib64/python3.5/subprocess.py", line 385, in run Jun 08 07:50:03 vhp mail_on_failure[8098]: stdout, stderr = process.communicate(input, timeout=timeout) Jun 08 07:50:03 vhp mail_on_failure[8098]: File "/usr/lib64/python3.5/subprocess.py", line 790, in communicate Jun 08 07:50:03 vhp mail_on_failure[8098]: stdout = self.stdout.read() Jun 08 07:50:03 vhp mail_on_failure[8098]: File "/usr/lib64/python3.5/encodings/ascii.py", line 26, in decode Jun 08 07:50:03 vhp mail_on_failure[8098]: return codecs.ascii_decode(input, self.errors)[0] Jun 08 07:50:03 vhp mail_on_failure[8098]: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal no> Jun 08 07:50:03 vhp systemd[1]: cron-failure@cron-lubos-lubos-0.service: Main process exited, code=exited, status=1/FAILURE Jun 08 07:50:03 vhp systemd[1]: cron-failure@cron-lubos-lubos-0.service: Failed with result 'exit-code'. Jun 08 07:50:03 vhp systemd[1]: Failed to start systemd-cron OnFailure for cron-lubos-lubos-0.
same error with python-3.6.5-r1
happens with locale POSIX, with UTF it works
OK, even more strange. When I run the code myself, ie. /usr/lib/systemd-cron/mail_on_failure cron-lubos-lubos-6 It runs OK. When activated from cron, it gives the python error.
(In reply to Lubos Kolouch from comment #3) > OK, even more strange. When I run the code myself, ie. > > /usr/lib/systemd-cron/mail_on_failure cron-lubos-lubos-6 > > It runs OK. > > When activated from cron, it gives the python error. fails even with UTF8
Is this fixed in 1.5.14? The changelog mentions "Handle sending mail_on_error when the locale is not correctly set" See-Also: https://bugs.gentoo.org/show_bug.cgi?id=685592