[rt-users] rt206 make install fails to connect to Pg ..

Ashley Gould agould at aslab.com
Fri Sep 14 15:05:09 EDT 2001


I've been meaning to post this.  I had your problem.  Here is the fix:


I editid the file bin/initacls.Pg again:
I took out the flags for port and host:

rt:/usr/local/build/rt # cat bin/initacls.Pg
#!/bin/sh

DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7

BINDIR=${DATABASEHOME}/bin


PATH=$PATH:$BINDIR
export PATH

echo "Enter the postgres administrator's database password to create a
new user 
#psql -h $HOSTNAME -p $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN 
psql  -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN 



Now it installs completely. yey





I've attached notes for my whole adventure.  My guess is not specifying a
port in config.pm brakes the install for postgresql.  Jesse?





Ashley Gould		
Technical Support	
ASL, Inc.
techsupport at aslab.com	
Support	(510)857-0057
Fax	(510)857-0010




On Mon, Sep 10, 2001 at 09:52:01PM -0400, Harold Sinclair wrote:
> Hello
> 
> I fail when trying to open a connection to Postgres database during 'make install'.
> 
> tools/initdb fails; it looks like the variables it's getting are correct, I just can't tell how to further debug it.
> 
> My problem is somewhat similar to what was described in this post,
> http://lists.fsck.com/pipermail/rt-users/2001-June/002570.html
> but I did not see this thread conclude with a resolution!
> 
> I have tried both specifying the password for user postgres in rt's
> Makefile, and leaving it blank to no avail, while changing it at the
> OS level to match each case.
> 
> My Postgres install seems fine, that is, I can do other operations as
> user postgres with no problem, such as creating a test database.
> Postgres is running and the socket is up.
> 
> Maybe set up TCP/IP connect?  Could it be my DBIx version is broken?
> 
> 
> Output of 'make install'
> ======================================================
> 
> # make install
> mkdir -p /opt/rt2/bin
> mkdir -p /opt/rt2/WebRT/data
> mkdir -p /opt/rt2/WebRT/sessiondata
> mkdir -p /opt/rt2/etc
> mkdir -p /opt/rt2/lib
> mkdir -p /opt/rt2/WebRT/html
> mkdir -p /opt/rt2/local/WebRT/html
> /usr/bin/perl   tools/initdb 'Pg' '/usr/local/pgsql' 'localhost' '' 'postgres' 'rt2' create
> Now creating a database for RT.
> Enter the Pg password for postgres:
> Creating Pg database rt2.
> DBI->connect(dbname=template1;host=localhost) failed: PQconnectPoll() -- connect() failed: Connection refused at /usr/lib/perl5/site_perl/5.6.0/DBIx/DataSource/Driver.pm line 74
> PQconnectPoll() -- connect() failed: Connection refused at /usr/lib/perl5/site_perl/5.6.0/DBIx/DataSource/Driver.pm line 74, <STDIN> line 1.
> make: *** [createdb] Error 255
> ======================================================
> 
> Do I have a bad version of DBIx? Did I miss something in the docs?
> I really would appreciate any of your comments as I am dying to get this up and running.
> My version info is below -- and thanks very much,
> 
> -Harold
> 
> RT and System Version information
> ======================================================
> perl -MDBD::Pg -e 'print $DBD::Pg::VERSION'
> 1.01
> 
> perl -MDBD::mysql -e 'print $DBD::mysql::VERSION'
> 2.0415
> 
> RT v2.0.6
> postgresql-7.1.3
> perl 5.6.0
> (SuSE) Linux andalus 2.2.18 #1 Wed Jan 24 12:28:55 GMT 2001 i686 unknown
> 
> My SMTP server, postfix, runs locally and works just fine, though I haven't gotten as far as using with RT.
> 
> And the other pieces look good -- I just got them from CPAN yesterday:
> 
> andalus:/home/hsinclai/test/rt-2-0-6 # make testdeps
> /usr/bin/perl ./tools/testdeps -warn Pg
> Checking for DBI 1.18 ...found
> Checking for DBIx::DataSource 0.02 ...found
> Checking for DBIx::SearchBuilder 0.40 ...found
> Checking for HTML::Entities...found
> Checking for MLDBM...found
> Checking for Net::Domain...found
> Checking for Net::SMTP...found
> Checking for Params::Validate 0.02 ...found
> Checking for HTML::Mason 0.896 ...found
> Checking for CGI::Cookie 1.20 ...found
> Checking for Apache::Cookie...found
> Checking for Apache::Session 1.53 ...found
> Checking for Date::Parse...found
> Checking for Date::Format...found
> Checking for MIME::Entity 5.108 ...found
> Checking for Mail::Mailer 1.20 ...found
> Checking for Getopt::Long 2.24 ...found
> Checking for Tie::IxHash...found
> Checking for Text::Wrapper...found
> Checking for Text::Template...found
> Checking for File::Spec 0.8 ...found
> Checking for Errno...found
> Checking for FreezeThaw...found
> Checking for File::Temp...found
> Checking for Log::Dispatch 1.6 ...found
> Checking for DBD::Pg  ...found
> 
> __END__
> 
> 
> 
> 
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
-------------- next part --------------
Installing rt 2.0.6 on rt.aslab.com  	9/4444/2001

