-   Linux - Server (
-   -   Bugzilla and PostgreSQL unhappy :-( (

LaughingBoy 11-22-2006 06:56 PM

Bugzilla and PostgreSQL unhappy :-( [RESOLVED]
Hi all,

This is a rather specific problem, and one that is perplexing me considerably. I've googled without success, and have hovered around the postgres FAQs hoping for an answer - all without success.

The problem:
Type in localhost/bugzilla in a browser:

Software error:

Can't connect to the database.
Error: FATAL:  Ident authentication failed for user "bugs"

  Is your database installed and up and running?
  Do you have the correct username and password selected in localconfig?

Other Symptoms:

[root@localhost bugzilla]# pwd
[root@localhost bugzilla]# ./

Checking perl modules ...
Checking for          AppConfig (v1.52)  ok: found v1.63
Checking for                        CGI (v2.93)  ok: found v3.15
Checking for        Data::Dumper (any)        ok: found v2.121_08
Checking for        Date::Format (v2.21)  ok: found v2.22
Checking for                        DBI (v1.38)  ok: found v1.52
Checking for          File::Spec (v0.84)  ok: found v3.12
Checking for          File::Temp (any)        ok: found v0.16
Checking for                Template (v2.10)  ok: found v2.15
Checking for          Text::Wrap (v2001.0131) ok: found v2005.082401
Checking for        Mail::Mailer (v1.67)  ok: found v1.74
Checking for        MIME::Base64 (v3.01)  ok: found v3.07
Checking for        MIME::Parser (v5.406)  ok: found v5.420
Checking for                Storable (any)        ok: found v2.15

The following Perl modules are optional:
Checking for                          GD (v1.20)  ok: found v2.35
Checking for Template::Plugin::GD::Image (any)          not found
Checking for        Chart::Base (v1.0)        ok: found v2.4.1
Checking for          XML::Twig (any)        ok: found v3.26
Checking for          GD::Graph (any)        ok: found v1.4308
Checking for GD::Text::Align (any)        ok: found v1.18
Checking for        PatchReader (v0.9.4)  ok: found v0.9.5
Checking for  Image::Magick (any)        ok: found v6.2.8
Checking for        HTML::Parser (v3.40)  ok: found v3.55
Checking for  HTML::Scrubber (any)        ok: found v0.08

If you you want to see graphical bug reports (bar, pie and line charts of
current data), you should install libgd and the following Perl modules:

Template::Plugin::GD: /usr/bin/perl -MCPAN -e 'install "Template::Plugin::GD"'

Checking user setup ...
Removing existing compiled templates ...
Precompiling templates ...

Can't connect to the database.
Error: FATAL:  Ident authentication failed for user "bugs"

  Is your database installed and up and running?
  Do you have the correct username and password selected in localconfig?

So, let's have a look in localconfig:

[root@localhost bugzilla]# pwd
[root@localhost bugzilla]# grep -v "#" localconfig | egrep "[:space:]"
$index_html = 0;
$cvsbin = "/usr/bin/cvs";
$interdiffbin = "/usr/bin/interdiff";
$diffpath = "/usr/bin";
$create_htaccess = 1;
$webservergroup = "apache";
$db_driver = "Pg";
$db_port = 0;
$db_sock = '';
$db_check = 1;
$db_host = 'localhost';
$db_name = 'bugs';
$db_user = 'bugs';
$db_pass = 'bugs';

Note how I've told bugzilla I'm using PostgreSQL by changing the default db_driver to Pg, instead of MySQL.
(Yes, the password will be changed once this is resolved.) How do I know if the account was setup correclty? Let's try logging in directly:

[laughingboy@localhost ~]$ psql bugs bugs
Password for user bugs:
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
          \h for help with SQL commands
          \? for help with psql commands
          \g or terminate with semicolon to execute query
          \q to quit

bugs=> \q

It seems that it can connect to the database "bugs" with the username "bugs" and it even asks for the password. When I enter "bugs" it let's me in. Thus, I'm assuming the PostgreSQL side of things is setup correctly. But, let's check the pg_hba.conf file:
As the postgres user, I've tried with both of the following configurations:

-bash-3.1$ pwd
-bash-3.1$ grep "bugs" pg_hba.conf
local  bugs        bugs          password


-bash-3.1$ grep "bugs" pg_hba.conf
host        bugs        bugs        md5

I've been told it finds the first match and goes with that, so these lines were above all other "rules".

So, this leaves me with a perplexed look on my face - why can I get in directly from the command line, but not from Bugzilla?

Anyone? PLEASE!

P.S. I suppsose I should provide some versioning information...
O.S.: FC6
Kernel: 2.6.18-1.2798.fc6 #1 SMP
bugzilla: bugzilla-2.22-7.fc6
postgresql: postgresql-8.1.4-1.1
apache: Apache/2.2.3

All non-standard packages were done using yumex...

If there's any more information you'd like, please respond.

LaughingBoy 11-23-2006 12:51 AM

Ahhh.... problem fixed.

Turns out by looking at the Postgres log files (found under /var/lib/pgsql/data/pg_log ) I saw the following (more helpful) information:

Originally Posted by postgresql-Thu.log
LOG: could not connect to Ident server at address "::1", port 113: Connection refused
FATAL: Ident authentication failed for user "bugs"

This told me that it was trying to talk via IPv6 ( ::1 means "localhost" in version 6 of the I.P. protocol)

Re-checking the pg_hba.conf file told me I didn't have something to handle IPv6 on localhost. I added a line that read:

host        all                  all                ::1/128 trust
Then as the postgres user (su - --> su - postgres) I told postgres to re read configuration files:

pg_ctl reload
Then the script was able to run to completion and the Bugzilla webpage loaded just fine.

LaughingBoy 11-23-2006 07:34 PM

I have a strange feeling it's due to Fedora's /etc/hosts file having an IPv6 address for localhost. Trouble is, the host name has also been inserted into the localhost (::1) line, so a lookup for "localhost" resolves to an IPv6 address...

All times are GMT -5. The time now is 06:27 AM.