Odoo Help


[V8] [solved] Why does the connection to the database fail with Ubuntu 14.04?

Romuald Garibaldi
on 2/7/15, 12:27 PM 7,643 views

Hi all.

I use Ubuntu 14.04 amd64, postgresql-9.3.5 (installed from graphical installer) and Odoo8.0 (download from github.com).

There is an "Internal Server Error" when I try to display the webpage http://localhost:8069/ because the "Connection to the database failed".

This is the beginning of the /var/log/odoo/odoo-server.log file:

2015-02-07 17:01:47,208 8032 INFO ? openerp.service.server: Initiating shutdown
2015-02-07 17:01:47,209 8032 INFO ? openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
2015-02-07 17:01:49,725 8147 INFO ? openerp: OpenERP version 8.0
2015-02-07 17:01:49,725 8147 INFO ? openerp: addons paths: ['/opt/odoo/.local/share/Odoo/addons/8.0', u'/opt/odoo/odoo-server/addons', u'/opt/odoo/custom/addons', '/opt/odoo/odoo-server/openerp/addons']
2015-02-07 17:01:49,725 8147 INFO ? openerp: database hostname: localhost
2015-02-07 17:01:49,725 8147 INFO ? openerp: database port: 5432
2015-02-07 17:01:49,725 8147 INFO ? openerp: database user: odoo
2015-02-07 17:01:50,154 8147 INFO ? openerp.service.server: HTTP service (werkzeug) running on
2015-02-07 17:01:58,203 8147 INFO ? openerp.addons.bus.bus: Bus.loop listen imbus on db postgres
2015-02-07 17:01:58,207 8147 ERROR ? openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
  File "/opt/odoo/odoo-server/openerp/sql_db.py", line 522, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: Aucun fichier ou dossier de ce type
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

The Odoo configuration file (/etc/odoo-server.conf) is:

; This is the password that allows database operations:
admin_passwd = my_odoo_password
db_host = False
db_port = 5432
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/dist-packages/openerp/addons
logfile = /var/log/odoo/odoo-server.log

In order to install and configure the softwares, I used a modified version of the André Schenkels' script:


I modified it to use a different version of postgresql (the apt postgresql postgresqlpackages did not work).

Could somebody help me please?

I think the problem is in => db_password = False

Mathias Colpaert
on 2/13/15, 5:38 AM

Mathias Colpaert: Hi. I had already tried to change this parameter like this : "db_password = PasswordGivenDuringPostgresqlInstallation", but the result (/var/log/odoo/odoo-server.log) was the same.

Romuald Garibaldi
on 2/13/15, 9:57 AM



| 5 3 6
Jakarta, Indonesia
On 2/13/15, 11:02 AM

First thing to check: You specify db_host as False.  That will cause OpenERP/Odoo to connect using UNIX socket (local) procotocol instead of TCP/IP (host).  So check the /etc/postgresql/XX/main/pg_hba.conf what is the authentication rule for local (if any specifically for the database you are connecting to and/or for user odoo, XX is the version of PostgreSQL).  There are a lot of authentication rule possibilities, you can read more about it from PostgreSQL's documentation, but some of the more commonly used one are:

  • peer: this means only Operating System user with matching Database user (so in your case only if the OS user is odoo) are allowed to connect.  ident have the same meaning for TCP/IP connection.
  • md5: password authentication (you need to specify any Database user along with the password to connect)
  • trust: allow any connection (not recommended)

Adjust the setting accordingly, restart PostgreSQL, restart Odoo/OpenERP and try again.

You need a sudo access to change the setting.


Kristof Hardy
On 2/15/15, 5:10 AM

First of all, I suggest using the install script as is, without  modifying it. (then you would not have this problem, you can always install a different version of PostgreSQL later)

A default pg_hba.conf looks like this, you should not need to change this:

local   all             postgres                                peer
local   all             all                                     peer
host    all             all               md5
host    all             all             ::1/128                 md5

A example of odoo database settings:

; Database settings
db_user = odoo
db_password = odoo_user_password
db_port = 5432
db_host = localhost
db_maxconn = 64
dbfilter = .*


Romuald Garibaldi
On 2/13/15, 9:58 AM

I cannot comment your messages because "30 karma is required to perform this action"… Therefore I edit this message for answer to Hengky Zhang and Ivan. Sorry.

Hi Hengky Zhang.
postgres is running. htop displays:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
 1156 postgres   20   0  199M 11052 10940 S  0.0  0.4  0:00.04 ├─ /opt/PostgreSQL/9.3/bin/postgres -D /opt/PostgreSQL/9.3/data
 1195 postgres   20   0 60260   400   272 S  0.0  0.0  0:00.06 │  ├─ postgres: stats collector process
 1194 postgres   20   0  200M   880   656 S  0.0  0.0  0:00.09 │  ├─ postgres: autovacuum launcher process
 1193 postgres   20   0  199M   304   248 S  0.0  0.0  0:00.10 │  ├─ postgres: wal writer process
 1192 postgres   20   0  199M  1116  1044 S  0.0  0.0  0:00.10 │  ├─ postgres: writer process
 1191 postgres   20   0  199M   260   192 S  0.0  0.0  0:00.00 │  ├─ postgres: checkpointer process
 1175 postgres   20   0 58168   172   156 S  0.0  0.0  0:00.00 │  └─ postgres: logger process


Hi Ivan. /opt/PostgreSQL/9.3/data/pg_hba.conf contains:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                md5
#host    replication     postgres            md5
#host    replication     postgres        ::1/128                 md5

I can change the /etc/odoo-server.conf file like this:


db_password = PasswordGivenToPostgresqlDuringInstallation


I'm going to read this page carefully: http://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html

The solution is near…


I read carefully the auth-pg-hba-conf.html webpage, set pg_hba.conf and restarted postgresql then odoo, but I still have the same server error described in my first message.

As regards pg_hba.conf, I tried this:

local   all             all                             peer

then this:

host    all              all              ident

… but it failed every time. :(

When I add a password to odoo user like this:

ALTER ROLE odoo WITH PASSWORD odoo_user_password_for_postgresql

… and then I modify /etc/odoo-server.conf consequently:

db_password = odoo_user_password_for_postgresql

… before trying different configurations for pg_hba.conf, it fails again.


Kristof Hardy:
I changed:
    db_host = False
    db_password = False
… by:
    db_host = localhost
    db_password = odoo_user_password
… in /etc/odoo-server.conf, then I added a odoo password to postgresql from psql like this:
    ALTER ROLE odoo WITH PASSWORD 'odoo_user_password';
At last I set /opt/PostgreSQL/9.3/data/pg_hba.conf as you recommended:
    local   all             postgres                                peer
    local   all             all                                     peer
    host    all             all               md5
    host    all             all             ::1/128                 md5

It works! :) At last! Great!

Thank everybody to have helped me, especially Kristof Hardy and Ivan.

Hengky Zhang
On 2/13/15, 5:40 AM

check your postgre service is it running or not


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/7/15, 12:27 PM
Seen: 7643 times
Last updated: 3/16/15, 8:10 AM