system is unchanged since 3rd_try.


Step 1
rt:/usr/local/build # ln -s rt-2-0-6/ rt
rt:/usr/local/build # cd rt
rt:/usr/local/build/rt # ll
total 373
drwxr-xr-x   10 root     root          304 Sep  1 15:23 .
drwxr-xr-x    9 root     root          254 Sep  4 14:22 ..
-rwxr-xr-x    1 root     root        17976 Apr 16  1998 COPYING
drwxr-xr-x    2 root     root          123 Sep  1 15:23 CVS
-rw-r--r--    1 root     root       325246 Sep  1 15:23 ChangeLog
-rw-------    1 root     root        11083 Sep  1 15:23 Makefile
-rwxr-xr-x    1 root     root        10874 Aug 21 20:48 README
-rwxr-xr-x    1 root     root          335 Jul 30 00:49 TODO
drwxr-xr-x    3 root     root          303 Sep  1 15:23 bin
drwxr-xr-x    4 root     root          154 Sep  1 15:23 docs
drwxr-xr-x    3 root     root          259 Sep  1 15:23 etc
drwxr-xr-x    4 root     root          196 Sep  1 15:23 lib
drwxr-xr-x    3 root     root          133 Sep  1 15:23 t
drwxr-xr-x    3 root     root          126 Sep  1 15:23 tools
drwxr-xr-x   10 root     root          287 Sep  1 15:23 webrt




Step 2
rt:/usr/local/build/rt # diff Makefile Makefile.dist 
35,36c35
< #RT_PATH                      =       /opt/rt2
< RT_PATH                       =       /usr/local/rt2
---
> RT_PATH                       =       /opt/rt2
58,59c57
< #RT_LOG_PATH             =       /tmp
< RT_LOG_PATH             =       /var/log/rt2
---
> RT_LOG_PATH             =       /tmp
98,99c96
< #DB_TYPE              =       mysql
< DB_TYPE               =       Pg
---
> DB_TYPE               =       mysql
117,118c114
< #DB_DBA                  =    root
< DB_DBA                   =    postgres
---
> DB_DBA                   =    root
165,168c161,162
< #WEB_USER                     =       www-data
< #WEB_GROUP                    =       rt
< WEB_USER                      =       wwwrun
< WEB_GROUP                     =       nogroup
---
> WEB_USER                      =       www-data
> WEB_GROUP                     =       rt


Later 
I set the RT_PASS to Morrigen




Step 3
rt:/usr/local/build/rt # make testdeps
/usr/bin/perl ./tools/testdeps -warn Pg
Checking for DBI 1.18 ...found
Checking for DBIx::DataSource 0.02 ...found
Checking for DBIx::SearchBuilder 0.40 ...found
Checking for HTML::Entities...found
Checking for MLDBM...found
Checking for Net::Domain...found
Checking for Net::SMTP...found
Checking for Params::Validate 0.02 ...found
Checking for HTML::Mason 0.896 ...found
Checking for CGI::Cookie 1.20 ...found
Checking for Apache::Cookie...found
Checking for Apache::Session 1.53 ...found
Checking for Date::Parse...found
Checking for Date::Format...found
Checking for MIME::Entity 5.108 ...found
Checking for Mail::Mailer 1.20 ...found
Checking for Getopt::Long 2.24 ...found
Checking for Tie::IxHash...found
Checking for Text::Wrapper...found
Checking for Text::Template...found
Checking for File::Spec 0.8 ...found
Checking for Errno...found
Checking for FreezeThaw...found
Checking for File::Temp...found
Checking for Log::Dispatch 1.6 ...found
Checking for DBD::Pg  ...found




