Over the last two years, I’ve had a mix of friends and acquaintances start to look at PostgreSQL. I’ve initially was like ok, I’ll get to when I can. Well, I’ve started to dive into this topic a bit more and expanding my knowledge on the topic (for personal and business reasons). If you look at the industry as a whole, a lot of organizations are moving to PostgreSQL for a whole host of reason and this has lead to an expansion of different variants of PostgreSQL.
For the purpose of this post, I’m only looking at PostgreSQL 13. After getting PostgreSQL 13 installed (via these instructions), I was having a problem getting PostgreSQL to start. The error message I was getting when I ran pg_ctl was:
-bash-4.2$ /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start
waiting for server to start…. stopped waiting
pg_ctl: could not start server
Examine the log output.
Following what the output suggested, I went and looked at the log file in /var/lib/pgsql/13/data/log. This output referenced that fact that PostgreSQL couldn’t establish the port (5432) and then shuts down.
2021-08-16 00:29:30.348 UTC  LOG: starting PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2021-08-16 00:29:30.348 UTC  LOG: listening on IPv6 address “::1”, port 5432
2021-08-16 00:29:30.349 UTC  LOG: listening on IPv4 address “127.0.0.1”, port 5432
2021-08-16 00:29:30.350 UTC  LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2021-08-16 00:29:30.351 UTC  FATAL: could not create lock file “/tmp/.s.PGSQL.5432.lock”: Permission denied
2021-08-16 00:29:30.353 UTC  LOG: database system is shut down
After some review and tinkering with different things, I figure I would check the permissions on the /tmp directory. After all that is where PostgreSQL is trying to write the lock file.
As root user, I modified the /tmp directory to allow full access for everyone. The following is what I ran:
$ chmod 1777 /tmp
With the permissions updated on /tmp, I attempted to start the PostgreSQL database again with pg_ctl. The results were that the PostgreSQL database started without an issue.
2021-08-16 00:30:48.306 UTC  LOG: starting PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2021-08-16 00:30:48.306 UTC  LOG: listening on IPv6 address “::1”, port 5432
2021-08-16 00:30:48.306 UTC  LOG: listening on IPv4 address “127.0.0.1”, port 5432
2021-08-16 00:30:48.308 UTC  LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2021-08-16 00:30:48.310 UTC  LOG: listening on Unix socket “/tmp/.s.PGSQL.5432”
2021-08-16 00:30:48.313 UTC  LOG: database system was shut down at 2021-08-16 00:01:18 UTC
2021-08-16 00:30:48.316 UTC  LOG: database system is ready to accept connections
This is just something to keep in mind when start PostgreSQL databases in new environments be it is development or production.
Current Oracle Certs
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.