1

After upgrading from 18.04 LTS to 20.04 LTS rsyslog stopped writing its PID into /(var/)run/rsyslogd.pid file.

1 Answer 1

3

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.

4
  • 1
    You should use systemctl edit instead. Run systemctl edit rsyslog.service and write [Unit]<new line>ExecStart=/usr/sbin/rsyslogd -n (replace <new line> with new line). Then proceed with systemctl 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])?
    – Rychu
    Jan 17, 2022 at 20:48
  • Thanks for correction - yup, you're right. Jan 17, 2022 at 22:35
  • 1
    Actually, @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. Otherwise systemctl throws rsyslog.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. .
    – Rychu
    Jan 24, 2022 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .