1

I have installed postgresql 9.6 in Ubuntu 12.04. Only Postgresql 9.6 version is there, I have removed old version totally.

However server is not getting started by

/etc/init.d/postgresql start

Command doesn't raise any errors but there is no process started for this. Then I have started server manually by the following command.

/usr/lib/postgresql/9.6/bin/postgres -d 3 -D /var/lib/postgresql/9.6/main/ -c config_file=/etc/postgresql/9.6/main/postgresql.conf

Here is the response of the command.

2017-01-04 12:13:09 IST [14117-1] DEBUG:  postgres: PostmasterMain: initial environment dump:
2017-01-04 12:13:09 IST [14117-2] DEBUG:  -----------------------------------------
2017-01-04 12:13:09 IST [14117-3] DEBUG:    TERM=xterm
2017-01-04 12:13:09 IST [14117-4] DEBUG:    SHELL=/bin/bash
2017-01-04 12:13:09 IST [14117-5] DEBUG:    XDG_SESSION_COOKIE=4fcea99dda8663a9f10a0af30000000a-1483511466.91321-1562010601
2017-01-04 12:13:09 IST [14117-6] DEBUG:    USER=postgres
2017-01-04 12:13:09 IST [14117-7] DEBUG:    LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
2017-01-04 12:13:09 IST [14117-8] DEBUG:    SUDO_USER=viraj
2017-01-04 12:13:09 IST [14117-9] DEBUG:    SUDO_UID=1000
2017-01-04 12:13:09 IST [14117-10] DEBUG:   USERNAME=root
2017-01-04 12:13:09 IST [14117-11] DEBUG:   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
2017-01-04 12:13:09 IST [14117-12] DEBUG:   MAIL=/var/mail/postgres
2017-01-04 12:13:09 IST [14117-13] DEBUG:   PWD=/root
2017-01-04 12:13:09 IST [14117-14] DEBUG:   LANG=en_IN
2017-01-04 12:13:09 IST [14117-15] DEBUG:   HOME=/var/lib/postgresql
2017-01-04 12:13:09 IST [14117-16] DEBUG:   SUDO_COMMAND=/bin/su
2017-01-04 12:13:09 IST [14117-17] DEBUG:   SHLVL=2
2017-01-04 12:13:09 IST [14117-18] DEBUG:   LANGUAGE=en_IN:en
2017-01-04 12:13:09 IST [14117-19] DEBUG:   LOGNAME=postgres
2017-01-04 12:13:09 IST [14117-20] DEBUG:   LESSOPEN=| /usr/bin/lesspipe %s
2017-01-04 12:13:09 IST [14117-21] DEBUG:   DISPLAY=:0
2017-01-04 12:13:09 IST [14117-22] DEBUG:   SUDO_GID=1000
2017-01-04 12:13:09 IST [14117-23] DEBUG:   LESSCLOSE=/usr/bin/lesspipe %s %s
2017-01-04 12:13:09 IST [14117-24] DEBUG:   COLORTERM=gnome-terminal
2017-01-04 12:13:09 IST [14117-25] DEBUG:   XAUTHORITY=/home/viraj/.Xauthority
2017-01-04 12:13:09 IST [14117-26] DEBUG:   _=/usr/lib/postgresql/9.6/bin/postgres
2017-01-04 12:13:09 IST [14117-27] DEBUG:   PGLOCALEDIR=/usr/share/locale
2017-01-04 12:13:09 IST [14117-28] DEBUG:   PGSYSCONFDIR=/etc/postgresql-common
2017-01-04 12:13:09 IST [14117-29] DEBUG:   LC_COLLATE=en_IN
2017-01-04 12:13:09 IST [14117-30] DEBUG:   LC_CTYPE=en_IN
2017-01-04 12:13:09 IST [14117-31] DEBUG:   LC_MESSAGES=en_IN
2017-01-04 12:13:09 IST [14117-32] DEBUG:   LC_MONETARY=C
2017-01-04 12:13:09 IST [14117-33] DEBUG:   LC_NUMERIC=C
2017-01-04 12:13:09 IST [14117-34] DEBUG:   LC_TIME=C
2017-01-04 12:13:09 IST [14117-35] DEBUG:  -----------------------------------------

