FATAL: unrecognized configuration parameter “unix_socket_directory”

I faced this issue while upgrading from postgresql 9.1 to postgresql 10.

The main issue here is becvause they had been a directory change from postgresql 9.1.The problem is that pg_upgrade executes the program pg_ctrl with arguments that specify files in the old “unix_socket_directory” rather than the new “unix_socket_directories” (note the second is plural).

And this basically happens because the installation did not create a seperate directory for postgresql 9.1 binaries. This hack renames the original /usr/bin/pg_ctl to /usr/bin/pg_ctl-orig, and then creates a shell script in its place that simply calls the original pg_ctl program, passing all arguments with any strings “unix_socket_directory” changed to “unix_socket_directories”.

Login as root and run following script

mv /usr/bin/pg_ctl{,-orig}
echo '#!/bin/bash' > /usr/bin/pg_ctl
echo '"$0"-orig "${@/unix_socket_directory/unix_socket_directories}"' >> /usr/bin/pg_ctl
chmod +x /usr/bin/pg_ctl

So this changed the parameter unix_socket_directory to unix_socket_directories temporarily . And we will have to revert back to the original settings after the upgrade is done

After running your upgrade and starting your new cluster, we need to run the following command to revert the changes we did earlier.

# mv -f /usr/bin/pg_ctl{-orig,}

You can execute your post upgrade scripts

$ ./analyze_new_cluster.sh
$ .delete_old_cluster.sh

About the author

User Avatar

bensonyerima

Hi, I'm Benson Yerima, a database administrator with an obsession for all things tech. This blog is dedicated for helping people learn about database technology.

View all posts

8,152 Comments