Step 4
rt:/usr/local/build/rt # grep rt /etc/group
rt:x:62:



Step 5

Before running make, I need to change the owberships on the log file:
rt:/var/log # ll /var/log/rt2/
total 2
drwxrwx---    2 root     rt             35 Sep  4 14:12 .
drwxr-xr-x    6 root     root          598 Sep  4 11:52 ..

rt:/usr/local/build/rt # make install
.
.
.
schema sucessfully inserted
cp etc/acl.Pg '/usr/local/rt2/etc/acl.Pg'
/usr/bin/perl -p -i -e " s'!!DB_TYPE!!'"Pg"'g;\
                        s'!!DB_HOST!!'"localhost"'g;\
                        s'!!DB_RT_PASS!!'"rt_pass"'g;\
                        s'!!DB_RT_HOST!!'"localhost"'g;\
                        s'!!DB_RT_USER!!'"rt_user"'g;\
                        s'!!DB_DATABASE!!'"rt2"'g;" /usr/local/rt2/etc/acl.Pg
bin/initacls.Pg '/usr' 'localhost' '' 'postgres' '' 'rt2' '/usr/local/rt2/etc/acl.Pg' 
Enter the postgres administrator's database password to create a new user for rt
psql: PQconnectPoll() -- connect() failed: Connection refused
        Is the postmaster running (with -i) at 'localhost'
        and accepting connections on TCP/IP port '-d'?
make: *** [acls] Error 2


shoot!


I'll enter the postgres dba password in the Makefile:
DB_DBA_PASSWORD   =     asllinux

Made no difference.  Next I edited bin/initacls.Pg:
TABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7

BINDIR=${DATABASEHOME}/bin


PATH=$PATH:$BINDIR
export PATH

echo -h $HOSTNAME -p $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN
echo DBAPASSWD $DBAPASSWD 
echo "Enter the postgres administrator's database password to create a new user for rt"
psql -h $HOSTNAME -p $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN \-W



Again run make install:
.
.
.
bin/initacls.Pg '/usr' 'localhost' '' 'postgres' '"asllinux"' 'rt2' '/usr/local/rt2/etc/acl.Pg' 
-h localhost -p -d rt2 -f /usr/local/rt2/etc/acl.Pg -U postgres
DBAPASSWD "asllinux"
Enter the postgres administrator's database password to create a new user for rt
Password: 


Still fails.  However, I can connect by hand:
rt:/usr/local/build/rt # psql -d rt2 -U postgres -W
Password: 
Welcome to psql, the PostgreSQL interactive terminal.

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

rt2=# 



And if I run the call to psql by hand, It works:
rt:/usr/local/rt2/etc # psql -d rt2 -U postgres -f acl.Pg 
DROP USER
CREATE USER
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
CHANGE
rt:/usr/local/rt2/etc # 




So I editid the file bin/initacls.Pg again:
I took out the flags for port and host:

rt:/usr/local/build/rt # cat bin/initacls.Pg
#!/bin/sh

DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7

BINDIR=${DATABASEHOME}/bin


PATH=$PATH:$BINDIR
export PATH

echo "Enter the postgres administrator's database password to create a new user for rt"
#psql -h $HOSTNAME -p $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN 
psql  -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN 



Now it installs completely. yey





Step 6
First I had to make the config.pm writable:
rt:/usr/local/rt2/etc # ll
total 61
drwxr-xr-x    2 root     rt            167 Sep  4 16:01 .
drwxr-xr-x    8 root     root          153 Aug 31 14:09 ..
-r-x------    1 root     rt           2319 Sep  4 15:50 acl.Pg
-r-xr-x---    1 root     rt          13649 Sep  4 15:50 config.pm
-r-xr-x---    1 root     root        13649 Sep  4 16:00 config.pm.dist
-r-x------    1 root     rt          10918 Sep  4 14:18 config.pm.old
-rwxr-xr-x    1 root     root        12121 Sep  4 15:51 insertdata
rt:/usr/local/rt2/etc # chmod u+w config.pm

