PostgreSQL server failed to start. I would appreciate any helpful suggestions on how to get PostgresSQL working again

PostgreSQL server failed to start. I would appreciate any helpful suggestions on how to get PostgresSQL working again

I have OpenERP version 6 (which works with PostgresSQL) installed on my Ubuntu 12.04.3 server and it has been working for the past few years until I did a recent server restart.

When I try to start my OpenERP, I get the following error messages:

Internal Server Error
{"message": "OpenERP Server Error", "code": 200, "data": {"debug": "Server Traceback (most recent call last):\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/session.py\", line 89, in send\n return openerp.netsvc.dispatch_rpc(service_name, method, args)\n File \"/usr/lib/pymodules/python2.7/openerp/netsvc.py\", line 292, in dispatch_rpc\n result = ExportService.getService(service_name).dispatch(method, params)\n File \"/usr/lib/pymodules/python2.7/openerp/service/web_services.py\", line 122, in dispatch\n return fn(*params)\n File \"/usr/lib/pymodules/python2.7/openerp/service/web_services.py\", line 359, in exp_list\n cr = db.cursor()\n File \"/usr/lib/pymodules/python2.7/openerp/sql_db.py\", line 484, in cursor\n return Cursor(self._pool, self.dbname, serialized=serialized)\n File \"/usr/lib/pymodules/python2.7/openerp/sql_db.py\", line 182, in __init__\n self._cnx = pool.borrow(dsn(dbname))\n File \"/usr/lib/pymodules/python2.7/openerp/sql_db.py\", line 377, in _locked\n return fun(self, *args, **kwargs)\n File \"/usr/lib/pymodules/python2.7/openerp/sql_db.py\", line 440, in borrow\n result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)\n File \"/usr/lib/python2.7/dist-packages/psycopg2/__init__.py\", line 179, in connect\n connection_factory=connection_factory, async=async)\nOperationalError: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.5432\"?\n\n\nClient Traceback (most recent call last):\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/http.py\", line 285, in dispatch\n r = method(self, **self.params)\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py\", line 573, in index\n db, redir = db_monodb_redirect(req)\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py\", line 98, in db_monodb_redirect\n return db_redirect(req, not config['list_db'])\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py\", line 109, in db_redirect\n dbs = db_list(req, True)\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py\", line 90, in db_list\n dbs = proxy.list(force)\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/session.py\", line 30, in proxy_method\n result = self.session.send(self.service_name, method, *args)\n File \"/usr/lib/pymodules/python2.7/openerp/addons/web/session.py\", line 103, in send\n raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)\nFault: <fault could="" not="" connect="" to="" server:="" no="" such="" file="" or="" directory\n\tis="" the="" server="" running="" locally="" and="" accepting\n\tconnections="" on="" unix="" domain="" socket="" \"="" var="" run="" postgresql="" .s.pgsql.5432\"?\n:="" 'traceback="" (most="" recent="" call="" last):\\n="" usr="" lib="" pymodules="" python2.7="" openerp="" addons="" web="" session.py\",="" line="" 89,="" in="" send\\n="" return="" openerp.netsvc.dispatch_rpc(service_name,="" method,="" args)\\n="" netsvc.py\",="" 292,="" dispatch_rpc\\n="" result="ExportService.getService(service_name).dispatch(method," params)\\n="" service="" web_services.py\",="" 122,="" dispatch\\n="" fn(*params)\\n="" 359,="" exp_list\\n="" cr="db.cursor()\\n" sql_db.py\",="" 484,="" cursor\\n="" cursor(self._pool,="" self.dbname,="" serialized="serialized)\\n" 182,="" __init__\\n="" self._cnx="pool.borrow(dsn(dbname))\\n" 377,="" _locked\\n="" fun(self,="" *args,="" **kwargs)\\n="" 440,="" borrow\\n="" connection_factory="PsycoConnection)\\n" dist-packages="" psycopg2="" __init__.py\",="" 179,="" connect\\n="" async="async)\\nOperationalError:" directory\\n\\tis="" accepting\\n\\tconnections="" .s.pgsql.5432\"?\\n\\n'="">\n", "fault_code": "could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.5432\"?\n", "type": "server_exception"}}</fault> 

My search online has shown that this error is caused by Postgres not being online.