2017-01-04 12:13:10 IST [14122-2] DEBUG:  InitPostgres
2017-01-04 12:13:10 IST [14122-3] DEBUG:  StartTransaction
2017-01-04 12:13:10 IST [14122-4] DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2017-01-04 12:13:10 IST [14122-5] DEBUG:  CommitTransaction
2017-01-04 12:13:10 IST [14122-6] DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2017-01-04 12:13:10 IST [14123-1] DEBUG:  received inquiry for database 0
2017-01-04 12:13:10 IST [14123-2] DEBUG:  writing stats file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.stat"
2017-01-04 12:13:10 IST [14123-3] LOG:  could not open temporary statistics file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.tmp": No such file or directory
2017-01-04 12:13:10 IST [14123-4] DEBUG:  writing stats file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.stat"
2017-01-04 12:13:10 IST [14123-5] LOG:  could not open temporary statistics file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.tmp": No such file or directory
2017-01-04 12:13:10 IST [14123-6] DEBUG:  writing stats file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.stat"
2017-01-04 12:13:10 IST [14123-7] LOG:  could not open temporary statistics file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.tmp": No such file or directory
2017-01-04 12:13:10 IST [14123-8] DEBUG:  writing stats file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.stat"
2017-01-04 12:13:10 IST [14123-9] LOG:  could not open temporary statistics file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.tmp": No such file or directory
2017-01-04 12:13:10 IST [14123-10] DEBUG:  received inquiry for database 0
2017-01-04 12:13:10 IST [14123-11] DEBUG:  writing stats file "/var/run/postgresql/9.6-main.pg_stat_tmp/global.stat"

How could I fix this issue ?

While I try to connect to the postgresql following error message I got from system.

postgres@Viraj:/var/run$ psql -l
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

closed as unclear what you're asking by mustaccio, Paul White Oct 1 '17 at 7:12

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • There is no error message in the log. Are you sure there is no running PostgreSQL process? Moreover, some important details are missing in your question: Did you uninstall the old PostgreSQL version before or after installing the new one? Did you adjust the config files (e.g. postgresql.conf) or did you leave everything as installed? – vog Jan 4 '17 at 9:06
  • When you say you "removed old version totally"... What exactly did you do? I imagine from this output you have also removed some things that would be common between Postgres versions. – Gaius Sep 30 '17 at 12:57
0

There are many important details missing in the question, so this answer is just a wild guess:

It seems that your PostgreSQL server is up and running, and you have just trouble connecting to it. Maybe you installed the new PostgreSQL version before removing the old one. In that case, the new PostgreSQL server can't use the default port 5432, as that is still used by the old PostgreSQL server. It is then usually set to 5433 instead. (Or to 5434, if 5433 is also already used, and so on.)

Since you are connecting via Unix socket instead of TCP, you might wonder why the port number matters. However, in PostgreSQL the port number is encoded in the socket file name as well. So "connecting to port 5433" instead of 5432 means to connect to socket /var/run/postgresql/.s.PGSQL.5433 instead of /var/run/postgresql/.s.PGSQL.5432.

If you are lucky all these assumptions are true (really just a wild guess!), then the following command should work:

psql -p 5433 -l

To fix the that non-standard port number, you could purge PostgreSQL (i.e. uninstall and remove configuration files) and install again. Alternatively, you could fix the port number entry in your postgresql.conf and restart the PostgreSQL server.

  • I have installed it after removing old versions. I have checked the port it's 5432 and yes in config Unit Socket is there. So the conclusion is that port number is not an issue here. Thanks for prompt response. – Emipro Technologies Pvt. Ltd. Jan 4 '17 at 10:38
  • As I said, you need to provide more details in the question. Otherwise, nobody will be able to help you, neither me nor any other volunteer. – vog Jan 4 '17 at 12:12
  • What should I update in question can you please give me hint ? I have listed points which I have faced. Rest you may suggest so I can update. – Emipro Technologies Pvt. Ltd. Jan 4 '17 at 12:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.