#3197 Issue closed: Bug: /var/run should be a symlink to /run, not a directory

schlomo opened issue at 2024-04-05 14:31:

We found a - I think legacy - bug in current ReaR:

/var/run and /run are both directories, whereas on all modern Linux distros one is a symlink to the other and systemd actually expects all PID files to be under /run:

My test shows that only CentOS 6 comes with a dedicated /var/run directory:

$ tools/run-in-docker -- ls -ldr /var/run
********** ubuntu:18.04                             **********
lrwxrwxrwx 1 root root 4 May 30  2023 /var/run -> /run
********** ubuntu:20.04                             **********
lrwxrwxrwx 1 root root 4 Oct  3  2023 /var/run -> /run
********** ubuntu:22.04                             **********
lrwxrwxrwx 1 root root 4 Jan 11 14:03 /var/run -> /run
********** ubuntu:23.04                             **********
lrwxrwxrwx 1 root root 4 Oct  4  2023 /var/run -> /run
********** ubuntu:devel                             **********
lrwxrwxrwx 1 root root 4 Sep 26  2023 /var/run -> /run
********** opensuse/leap:42                         **********
lrwxrwxrwx 1 root root 4 Aug 13  2019 /var/run -> /run
********** opensuse/leap:15                         **********
lrwxrwxrwx 1 root root 4 Oct 31 18:18 /var/run -> /run
********** registry.suse.com/suse/sle15             **********
lrwxrwxrwx 1 root root 4 Oct 31 14:37 /var/run -> /run
********** centos:6                                 **********
drwxr-xr-x 1 root root 4096 Nov 13 16:53 /var/run
********** centos:7                                 **********
lrwxrwxrwx 1 root root 6 Nov 13  2020 /var/run -> ../run
********** centos:8                                 **********
lrwxrwxrwx 1 root root 6 Sep 15  2021 /var/run -> ../run
********** sl:7                                     **********
lrwxrwxrwx 1 root root 6 Nov  1 17:57 /var/run -> ../run
********** quay.io/centos/centos:stream8            **********
lrwxrwxrwx 1 root root 6 Nov  6 04:51 /var/run -> ../run
********** quay.io/centos/centos:stream9            **********
lrwxrwxrwx 1 root root 6 Nov  6 04:09 /var/run -> ../run
********** fedora:29                                **********
lrwxrwxrwx 1 root root 6 Mar  7  2019 /var/run -> ../run
********** fedora:31                                **********
lrwxrwxrwx 1 root root 6 Jun  7  2020 /var/run -> ../run
********** fedora:34                                **********
lrwxrwxrwx 1 root root 6 Feb 21  2022 /var/run -> ../run
********** fedora:37                                **********
lrwxrwxrwx 1 root root 6 Nov  4 05:50 /var/run -> ../run
********** fedora:38                                **********
lrwxrwxrwx 1 root root 6 Nov  5 06:48 /var/run -> ../run
********** archlinux                                **********
lrwxrwxrwx 1 root root 6 Sep 18  2023 /var/run -> ../run
********** manjarolinux/base                        **********
lrwxrwxrwx 1 root root 6 Sep 22  2023 /var/run -> ../run
** SCRIPT RUN TIME 13 SECONDS **

In the specific example a systemd service fails to start because systemd simply rewrites the PIDFile setting from /var/run to /run but the unit definition creates the PID file under /var/run.

On the original system this is not a problem because /var/run is a symlink to /run, but in our ReaR Rescue system this creates a failure as the service creates the PID file in /var/run while systemd then looks for it in /run.

I propose updating ReaR to also use a symlink for /var/run as suggested by FHS

schlomo commented at 2024-04-05 14:56:

Thanks to @idna38 for reporting this bug to me


[Export of Github issue for rear/rear.]