When I navigate to Postgres SQL server via my server's Webmin, here's the error message I am presented with:

The PostgreSQL host configuration file /etc/posgressql/pg_hba.conf was not found on your system. Maybe PosgreSQL has not been initialised, or your module configuration is incorrect.

upon further investigation, I realized that the URL to my PostgresSQL config files is now here:

/etc/postgresql/9.1/main

I looked through the history of the commands that had been issued on the server lately and I saw some commands my System Admin used on my server a while ago and it appears to me that the Postgres version might have been upgraded (and I am thinking that that's why the config files are now at a different location).

Here are the commands via history:

533 ls

  534 cd openerp

  535 ls

  536 cd

  537 sudo nano odoo8.sh

  538 sudo nano Skip to content

  539 sudo paswd root

  540 sudo passwd root

  541 sudo nano odoo8.sh

  542 sudo nano odoo.sh

  543 sudo chmod +x odoo.sh

  544 ./odoo

  545 ./odoo.sh

  546 sudo nano odoo.sh

  547 ./odoo.sh

  548 sudo nano odoo.sh

  549 sudo nano install.sh

  550 sudo chmod +x install.sh

  551 /install.sh

  552 ./install.sh

  553 sudo opt

  554 sudo /opt

  555 sudo /opt#

  556 sudo cd /opt

  557 sudo netstat -ntlp | grep LISTEN

  558 sudo dpkg-query -L odoo8 |grep conf

  559 sudo cd /var

  560 sudo cd var

  561 sudo cd var/

  562 sls

  563 ls

  564 find /etc/

  565 sudo nano /etc/odoo-server.conf

  566 find /etc -iname "odoo*"

  567 sudo nano /etc/odoo-server.conf

  568 sudo nano /etc/odoo-server.conf

  569 find /etc/

  570 find /etc/openerp

  571 sudo nano /etc/openerp/openerp-server.conf

  572 sudo /etc/init.d openerp start

  573 sudo /etc/init.d/odoo-server start

  574 sudo /etc/init.d/openerp-server start

  575 find /etc/init.d/openerp

  576 reboot

  577 service --status-all

  578 sudo

  579 sudo netstat -atn

  580 sudo ./odoo-server --config=/etc/odoo-server.conf --xmlrpc-port=8068

  581 ./odoo-server start

  582 sudo /etc/init.d/odoo-server start

  583 sudo /var/log

  584 sudo cd /var/log

  585 sudo cd var/log

  586 sudo cd /var

  587 cd var

  588 cd var/

  589 ls

  590 find *odoo*.log

  591 find /var/log/odoo

  592 cd /var/log/odoo

  593 ls

  594 sudo ls /var/log/odoo

  595 s

  596 cd

  597 sudo netstat -ntlp | grep LISTEN

  598 sudo nano /etc/odoo-server.log

  599 find /etc/odoo

  600 find odoo-sever

  601 sudo nano /etc/odoo-server.conf

  602 sudo

  603 sudo /etc/init.d/odoo-server start

  604 sudo /etc/init.d/postresql start

  605 find postgres

  606 sudo /etc/init.d/postresql-9.3 start

  607 sudo netstat -ntlp | grep LISTEN

  608 sudo cd /var/log

  609 find odoo

  610 ls odoo*

  611 sudo netstat -plunt |grep postgres

  612 netstat -plten

  613 tail /var/log/odoo/

  614 ls /opt/openerp/

  615 ls

  616 cat install.sh

  617 vim install.sh

  618 sudo ./install.sh

  619 mkdir /opt/odoo

  620 sudo ./install.sh

  621 uname -a

  622 lsb_release -a

  623 export

  624 env

  625 nano ss.sh

  626 sudo apt-get install graphviz ghostscript postgresql-client python-dateut il python-feedparser pyt

  627 sudo apt-get install graphviz ghostscript postgresql-client python-dateut il python-feedparser python

  628 sudo apt-get install apt-get install gcc python-dev mc bzr python-setupto ols python-babel python-

  629 sudo adduser odoo --home /opt/odoo

  630 sudo -u postgres createuser -s odoo

  631 sudo su odoo

  632 mkdir /opt/odoo/v8

  633 cd /opt/odoo/v8

  634 bzr branch lp:~openerp/openerp-web/saas-4 web

  635 rm /opt/odoo/v8

  636 /opt/odoo/v8

  637 sudo apt-get dist-upgrade

  638 sudo adduser --system --home=/opt/odoo --group odoo

  639 sudo su - odoo -s /bin/bash

  640 createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo

  641 sudo su - postgres

  642 cut -d: -f1 /etc/passwd

  643 createuser --createdb --username postgres2 --no-createrole --no-superuser --pwprompt odoo

  644 sudo su - postgres

  645 sudo apt-get install git

  646 sudo su - odoo -s /bin/bash

  647 sudo cp /opt/odoo/debian/openerp-server.conf /etc/odoo-server.conf

  648 cd

  649 sudo userdel odoo

  650 cut -d: -f1 /etc/passwd

  651 apt-get update

  652 ##fixed parameters

  653 #openerp

  654 OE_USER="odoo"

  655 OE_HOME="/opt/$OE_USER"

  656 OE_HOME_EXT="/opt/$OE_USER/$OE_USER-server"

  657 #Enter version for checkout "8.0" for version 8.0, "7.0 (version 7), saas -4, saas-5 (opendays version) and "master" for trunk

  658 OE_VERSION="8.0"

  659 #set the superadmin password

  660 OE_SUPERADMIN="admin"

  661 OE_CONFIG="$OE_USER-server"

  662 #--------------------------------------------------

  663 # Update Server

  664 #--------------------------------------------------

  665 echo -e "\n---- Update Server ----"

  666 sudo apt-get update

  667 sudo apt-get upgrade -y

  668 sudo apt-get install -y locales

  669 export LANGUAGE=en_US.UTF-8

  670 export LANG=en_US.UTF-8

  671 export LC_ALL=en_US.UTF-8

  672 sudo locale-gen en_US.UTF-8

  673 sudo dpkg-reconfigure locales

  674 #--------------------------------------------------

  675 # Install PostgreSQL Server

  676 #--------------------------------------------------

  677 echo -e "\n---- Install PostgreSQL Server ----"

  678 sudo apt-get install postgresql -y

  679 echo -e "\n---- PostgreSQL $PG_VERSION Settings ----"

  680 sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/ g /etc/postgresql/9.3/main/postgresql.conf

  681 echo -e "\n---- Creating the ODOO PostgreSQL User ----"

  682 sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true

  683 #--------------------------------------------------

  684 # Install Dependencies

  685 #--------------------------------------------------

  686 echo -e "\n---- Install tool packages ----"

  687 sudo apt-get install wget subversion git bzr bzrtools python-pip -y

  688 echo -e "\n---- Install python packages ----"

  689 sudo apt-get install python-dateutil python-feedparser python-ldap python -libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel p ython-pychart python-pydot python-pyparsing python-reportlab python-simplejson p ython-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xl wt python-yaml python-zsi python-docutils python-psutil python-mock python-unitt est2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y

  690 echo -e "\n---- Install python libraries ----"

  691 sudo pip install gdata

  692 echo -e "\n---- Install wkhtml and place on correct place for ODOO 8 ---- "

  693 sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12\. 1_linux-trusty-amd64.deb

  694 sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

  695 sudo cp /usr/local/bin/wkhtmltopdf /usr/bin

  696 sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

  697 echo -e "\n---- Create ODOO system user ----"

  698 sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos ' ODOO' --group $OE_USER

  699 echo -e "\n---- Create Log directory ----"

  700 sudo mkdir /var/log/$OE_USER

  701 sudo chown $OE_USER:$OE_USER /var/log/$OE_USER

  702 #--------------------------------------------------

  703 # Install ODOO

  704 #--------------------------------------------------

  705 echo -e "\n==== Installing ODOO Server ===="

  706 sudo git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_ HOME_EXT/

  707 echo -e "\n---- Create custom module directory ----"

  708 sudo su $OE_USER -c "mkdir $OE_HOME/custom"

  709 sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons"

  710 echo -e "\n---- Setting permissions on home folder ----"

  711 sudo chown -R $OE_USER:$OE_USER $OE_HOME/*

  712 echo -e "* Create server config file"

  713 sudo cp $OE_HOME_EXT/debian/openerp-server.conf /etc/$OE_CONFIG.conf

  714 sudo chown $OE_USER:$OE_USER /etc/$OE_CONFIG.conf

  715 sudo chmod 640 /etc/$OE_CONFIG.conf

  716 echo -e "* Change server config file"

  717 sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/$OE_CONFIG.conf

  718 sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/$ OE_CONFIG.conf

  719 sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> / etc/$OE_CONFIG.conf"

  720 sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/ad dons' >> /etc/$OE_CONFIG.conf"

  721 echo -e "* Create startup file"

  722 sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/openerp-server --con fig=/etc/$OE_CONFIG.conf' >> $OE_HOME_EXT/start.sh"

  723 sudo chmod 755 $OE_HOME_EXT/start.sh

  724 #--------------------------------------------------

  725 # Adding ODOO as a deamon (initscript)

  726 #--------------------------------------------------

  727 echo -e "* Create init file"

  728 echo '#!/bin/sh' >> ~/$OE_CONFIG

  729 echo '### BEGIN INIT INFO' >> ~/$OE_CONFIG

  730 echo '# Provides: $OE_CONFIG' >> ~/$OE_CONFIG

  731 echo '# Required-Start: $remote_fs $syslog' >> ~/$OE_CONFIG

  732 echo '# Required-Stop: $remote_fs $syslog' >> ~/$OE_CONFIG

  733 echo '# Should-Start: $network' >> ~/$OE_CONFIG

  734 echo '# Should-Stop: $network' >> ~/$OE_CONFIG

  735 echo '# Default-Start: 2 3 4 5' >> ~/$OE_CONFIG

  736 echo '# Default-Stop: 0 1 6' >> ~/$OE_CONFIG

  737 echo '# Short-Description: Enterprise Business Applications' >> ~/$OE_CON FIG

  738 echo '# Description: ODOO Business Applications' >> ~/$OE_CONFIG

  739 echo '### END INIT INFO' >> ~/$OE_CONFIG

  740 echo 'PATH=/bin:/sbin:/usr/bin' >> ~/$OE_CONFIG

  741 echo "DAEMON=$OE_HOME_EXT/openerp-server" >> ~/$OE_CONFIG

  742 echo "NAME=$OE_CONFIG" >> ~/$OE_CONFIG

  743 echo "DESC=$OE_CONFIG" >> ~/$OE_CONFIG

  744 echo '' >> ~/$OE_CONFIG

  745 echo '# Specify the user name (Default: odoo).' >> ~/$OE_CONFIG

  746 echo "USER=$OE_USER" >> ~/$OE_CONFIG

  747 echo '' >> ~/$OE_CONFIG

  748 echo '# Specify an alternate config file (Default: /etc/openerp-server.co nf).' >> ~/$OE_CONFIG

  749 echo "CONFIGFILE=\"/etc/$OE_CONFIG.conf\"" >> ~/$OE_CONFIG

  750 echo '' >> ~/$OE_CONFIG

  751 echo '# pidfile' >> ~/$OE_CONFIG

  752 echo 'PIDFILE=/var/run/$NAME.pid' >> ~/$OE_CONFIG

  753 echo '' >> ~/$OE_CONFIG

  754 echo '# Additional options that are passed to the Daemon.' >> ~/$OE_CONFI G

  755 echo 'DAEMON_OPTS="-c $CONFIGFILE"' >> ~/$OE_CONFIG

  756 echo '[ -x $DAEMON ] || exit 0' >> ~/$OE_CONFIG

  757 echo '[ -f $CONFIGFILE ] || exit 0' >> ~/$OE_CONFIG

  758 echo 'checkpid() {' >> ~/$OE_CONFIG

  759 echo '[ -f $PIDFILE ] || return 1' >> ~/$OE_CONFIG

  760 echo 'pid=`cat $PIDFILE`' >> ~/$OE_CONFIG

  761 echo '[ -d /proc/$pid ] && return 0' >> ~/$OE_CONFIG

  762 echo 'return 1' >> ~/$OE_CONFIG

  763 echo '}' >> ~/$OE_CONFIG

  764 echo '' >> ~/$OE_CONFIG

  765 echo 'case "${1}" in' >> ~/$OE_CONFIG

  766 echo 'start)' >> ~/$OE_CONFIG

  767 echo 'echo -n "Starting ${DESC}: "' >> ~/$OE_CONFIG

  768 echo 'start-stop-daemon --start --quiet --pidfile ${PIDFILE} \' >> ~/$OE_ CONFIG

  769 echo '--chuid ${USER} --background --make-pidfile \' >> ~/$OE_CONFIG

  770 echo '--exec ${DAEMON} -- ${DAEMON_OPTS}' >> ~/$OE_CONFIG

  771 echo 'echo "${NAME}."' >> ~/$OE_CONFIG

  772 echo ';;' >> ~/$OE_CONFIG

  773 echo 'stop)' >> ~/$OE_CONFIG

  774 echo 'echo -n "Stopping ${DESC}: "' >> ~/$OE_CONFIG

  775 echo 'start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \' >> ~/$OE_C ONFIG

  776 echo '--oknodo' >> ~/$OE_CONFIG

  777 echo 'echo "${NAME}."' >> ~/$OE_CONFIG

  778 echo ';;' >> ~/$OE_CONFIG

  779 echo '' >> ~/$OE_CONFIG

  780 echo 'restart|force-reload)' >> ~/$OE_CONFIG

  781 echo 'echo -n "Restarting ${DESC}: "' >> ~/$OE_CONFIG

  782 echo 'start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \' >> ~/$OE_C ONFIG

  783 echo '--oknodo' >> ~/$OE_CONFIG

  784 echo 'sleep 1' >> ~/$OE_CONFIG

  785 echo 'start-stop-daemon --start --quiet --pidfile ${PIDFILE} \' >> ~/$OE_ CONFIG

  786 echo '--chuid ${USER} --background --make-pidfile \' >> ~/$OE_CONFIG

  787 echo '--exec ${DAEMON} -- ${DAEMON_OPTS}' >> ~/$OE_CONFIG

  788 echo 'echo "${NAME}."' >> ~/$OE_CONFIG

  789 echo ';;' >> ~/$OE_CONFIG

  790 echo '*)' >> ~/$OE_CONFIG

  791 echo 'N=/etc/init.d/${NAME}' >> ~/$OE_CONFIG

  792 echo 'echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2' >> ~/$ OE_CONFIG

  793 echo 'exit 1' >> ~/$OE_CONFIG

  794 echo ';;' >> ~/$OE_CONFIG

  795 echo '' >> ~/$OE_CONFIG

  796 echo 'esac' >> ~/$OE_CONFIG

  797 echo 'exit 0' >> ~/$OE_CONFIG

  798 echo -e "* Security Init File"

  799 sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG

  800 sudo chmod 755 /etc/init.d/$OE_CONFIG

  801 sudo chown root: /etc/init.d/$OE_CONFIG

  802 echo -e "* Start ODOO on Startup"

  803 sudo update-rc.d $OE_CONFIG defaults

  804 sudo service $OE_CONFIG start

  805 sudo apt-get install python-cups python-dateutil python-decorator python- docutils python-feedparser python-gdata python-geoip python-gevent python-imagin g python-jinja2 python-ldap python-libxslt1

  806 sudo nano /etc/odoo-server.conf

  807 sudo nano var/log/odoo/odoo-server.log

  808 sudo chown root: sudo /etc/init.d/openerp-server start

  809 sudo start service openerp-server

  810 sudo reboot

I would appreciate any useful suggestion on how to get the PostgreSQL working again.

Since the path to the config file is no longer the same, starting or restarting the PostgreSQL server would not work.

root@myserver:~# service postgresql restart

 * Restarting PostgreSQL 9.1 database server

 * The PostgreSQL server failed to start. Please check the log output.

                                                                         [fail]

So, I also tried to navigated into the folder which contains the config files and restarted postgresql from the command line:

root@myserver:~# cd /etc/postgresql/9.1/main root@kuiperserver2:/etc/postgresql/9.1/main# service postgresql restart

 * Restarting PostgreSQL 9.1 database server

* The PostgreSQL server failed to start. Please check the log output:

2017-03-23 08:41:31 UTC FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": No such file or directory

                                                                                              [fail]

I would appreciate any more useful suggestions on how to get PostgresSQL working again.

Very many thanks.

1 Reply

I have been able to solve the issue.

I later figured out that the solution would be to include the right path to the config file in some start up folder.

I was able to find the right place to place the right path via webmin

I was then able to start PostgreSQL and the web application (OpenERP) is now working on the server.

Thanks.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct