Sample Header Ad - 728x90

systemd-tmpfiles doesn't create /run/postgresql at reboot, but does when called manually with --create

2 votes
1 answer
50 views
I have a problem related to a few already answered here in the past, but the solutions offered for them already appear to be in place for me: - [/var/run/postgresql missing after reboot](https://serverfault.com/questions/766287/) - [Tired of creating /run/postgresql and setting read and execute writes after every reboot](https://stackoverflow.com/questions/41515640/) - [Postgresql failed to start. Reboot is resetting the permission given to /var/run/postgresql/](https://stackoverflow.com/questions/58850796/) For me, I have postgresql running on my cluster(s), but it doesn't automatically start back up when the cluster is rebooted (which happens periodically for automated security patching). The problem is that /run/postgresql isn't created after reboot. However, the config to do so appears to already be in place and correct:
# cat /usr/lib/tmpfiles.d/postgresql-16.conf
d /run/postgresql 0755 postgres postgres -
I've tried rebooting a cluster and verified that the directory isn't created - but then if I run systemd-tmpfiles --create manually, it *does* get created and I'm able to start postgresql and proceed as normal. Everything else in /run seems to be getting created correctly - it's specifically postgresql that has a problem. Looking at the systemd-tmpfiles status:
# service  systemd-tmpfiles-setup status
Redirecting to /bin/systemctl status systemd-tmpfiles-setup.service
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
...
Jun 16 05:59:21 ...hostname... systemd: Starting Create Volatile Files and Directories...
Jun 16 05:59:21 ...hostname... systemd-tmpfiles: [/usr/lib/tmpfiles.d/httpd.conf:1] Unknown group 'apache'.
Jun 16 05:59:21 ...hostname... systemd-tmpfiles: [/usr/lib/tmpfiles.d/httpd.conf:2] Unknown user 'apache'.
Jun 16 05:59:21 ...hostname... systemd-tmpfiles: [/usr/lib/tmpfiles.d/postgresql-16.conf:1] Unknown user 'postgres'.
Jun 16 05:59:21 ...hostname... systemd: Started Create Volatile Files and Directories.
So it looks like the issue is that some users (coming from a Red Hat Identity Management server) aren't available at the time the /run dir is initially created. I'm not sure how to manipulate the timing for this... I'm using RHEL 8.10 and postgres16 - but I've seen similar issues with RHEL9 and postgres12 as well. Everything is coming from yum so the packages, configs, etc. should be "vanilla".
Asked by Amanadiel (123 rep)
Jun 16, 2025, 02:31 PM
Last activity: Jun 16, 2025, 03:13 PM