PostgreSQL fatal error on install
  • Hi there:



    After searching through all the wiki docs and discussions here on the forums, I need some help in setting up an environment on CentOS.  I'm having some problems installing booktype, specifically getting it to
    work with the postgresql install.  I've followed the instructions up to
    the point where it's asking for:



    django-admin.py syncdb --noinput



    But I'm getting the following error:



    (mybooktype)[root@washu mybook]# django-admin.py syncdb --noinput

    Syncing...

    Traceback (most recent call last):

      File "/home/booktype/mybooktype/bin/django-admin.py", line 5, in <module>

        management.execute_from_command_line()

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/__init__.py",
    line 429, in execute_from_command_line

        utility.execute()

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/__init__.py",
    line 379, in execute

        self.fetch_command(subcommand).run_from_argv(self.argv)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/base.py",
    line 191, in run_from_argv

        self.execute(*args, **options.__dict__)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/base.py",
    line 220, in execute

        output = self.handle(*args, **options)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/base.py",
    line 351, in handle

        return self.handle_noargs(**options)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/south/management/commands/syncdb.py",
    line 90, in handle_noargs

        syncdb.Command().execute(**options)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/base.py",
    line 220, in execute

        output = self.handle(*args, **options)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/base.py",
    line 351, in handle

        return self.handle_noargs(**options)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/core/management/commands/syncdb.py",
    line 56, in handle_noargs

        cursor = connection.cursor()

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/db/backends/__init__.py",
    line 250, in cursor

        cursor = self.make_debug_cursor(self._cursor())

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py",
    line 140, in _cursor

        self.connection = Database.connect(**conn_params)

      File
    "/home/booktype/mybooktype/lib/python2.6/site-packages/psycopg2/__init__.py",
    line 164, in connect

        conn = _connect(dsn, connection_factory=connection_factory,
    async=async)

    psycopg2.OperationalError: FATAL:  Ident authentication failed for user
    "booktype"



    (mybooktype)[root@washu mybook]# python -c "import django; print
    django.get_version()"

    1.3

    (mybooktype)[root@washu mybook]# python --version

    Python 2.6.6





    I've set the conf file for postgres to even accept full trust for the
    booktype user and still it kicks back with the ident auth failed for
    booktype.  I'm not primarily a postgres user, but I do use mysql quite a
    bit.



    Here's the pg_hba.conf file:



    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD



    # "local" is for Unix domain socket connections only

    local   all         all                               ident

    # IPv4 local connections:

    host    all         all         127.0.0.1/32          ident

    # IPv6 local connections:

    host    all         all         ::1/128               ident



    local   booktype        booktype                        trust



    I realize that it says md5 in the manual, but I wanted to see if it
    would work with trust turned on (meaning password not required,
    according to the postgres docs) and it still didn't work.



    Any help would be greatly appreciated.



    Thanks!
    Post edited by Michael Garcia at 2013-12-27 15:19:46
  • 2 Comments sorted by
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Michael, first I would suggest confirming that the booktype database has been created correctly and that the booktype user can access it on the command line.

    The error message indicates that ident has failed, but this is not the method you have specified on the final line of pg_hba.conf (md5 or trust). So it one of the lines above, for local connections, that is causing this error. Postgres is using the first matching line and ignoring the line you have added at the end.

    Possibly CentOS sets ident for these lines by default, which has to do with the shell user account, whereas Debian/Ubuntu set md5 by default. There is a detailed explanation of this issue at http://www.depesz.com/2007/10/04/ident/

    Let us know how you get on! If you have tips for CentOS, we can add these to the Booktype manual.

    Cheers!

    Daniel
  • I'm having the exact same "FATAL:  Ident authentication failed for user "booktype" problem running django-admin.py syncdb --noinput on a virgin CentOS 6.5 install.

    (mybooktype)[root@Test11 mybooktype]# su - postgres
    -bash-4.1$ psql
    psql (8.4.20)
    Type "help" for help.

    postgres=# \du
                List of roles
     Role name | Attributes  | Member of
    -----------+-------------+-----------
     booktype  |             | {}
     postgres  | Superuser   | {}
               : Create role  
               : Create DB    

    postgres=#

    postgres=# \l
                                      List of databases
       Name    |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges  
    -----------+----------+----------+-------------+-------------+-----------------------
     booktype  | booktype | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
     postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
     template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                                 : postgres=CTc/postgres
     template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                                 : postgres=CTc/postgres
    (4 rows)

    postgres=#
     postgres-# \q
    -bash-4.1$ exit
    logout




    (mybooktype)[root@Test11 mybooktype]# netstat -nxl | grep PGSQL
    unix  2      [ ACC ]     STREAM     LISTENING     92473  /tmp/.s.PGSQL.5432
    (mybooktype)[root@Test11 mybooktype]#


    I don't know postgresql (just googled for commands to verify user and booktype db -- which seems to exist).

    I made sure the booktype entry in  /var/lib/pgsql/data/pg_hba.conf was the first entry:

    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

    # From booktype install instructions:
    local   booktype    booktype                      md5

    # "local" is for Unix domain socket connections only
    local   all         all                               ident
    # IPv4 local connections:
    host    all         all         127.0.0.1/32          ident
    # IPv6 local connections:
    host    all         all         ::1/128               ident



    As this didn't work, I changed /var/lib/pgsql/data/pg_hba.conf to permit all for both unix sockets and tcp/ip sockets (which the original poster also seems to have done):

    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

    local   booktype    all                      trust
    host    booktype    all    0.0.0.0/0             trust


    That, (and removing the entry altogether) didn't work either. I then tried connecting via psql (with and without forced password):

    (mybooktype)[root@Test11 mybooktype]# psql --dbname=booktype --username=booktype -W
    Password for user booktype:
    psql: FATAL:  Ident authentication failed for user "booktype"


    Again, no success. In an act of desperation, I changed the postgres permissions to disable security altogether (note the absence of a booktype definition):
     
    # "local" is for Unix domain socket connections only
    local   all         all                               trust
    # IPv4 local connections:
    host    all         all         127.0.0.1/32          trust
    # IPv6 local connections:
    host    all         all         ::1/128               trust

    This seems to work for (a) logging in with psql from the command line, as well as (b) running the script. Obviously. this does not solve the problem of giving booktype correct permissions, but it allows newbies like me to continue with the installation.

    Post edited by Ruedi Aschwanden at 2014-03-29 13:31:04