After upgrading from 18.04 LTS to 20.04 LTS rsyslog stopped writing its PID into /(var/)run/rsyslogd.pid
file.
1 Answer
Edit /lib/systemd/system/rsyslog.service
and remove -iNONE
option from ExecStart
line.
Then run systemctl daemon-reload
and systemctl restart rsyslog
and PID file should back.
man rsyslogd(8) says:
-i pid file
Specify an alternative pid file instead of the default one.
This option must be used if multiple instances of rsyslogd
should run on a single machine. To disable writing a pid file,
use the reserved name "NONE" (all upper case!), so "-iNONE".
== EDIT ==
As @Ondrej Simek suggested below instead of doing a manual edit of the service file you can use systemctl edit
and write
[Service]
ExecStart=
ExecStart=/usr/sbin/rsyslogd -n
After you save and close your editor the change should be applied to the service and the service restarted with PID file created. Good thing about this approach is that this change should survive rsyslog
upgrade because it creates new /etc/systemd/system/rsyslog.service.d/override.conf
file which overrides everything that is in /lib/systemd/system/rsyslog.service
.
-
1You should use
systemctl edit
instead. Runsystemctl edit rsyslog.service
and write[Unit]<new line>ExecStart=/usr/sbin/rsyslogd -n
(replace<new line>
with new line). Then proceed withsystemctl daemon-reload && systemctl restart rsyslog
. Jan 16, 2022 at 21:32 -
1@OndrejSimek, are you sure it shouldn't be
[Service]<new line>ExecStart=/usr/sbin/rsyslogd -n
([Service]
instead of[Unit]
)?– RychuJan 17, 2022 at 20:48 -
-
1Actually, @OndrejSimek, there is another line missing:
ExecStart=
that clears the value of this property first. Only then we can overwrite it with/usr/sbin/rsyslogd -n
. Otherwisesystemctl
throwsrsyslog.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services.
.– RychuJan 24, 2022 at 20:43