Project

General

Profile

Actions

Bug #2835

closed

Rudder 2.4.0~beta3 fails to install Rudder server at rudder-reports stage with error message about "connections on Unix domain socket"

Added by Nicolas PERRON over 12 years ago. Updated over 9 years ago.

Status:
Released
Priority:
1 (highest)
Assignee:
Nicolas PERRON
Category:
Packaging
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

During installation, rudder-reports fails with these messages:

[...]
Setting postgresql as a boot service
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/var/tmp/rpm-tmp.aVk9Hl: line 19: [: -ne : opérateur unaire attendu
/var/tmp/rpm-tmp.aVk9Hl: line 22: [: -ne : opérateur unaire attendu
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
psql: n'a pas pu se connecter au serveur : Connexion refusée
    Le serveur est-il actif sur l'hôte « localhost » et accepte-t-il les connexions
    TCP/IP sur le port 5432 ?
warning: %post(rudder-reports-1344966605:2.4.0.beta3-1.EL.6.noarch) scriptlet failed, exit status 2
[...]

It results in a rudder database which is missing and the Webapp can't be started:

[...]
Caused by: 
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (FATAL: password authentication failed for user "rudder")
[...]

[...]
R: @@DistributePolicy@@result_success@@root-DP@@root-distributePolicy@@00@@reports@@None@@2012-08-22 12:15:56-04:00##root@#The OpenLDAP configuration file is OK (checked rootdn password)
psql: FATAL:  password authentication failed for user "rudder" 
 -> Executing '/usr/bin/psql -q -c "ALTER USER rudder WITH PASSWORD '1195d7218ad6'"' ...(timeout=-678,owner=26,group=-1)
 !! Finished command related to promiser "/usr/bin/psql -q -c "ALTER USER rudder WITH PASSWORD '1195d7218ad6'"" -- an error occurred (returned 1)
Q: "...r/bin/psql -q -": ERROR:  role "rudder" does not exist
[...]
Actions #1

Updated by Nicolas PERRON over 12 years ago

  • Status changed from New to In progress

Trying to use rpm with extra verbose mode result in:

+ /etc/init.d/postgresql start
Démarrage du service postgresql : [  OK  ]
+ echo 'Setting postgresql as a boot service'
Setting postgresql as a boot service
+ /sbin/chkconfig --add postgresql
+ /sbin/chkconfig postgresql on
+ dbname=rudder
+ usrname=rudder
++ su - postgres -c 'psql -t -c "select count(1) from pg_catalog.pg_database where datname = '\''rudder'\''"'
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ RES=
++ su - postgres -c 'psql -t -c "select count(1) from pg_user where usename = '\''rudder'\''"'
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ RES2=
+ '[' -ne 0 ']'
/var/tmp/rpm-tmp.Z20J9I: line 20: [: -ne : opérateur unaire attendu
+ '[' -ne 0 ']'
/var/tmp/rpm-tmp.Z20J9I: line 23: [: -ne : opérateur unaire attendu
+ su - postgres -c 'psql -q -c "CREATE USER rudder WITH PASSWORD '\''Normation'\''"'
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ su - postgres -c 'psql -q -c "CREATE DATABASE rudder WITH OWNER = rudder"'
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+ echo localhost:5432:rudder:rudder:Normation
+ chmod 600 /root/.pgpass
+ psql -q -U rudder -h localhost -d rudder -f /opt/rudder/etc/postgresql/reportsSchema.sql
psql: n'a pas pu se connecter au serveur : Connexion refusée
    Le serveur est-il actif sur l'hôte « localhost » et accepte-t-il les connexions
    TCP/IP sur le port 5432 ?
D:   install: waitpid(1552) rc 1552 status 200 secs 16.082
attention: %post(rudder-reports-1344966605:2.4.0.beta3-1.EL.6.noarch) scriptlet failed, exit status 2

If I try to reuse some of these commands:

[root@vagrant-centos-6 ~]# su - postgres -c 'psql -t -c "select count(1) from pg_catalog.pg_database where datname = '\''rudder'\''"'
     0

[root@vagrant-centos-6 ~]# su - postgres -c 'psql -t -c "select count(1) from pg_user where usename = '\''rudder'\''"'
     0

It works perfectly.... What is needed could be a loop to wait until postgresql is truely running.

Actions #2

Updated by Jonathan CLARKE over 12 years ago

I just saw your commit to change the postinst script in packaging, and am rather bothered by this line:

+while [ `ps ax | grep post | grep -v "grep" | wc -l` -lt 5 ]; do echo -n "."; done

This is very lazy matching! "grep post" will match hundreds of processes, and maybe occasionaly the one you want. If you know what process name you're looking for, you should at least use it here (ie /usr/bin/postgresql-master or whatever), but still this is ugly. If you need to test whether you can use the "psql" command, why not just try running a simple query with psql and checking the return code in a while loop until it's 0 ?

Actions #3

Updated by Nicolas PERRON about 12 years ago

Jonathan CLARKE wrote:

I just saw your commit to change the postinst script in packaging, and am rather bothered by this line:

[...]

This is very lazy matching! "grep post" will match hundreds of processes, and maybe occasionaly the one you want. If you know what process name you're looking for, you should at least use it here (ie /usr/bin/postgresql-master or whatever), but still this is ugly. If you need to test whether you can use the "psql" command, why not just try running a simple query with psql and checking the return code in a while loop until it's 0 ?

You're right.
We should use a command like this one:

su postgres -c "psql -q --output /dev/null -c \"SELECT COUNT(*) FROM pg_catalog.pg_authid\"" 

I have to search how to use it il a while loop.

Actions #4

Updated by Jonathan CLARKE about 12 years ago

  • Target version changed from 2.4.0~beta4 to 2.4.0~beta5
Actions #5

Updated by Nicolas PERRON about 12 years ago

  • Status changed from In progress to Pending technical review
  • % Done changed from 0 to 100

Applied in changeset commit:a2be68d33c392babf67a10d2350c3ad560e8b7a2.

Actions #6

Updated by Jonathan CLARKE about 12 years ago

  • Status changed from Pending technical review to Discussion

Nicolas PERRON wrote:

Applied in changeset commit:a2be68d33c392babf67a10d2350c3ad560e8b7a2.

This looks much better Nicolas, thank you.

To go one step further, we should ensure we don't get stuck in this loop forever. The current script will wait in the while loop until PostgreSQL is up... But what if it never comes up? This will block packaging completely. I suggest we fix a timeout, let's say 60 seconds, add a "sleep 1" to each iteration, and use a counter to measure how many times we've been through the loop and "break" from the loop if the timeout is reached.

Actions #7

Updated by Jonathan CLARKE about 12 years ago

  • Target version changed from 2.4.0~beta5 to 2.4.0~beta4

All these commits (including the next one you're about to do :) ) should be included in beta4.

Actions #8

Updated by Jonathan CLARKE about 12 years ago

Last commit looks good - just needs an extra line at the end, in case the while loop succeeds, and prints "....", you need to add:

echo "" 
Actions #9

Updated by Nicolas PERRON about 12 years ago

Jonathan CLARKE wrote:

Last commit looks good - just needs an extra line at the end, in case the while loop succeeds, and prints "....", you need to add:

[...]

It should not be needed as I have use this:

echo -e "\nConnection to PostgreSQL has not been established before timeout" 

Actions #10

Updated by Jonathan CLARKE about 12 years ago

Nicolas PERRON wrote:

Jonathan CLARKE wrote:

Last commit looks good - just needs an extra line at the end, in case the while loop succeeds, and prints "....", you need to add:

[...]

It should not be needed as I have use this:
[...]

Yes, but that's only displayed for a failure. What about a success?

Actions #11

Updated by Nicolas PERRON about 12 years ago

Jonathan CLARKE wrote:

Nicolas PERRON wrote:

Jonathan CLARKE wrote:

Last commit looks good - just needs an extra line at the end, in case the while loop succeeds, and prints "....", you need to add:

[...]

It should not be needed as I have use this:
[...]

Yes, but that's only displayed for a failure. What about a success?

Huh... you're right. I'll correct this

Actions #12

Updated by Jonathan CLARKE about 12 years ago

  • Status changed from Discussion to Released

Thanks, looks good to me.

Actions #13

Updated by Nicolas PERRON about 12 years ago

  • Status changed from Released to New
  • % Done changed from 100 to 90

This bug has not been fixed

Actions #14

Updated by Nicolas PERRON about 12 years ago

  • Status changed from New to Pending technical review

Matthieu or Jon, could you review the last commit (3ee97fb9b3117b1a348bfa38f8afb64d0d3677a1), please ?

Actions #15

Updated by Jonathan CLARKE about 12 years ago

  • Status changed from Pending technical review to Released
  • % Done changed from 90 to 100

Nicolas PERRON wrote:

Matthieu or Jon, could you review the last commit (3ee97fb9b3117b1a348bfa38f8afb64d0d3677a1), please ?

OK for me!

Actions #16

Updated by Nicolas PERRON almost 12 years ago

  • Project changed from Rudder to 34
  • Category deleted (11)
Actions #17

Updated by Benoît PECCATTE over 9 years ago

  • Project changed from 34 to Rudder
  • Category set to Packaging
Actions

Also available in: Atom PDF