rt:/usr/local/rt2/etc # diff config.pm config.pm.dist 
14c14
< $rtname="Asl Support";  
---
> $rtname="example.com";  
20c20
< $Organization = "aslab.com";
---
> $Organization = "example.com";
28c28
< $Timezone =  'US/Pacific'; 
---
> $Timezone =  'US/Eastern'; 
70c70
< $OwnerEmail = 'ashley at aslab.com';
---
> $OwnerEmail = 'root';
92c92
< $MaxAttachmentSize = 2000000;  
---
> $MaxAttachmentSize = 10000000;  
103c103
< $DropLongAttachments = 1;
---
> $DropLongAttachments = undef;





Step 7
Mail gate:

/etc/aliases:

# RT Ticket Tracking system:
rt:     "|/usr/local/rt2/bin/rt-mailgate --queue general --action correspond"
rt-comment: "|/usr/local/rt2/bin/rt-mailgate --queue general --action comment"
support1:           rt
support1-comment:   rt-comment
support2:           rt
support2-comment:   rt-comment
support3:           rt
support3-comment:   rt-comment

rt:/etc # vi aliases
rt:/etc # newaliases 
rt:/etc # postfix reload
postfix-script: refreshing the Postfix mail system





Web interface:
I must change ownership of log file so apache user can write to it:
rt:/var/log # chown wwwrun.rt /var/log/rt2/


Apache config:

MinSpareServers 1
MaxSpareServers 1
StartServers 1

User wwwrun
Group nogroup
ServerAdmin ashley at aslab.com

# First, we configure the "default" to be a very restrictive set of
# permissions.
#
<Directory />
    Options none
    AllowOverride None
</Directory>

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/rt2/WebRT/html">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
#    Allow from 192.168.2.0/24 199.182.25.0/24
#    Deny from all
</Directory>



#
# RT specific rules
#

PerlModule Apache::DBI
PerlRequire /usr/local/rt2/bin/webmux.pl
<Location />
 SetHandler perl-script
 PerlHandler RT::Mason
</Location>



rt:/etc # cat crontab
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons 
59 *  * * *     root  rm -f /var/spool/cron/lastrun/cron.hourly
14 0  * * *     root  rm -f /var/spool/cron/lastrun/cron.daily
29 0  * * 6     root  rm -f /var/spool/cron/lastrun/cron.weekly
44 0  1 * *     root  rm -f /var/spool/cron/lastrun/cron.monthly


# RT ticket tracking system
# Every hour, nuke session files and lockfiles that haven't been 
# touched in 10 hours

0 * * * * find /path/to/rt2/WebRT/sessiondata -type f -amin +600 -exec rm {} \;




Step 8
rt:/usr/local/apache/bin # ./apachectl configtest
Syntax OK
rt:/usr/local/apache/bin # ./apachectl start
./apachectl start: httpd started





DEBUGGING

The web interface came up perfectly.  

My first email bounced with:

Sep  4 16:57:24 rt postfix/local[3256]: 6103B946: to=<rt at rt.aslab.com>,
relay=local, delay=0, status=bounced (Command died with status 255:
"/usr/local/rt2/bin/rt-mailgate --queue general --action correspond". Command
output: Can't do setuid )
        ^^^^^^^^^^^^^^^
-rwxr-xr-x    2 root     root       777442 May 11 08:19 suidperl
rt:/usr/bin # chmod u+s /usr/bin/suidperl 

I must find out who and when this keeps being changed back.  Perhaps 
/etc/permissions.   I set the var in rc.config to "warn".





All Is Well Now




Backups:
rt:/etc # cat crontab
.
.
.
.

# rsync: backup root filesystem to /backup 2:00am nightly
#        exclude /proc /tmp and /backup itself
*  2  * * *     rsync -av --delete --exclude /proc --exclude /backup \
                --exclude /tmp / /backup |tee /tmp/rsync.outlist




More information about the rt-users mailing list