4

I was juggling Postgresql versions and I think I shot myself in the foot during the renaming of something. I have 9.3 and 9.4 installed on an Ubuntu 14.04 station, and I wanted to go back to 9.3 so I did some "file surgery" to make this happen. Somewhere along the line, I guess I did a rename and now when I issue the command:

sudo /etc/init.d/postgresql start

I get the following error output:

* Starting PostgreSQL 9.3 database server                                                                                                             
* Failed to issue method call: Unit postgresql@9.3-main.bak.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@9.3-main.bak.service' for details.

[fail]
* Starting PostgreSQL 9.4 database server                                                                                                     
* Failed to issue method call: Unit postgresql@9.4-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@9.4-main.service' for details.

I executed the systemctl status command as indicated by the error output for 9.3 and got this:

postgresql@9.3-main.bak.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)

As you can see from the main.bak.service output line, somehow postgresql picked up the rename. (However, I don't see a file named "service" anywhere in the directory tree.)

I looked inside my configuration file for postgresql and I don't see that directory anywhere:

data_directory = '/var/lib/postgresql/9.3/main'     # use data in another directory
                # (change requires restart)
hba_file = '/etc/postgresql/9.3/main/pg_hba.conf'   # host-based authentication file
                # (change requires restart)
ident_file = '/etc/postgresql/9.3/main/pg_ident.conf'   # ident configuration file
                # (change requires restart)

I don't have a PGROOT or PGDATA environment variable set so I don't think that's it? Also, as you can see from the command I use to start postgresql, I am not specifying a configuration file explictly. Is there a bad symlink somewhere that I don't know about? How can I fix this?

Where is postgresql picking up the main.bak.service file reference from?

Also, should I be using starting postgresql using the postgresql account instead of root (su vs sudo)? My setup used to work before so I fouled things up so I don't think that is the problem if running as root is a bad thing. But I would like to know the right user account to use when launching postgresql.

Robert Oschler
  • 161
  • 2
  • 7

0 Answers0