Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
4 Risposte
40606 Visualizzazioni
Avatar
Romuald Garibaldi

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 0.0.0.0:8069
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:

[options]
; 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
addons_path=/opt/odoo/odoo-server/addons,/opt/odoo/custom/addons

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

https://github.com/aschenkels-ictstudio/openerp-install-scripts/blob/master/odoo-v8/ubuntu-14-04/odoo_install.sh

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

Could somebody help me please?

0
Avatar
Abbandona
Mathias Colpaert

I think the problem is in => db_password = False

Romuald Garibaldi
Autore

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.

Avatar
Ivan
Risposta migliore

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.

 

3
Avatar
Abbandona
Avatar
Kristof Hardy
Risposta migliore

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             127.0.0.1/32            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 = .*

 

1
Avatar
Abbandona
Avatar
Hengky Zhang
Risposta migliore

check your postgre service is it running or not

 

0
Avatar
Abbandona
Avatar
Romuald Garibaldi
Autore Risposta migliore

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             127.0.0.1/32            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        127.0.0.1/32            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             127.0.0.1/32           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             127.0.0.1/32            md5
    host    all             all             ::1/128                 md5

It works! :) At last! Great!

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

0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now