Differences between /lib/systemd/system and /usr/lib/systemd/system

I’m reading about systemd, and it looks to me these two directories have the exact same files, but Rocky seems to only use /usr/lib/systemd/system. So what is the purpose of having both?

Thanks for your help.

/lib is a symlink to /usr/lib. Most things should be using /usr/... in majority of cases. But the symlinks are there for backwards compatibility.

[label@xmpp01 ~]$ ll /
total 24
dr-xr-xr-x.   2 root root    6 May 16  2022 afs
lrwxrwxrwx.   1 root root    7 May 16  2022 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096 Jan 26 15:33 boot
drwxr-xr-x.  20 root root 3360 Feb  2 22:12 dev
drwxr-xr-x.  97 root root 8192 Feb  2 22:12 etc
drwxr-xr-x.   5 root root   46 Jul 14  2022 home
lrwxrwxrwx.   1 root root    7 May 16  2022 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 May 16  2022 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 May 16  2022 media
drwxr-xr-x.   2 root root    6 May 16  2022 mnt
drwxr-xr-x.   4 root root   44 Jul 14  2022 opt
dr-xr-xr-x. 237 root root    0 Feb  2 22:11 proc
dr-xr-x---.  13 root root 4096 Feb  2 22:05 root
drwxr-xr-x.  31 root root 1020 Feb  2 22:13 run
lrwxrwxrwx.   1 root root    8 May 16  2022 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 May 16  2022 srv
dr-xr-xr-x.  13 root root    0 Feb  2 22:12 sys
drwxrwxrwt.  11 root root 4096 Feb  3 02:28 tmp
drwxr-xr-x.  12 root root  144 Jul 14  2022 usr
drwxr-xr-x.  19 root root  264 Jul 14  2022 var
1 Like