#1148755 cron: cron.service should restart after being killed by SIGPIPE

Package:
cron
Source:
cron
Description:
process scheduling daemon
Submitter:
Qiangning Hong
Date:
2026-10-15 15:43:04 UTC
Severity:
normal
#1148755#5
Date:
2026-09-23 06:33:39 UTC
From:
To:
Since `needrestart` 3.4 (2019-02, Debian #898818) removed its
`systemd-journald`
exclusion, a glibc security upgrade makes `needrestart` restart
`cron.service` and
`systemd-journald.service` **in the same `systemctl restart` transaction**.
Units
without ordering dependencies are scheduled in parallel, so cron is
sometimes started
shortly before journald is torn down.

Per `systemd-journald.service(8)`, tearing down journald terminates the
stdout/stderr
stream connections of other services, and writes to them then raise `EPIPE`
and
deliver `SIGPIPE`. systemd turns SIGPIPE off for services by default, but
`cron.service` explicitly opts out via `IgnoreSIGPIPE=false` (Debian
#756047), so cron
is one of the very few services that can actually be killed this way.

`systemd.service(5)` defines termination by SIGPIPE as a *clean exit*.
Therefore the
existing `Restart=on-failure` does **not** fire for what is arguably cron's
most likely
cause of death. cron stays dead indefinitely, and the only trace is
`cron.service: Deactivated successfully.`, which reads as a deliberate stop.

### Observed impact

On a production host, cron died this way and stayed dead for 52 hours. All
cron jobs
silently stopped. Nothing in the logs suggested a fault.

```
$ systemctl status cron
   Active: inactive (dead) since Sat 2026-09-12 06:56:21 CST
 Duration: 26ms
  Process: 692120 ExecStart=/usr/sbin/cron -f -P $EXTRA_OPTS
           (code=killed, signal=PIPE)

$ systemctl show cron
Restart=on-failure   IgnoreSIGPIPE=no   SuccessExitStatus=
Result=success       NRestarts=0
```

Note `Result=success` and `NRestarts=0`: systemd recorded the SIGPIPE death
as a
successful exit, so the restart policy never engaged.

### Timeline (journalctl -o short-precise, verbatim)

```
06:56:21.426212 systemd[1]: Stopping cron.service...
06:56:21.436137 systemd[1]: Started cron.service
06:56:21.447148 systemd[1]: Stopping systemd-journald.service...
06:56:21.447565 systemd-journald[4011866]: Journal stopped
06:56:21.551893 systemd[1]: cron.service: Deactivated successfully.
06:56:21.553009 systemd-journald[692139]: Journal started
```

There are **no `cron[...]` log lines at all** for the start at `.436137`. A
healthy
cron start writes `(CRON) INFO (pidfile fd = 3)` within 1–3 ms. It never
got that far.

### Why it is a race, not a certainty

The same host survived this six other times. The discriminator is whether
cron manages
its first stdout write before journald goes away:

| date | cron's first log write | journald teardown | outcome |
|---|---|---|---|
| 07-25 | +0.928 ms | +2.987 ms | survived |
| 07-29 | +2.192 ms | +18.246 ms | survived |
| 09-12 | never happened | +11.428 ms | **killed** |

The `needrestart` command that triggered it:

```
systemctl restart chrony.service cron.service multipathd.service
polkit.service
  rsyslog.service ssh.service systemd-journald.service
systemd-networkd.service
  systemd-resolved.service systemd-udevd.service tuned.service
udisks2.service
```

### Suggested fix

```ini
[Service]
RestartForceExitStatus=SIGPIPE
```

`RestartForceExitStatus=` accepts termination signal names. This forces a
restart only
for SIGPIPE and changes the behaviour of no other exit path, leaving
`Restart=on-failure`, `IgnoreSIGPIPE=false` and `KillMode=process`
untouched.

### Not Ubuntu-specific

The defect is in the Debian packaging; Ubuntu carries no delta for it.
Verified
against sources.debian.org:

```
version       suite                  Restart      IgnoreSIGPIPE
 RestartForceExitStatus
3.0pl1-209    forky (testing), sid   on-failure   false          absent
3.0pl1-197    trixie (stable)        on-failure   false          absent
```

Both current stable and unstable are affected.

Ubuntu does carry one unrelated delta: `ExecStart` is
`/usr/sbin/cron -f -P $EXTRA_OPTS`, one `-P` more than Debian's. The
`systemctl show`
output quoted above is therefore from an Ubuntu host; the three directives
at issue
are identical in Debian.

### Related

Debian #1100685 / needrestart #340 describes a different failure path with
the same
set of components: repeated restarts across unattended-upgrades' minimal
steps
exhausting `StartLimitBurst`, after which systemd stops the unit without
starting it
(that report killed sshd, and notes "it still may kill `cron` that way").

This bug is a separate mechanism: a single SIGPIPE, `Result=success`,
`NRestarts=0`.

### Environment

Observed on Ubuntu; the Debian unit files were verified separately (see
above).

- Ubuntu 24.04.3 LTS, systemd 255.4-1ubuntu8.17
- cron 3.0pl1-184ubuntu2
- needrestart 3.6-7ubuntu4.5 (config unmodified; `dpkg --verify` clean)
- Alibaba Cloud ECS, 2 vCPU, KVM
---
Best regards,
Qiangning Hong

#1148755#10
Date:
2026-10-15 15:38:04 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
cron, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1148755@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Georges Khaznadar <georgesk@debian.org> (supplier of updated cron package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 15 Oct 2026 17:07:32 +0200
Source: cron
Architecture: source
Version: 3.0pl1-212
Distribution: unstable
Urgency: medium
Maintainer: Georges Khaznadar <georgesk@debian.org>
Changed-By: Georges Khaznadar <georgesk@debian.org>
Closes: 1148755
Changes:
 cron (3.0pl1-212) unstable; urgency=medium
 .
   * applied Qiangning Hong's suggestion, thanks! Closes: #1148755
Checksums-Sha1:
 b6afcdcb9c71efdcc9f77f93545322cc6628eb11 2189 cron_3.0pl1-212.dsc
 817fab115af8cc1de5d571ea2cee756f4d7b2df5 142588 cron_3.0pl1-212.debian.tar.xz
 70f09b1a4dc12e613e19ab56be46de35bfcc2175 6376 cron_3.0pl1-212_source.buildinfo
Checksums-Sha256:
 49bc9513fe75ff95c17055224b61d0be4126db244c1eaf6228b4942503b69779 2189 cron_3.0pl1-212.dsc
 0b622f3ed9ca91165cb18c1139523f0801bf28c6246996ee16c5b68fccfb6d00 142588 cron_3.0pl1-212.debian.tar.xz
 2b637e32caf6aabac4e0fe985569ee191ce90ccc66d78f1e8efc6018af88eedc 6376 cron_3.0pl1-212_source.buildinfo
Files:
 1f4401ede7d95ab31e02703ef41cf500 2189 admin important cron_3.0pl1-212.dsc
 10c87acaea3792d8b6cd834bbfefe1ab 142588 admin important cron_3.0pl1-212.debian.tar.xz
 738a768a89919999277dfc2de70b2796 6376 admin important cron_3.0pl1-212_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEM0CzZP9nFT+3zK6FHCgWkHE2rjkFAmrQ7XgUHGdlb3JnZXNr
QGRlYmlhbi5vcmcACgkQHCgWkHE2rjm7WBAAjoy8NVahmaY5jK3HCLsNYq/GWbej
7BgaSkbZLfVm5dW9DVQsC46AZXrOYF1onovneRkbC/baoHOrY7TkQDBGQEThs2F6
roRR50BLNoUpdLRPbmD9Lu1ULrRwqj8M0dwVWQwJ3UROLZ750ww2fSFzaytKK+Xr
Wo4JvyKCP7rDmqNduU8dDLSt0l1OsLpgEemETMtFCMFxkdv1FIetK2qcsk8tL2bj
t45BGbM6VnPz/FIlnYvanNQeq0G7QAv++KyeBqMb8mByBBYWW8a5fgddLfosrJTx
4tHs4QyRVkqCoVNpmV2LTHlv+XJ2dAfgqFtYDp297d5ZLw38g4ZO34X4bWh3UokF
qflmkyFqezu4dAaC+pIOp9BggULHME3B8g/xtyfE1G+H8M7gky6MxIZcSeVHWRoa
4NEyRWSA+6Nrfvuuv8tWAJ/b+ySkiOsOfrWaA5Kzh4CUrHsy/ko1RvbqbHdxdK8v
zRj4Cmzenc41EYW34M0hzVHLgcVB1eHuLyhKRUHvUEhcz7z33WCxIzAkbsMp222n
79glVyPt2d/ankC86IWXnBxkEE0i3Ho/NqB2xtALma8lXwn1aoM7irES3MGEPTFe
U8LMpw3ya6TKU05U0UhpZorok9IjhGJXV49sTEts4bifqcc6gUlo6xd1QC5QkSiY
cB8n4RB3x/jpk80=
=DbCv
-----END PGP SIGNATURE-----