systemd can't handle very long After= and Before= directives in unit files
Environment
- Red Hat Enterprise Linux (RHEL) 7.2
- systemd-219-19.el7.x86_64
Issue
When using many SysV-init scripts on RHEL7 the generated unit files under /run/systemd/generator.late
may contain very long Before=
and After=
lines and systemd
fails parsing the unit files:
# systemctl status rsyncd -l
Failed to restart rsyncd.service: Unit rsyncd.service failed to load: Bad message. See system logs and 'systemctl status rsyncd.service' for details.
● rsyncd.service - fast remote file copy program daemon
Loaded: error (Reason: Bad message)
Active: active (running) since Fri 2015-12-04 18:03:09 CET; 16s ago
Main PID: 15886 (rsync)
CGroup: /system.slice/rsyncd.service
└─15886 /usr/bin/rsync --daemon --no-detach
dec 04 18:03:09 my-rhel71 systemd[1]: Started fast remote file copy program daemon.
dec 04 18:03:09 my-rhel71 systemd[1]: Starting fast remote file copy program daemon...
dec 04 18:03:09 my-rhel71 rsyncd[15886]: rsyncd version 3.0.9 starting, listening on port 873
dec 04 18:03:09 my-rhel71 rsyncd[15886]: rsyncd version 3.0.9 starting, listening on port 873
dec 04 18:03:25 my-rhel71 systemd[1]: [/usr/lib/systemd/system/rsyncd.service:4] Failed to add dependency on example_service, ignoring: Invalid argument
dec 04 18:03:25 my-rhel71 systemd[1]: [/usr/lib/systemd/system/rsyncd.service:5] Missing '='.
Resolution
Update to systemd-219-30.el7
released with Advisory RHBA-2016:2216-1 or newer.
Root Cause
Prior to systemd-219-30.el7
automatic unit file generator produced unit files containing ordering dependency definitions (After=) with length exceeding maximum for input line in unit files.
This issue has been fixed and current automatic unit file generator splits dependencies to separated lines.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments