Обсуждение: Troubles at Startup
Hello: Although /etc/init.d/postgresql script is listed in each run level startup script at /etc/rc#.d, for some reason completely beyond me, postmaster must be manually started each time I boot up. Any help getting the database server to automatically start at boot up would be appreciated. Thanks, -- Hugh Esco
I'm operating in Debian Woody, with postgreSQL 7.2. -- Hugh At 04:19 PM 11/13/02 -0500, you wrote: >on linux 7.2, I just type "ntsyv" and check the postgres daemon to start >automatically. Don't know about other systems. > >Hugh Esco wrote: >>Hello: >>Although /etc/init.d/postgresql script is listed in each run level >>startup script at /etc/rc#.d, for some reason completely beyond me, >>postmaster must be manually started each time I boot up. Any help >>getting the database server to automatically start at boot up would be >>appreciated. >>Thanks, >>-- Hugh Esco >>---------------------------(end of broadcast)--------------------------- >>TIP 4: Don't 'kill -9' the postmaster >
> I'm operating in Debian Woody, with PostgreSQL 7.2. -- Hugh Hugh- Did you install from the Debian package or compile-your-own? We're running 7.2 on Debian 2.4, and the startup/shutdown script that Oliver Elphick created for the Debian package has worked flawlessly for us. If you did your own install, let me know & I'll send you a copy of the startup script that came with the Debian package off-list. Alternately, I recommend just using the Debian package if you don't mind being one step back from the cutting edge. -Nick
Frankly, I cannot remember. It was before the election that I did it and it has been a very busy few weeks since then. I bookmarked several pg pages in my browsers and suspect that I downloaded and compiled it on my own, instead of using the apt-get utility. Please do send me that script. Thanks. -- Hugh At 09:57 AM 11/14/02 -0500, Nick Fankhauser wrote: > > I'm operating in Debian Woody, with PostgreSQL 7.2. -- Hugh > >Hugh- > >Did you install from the Debian package or compile-your-own? We're running >7.2 on Debian 2.4, and the startup/shutdown script that Oliver Elphick >created for the Debian package has worked flawlessly for us. > >If you did your own install, let me know & I'll send you a copy of the >startup script that came with the Debian package off-list. > >Alternately, I recommend just using the Debian package if you don't mind >being one step back from the cutting edge. > >-Nick
At 12:07 PM 11/13/02 , Hugh Esco wrote: >Although /etc/init.d/postgresql script is listed in each run level startup >script at /etc/rc#.d, for some reason completely beyond me, postmaster >must be manually started each time I boot up. Any help getting the >database server to automatically start at boot up would be appreciated. The problem we had turned out to have nothing to do with the startup, it was the shutdown. If you have a crash or other hurried shutdown, sometimes the ${PGDATA}/postmaster.pid file doesn't get removed. Then the startup will fail. Check you're getting clean shutdowns of the postmaster. You could also check to see if the PID in the postmaster pid file actually exists by using a "kill 0 <pid>" in the startup script. -crl -- Chad R. Larson (CRL22) chad@eldocomp.com Eldorado Computing, Inc. 602-604-3100 5353 North 16th Street, Suite 400 Phoenix, Arizona 85016-3228
Problem solved! When using pg_ctl to make the postmaster see a pg_hba.conf file that had been edited while the database server was running, I got a message that it looked for, but did not find, the psql script in the /usr/lib/postgresql/bin directory. So I copied this file from /usr/bin (where the apt-get install postgresql had installed it) to /usr/lib/postgresql/bin. And while I am still having trouble invoking a psql command line prompt, I am now getting postmaster starting up automatically at boot up, exactly as /etc/rc#.d says it should. Is there some appropriate place I should report this problem to the folks who build and maintain the Debian package for postgresql, so this matter can be handled in future distributions? -- Hugh Esco At 02:07 PM 11/13/02 -0500, Hugh Esco wrote: >Hello: > >Although /etc/init.d/postgresql script is listed in each run level startup >script at /etc/rc#.d, for some reason completely beyond me, postmaster >must be manually started each time I boot up. Any help getting the >database server to automatically start at boot up would be appreciated. > >Thanks, >-- Hugh Esco
On Sat, 2002-11-23 at 15:13, Hugh Esco wrote: > Problem solved! > > When using pg_ctl to make the postmaster see a pg_hba.conf file that had > been edited while the database server was running, I got a message that it > looked for, but did not find, the psql script in the > /usr/lib/postgresql/bin directory. So I copied this file from /usr/bin > (where the apt-get install postgresql had installed it) to > /usr/lib/postgresql/bin. And while I am still having trouble invoking a > psql command line prompt, I am now getting postmaster starting up > automatically at boot up, exactly as /etc/rc#.d says it should. I'm not surprised you're having trouble getting a command line, since you appear to have overwritten the real psql in /usr/lib/postgresql/bin/psql with the symbolic link /usr/bin/psql, which is a link to /usr/bin/pg_wrapper, which tries to call /usr/lib/postgresql/bin/psql. I also don't see how this can make any difference to how postmaster starts up, since postmaster does not use psql at all. > Is there some appropriate place I should report this problem to the folks > who build and maintain the Debian package for postgresql, so this matter > can be handled in future distributions? Debian bug reports in general go to bugs.debian.org. The proper way to report them is to use reportbug (install the reportbug package). Debian PostgreSQL bug reports will come to me, so you needn't bother in this particular case. You never did answer the question whether you could run /usr/lib/postgresql/bin/psql directly. psql is part of the postgresql-client package, not postgresql. It seems to me you should reinstall postgresql-client, and then we can take another look at your situation. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "The LORD is nigh unto all them that call upon him, to all that call upon him in truth." Psalms 145:18
Mr. Elphick: OK. Here is what I got. >hesco@biko:~$ ls -al /usr/bin/psql >lrwxrwxrwx 1 root root 10 Oct 10 16:24 /usr/bin/psql -> >pg_wrapper >hesco@biko:~$ ls -al /usr/bin/pg_w* >-rwxr-xr-x 1 root root 6584 Sep 11 04:30 /usr/bin/pg_wrapper >hesco@biko:~$ ls -al /usr/lib/postgresql/bin/psql >-rwxr-xr-x 1 root root 6584 Nov 21 20:57 >/usr/lib/postgresql/bin/psql So it appears that instead of copying the symbolic link, it copied instead pg_wrapper, renaming it in the new directory as psql. >hesco@biko:~$ /usr/lib/postgresql/bin/psql -U hesco template1 hangs, and spins the hard drive interminably. So I open a second shell and do: >hesco@biko:~$ su postgres >Password: >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql >No database specified >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql template1 and that invocation also hangs, and spins the hard drive interminably. then running top in a third shell shows me: > 512 hesco 10 0 320 320 268 S 2.1 0.5 0:03 psql > 1978 postgres 10 0 320 320 268 S 2.1 0.5 0:00 psql when I Control-C each of those first two shells, the hard drive stops spinning. Then I do the following: >postgres@biko:/home/hesco$ su >Password: >biko:/home/hesco# apt-get remove postgresql-client >Reading Package Lists... Done >Building Dependency Tree... Done >The following packages will be REMOVED: > postgresql postgresql-client >0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded. >Need to get 0B of archives. After unpacking 4530kB will be freed. >Do you want to continue? [Y/n] y >dpkg: conflicting diversions involving `/Package: mysql-common' or >`/Status: ins >tall ok installed' >E: Sub-process /usr/bin/dpkg returned an error code (2) >biko:/home/hesco# apt-get install postgresql-client >Reading Package Lists... Done >Building Dependency Tree... Done >Sorry, postgresql-client is already the newest version. >0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. >biko:/home/hesco# I do not know what to make of these error messages: >dpkg: conflicting diversions involving `/Package: mysql-common' or >`/Status: ins >tall ok installed' >E: Sub-process /usr/bin/dpkg returned an error code (2) -- Hugh Esco At 06:37 PM 11/23/02 +0000, you wrote: >On Sat, 2002-11-23 at 15:13, Hugh Esco wrote: > > Problem solved! > > > > When using pg_ctl to make the postmaster see a pg_hba.conf file that had > > been edited while the database server was running, I got a message that it > > looked for, but did not find, the psql script in the > > /usr/lib/postgresql/bin directory. So I copied this file from /usr/bin > > (where the apt-get install postgresql had installed it) to > > /usr/lib/postgresql/bin. And while I am still having trouble invoking a > > psql command line prompt, I am now getting postmaster starting up > > automatically at boot up, exactly as /etc/rc#.d says it should. > >I'm not surprised you're having trouble getting a command line, since >you appear to have overwritten the real psql in >/usr/lib/postgresql/bin/psql with the symbolic link /usr/bin/psql, which >is a link to /usr/bin/pg_wrapper, which tries to call >/usr/lib/postgresql/bin/psql. > >I also don't see how this can make any difference to how postmaster >starts up, since postmaster does not use psql at all. > > > Is there some appropriate place I should report this problem to the folks > > who build and maintain the Debian package for postgresql, so this matter > > can be handled in future distributions? > >Debian bug reports in general go to bugs.debian.org. The proper way to >report them is to use reportbug (install the reportbug package). Debian >PostgreSQL bug reports will come to me, so you needn't bother in this >particular case. > >You never did answer the question whether you could run >/usr/lib/postgresql/bin/psql directly. > >psql is part of the postgresql-client package, not postgresql. It seems >to me you should reinstall postgresql-client, and then we can take >another look at your situation. > >-- >Oliver Elphick Oliver.Elphick@lfix.co.uk >Isle of Wight, UK http://www.lfix.co.uk/oliver >GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C > ======================================== > "The LORD is nigh unto all them that call upon him, to > all that call upon him in truth." > Psalms 145:18
On Sun, 2002-11-24 at 16:18, Hugh Esco wrote: > So it appears that instead of copying the symbolic link, it copied instead > pg_wrapper, renaming it in the new directory as psql. > > >hesco@biko:~$ /usr/lib/postgresql/bin/psql -U hesco template1 > > hangs, and spins the hard drive interminably. > So I open a second shell and do: > >hesco@biko:~$ su postgres > >Password: > >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql > >No database specified > >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql template1 > > > and that invocation also hangs, and spins the hard drive interminably. > Presumably it will try to call itself recursively. Since it does an exec, each successive process will replace the one before. ... > >biko:/home/hesco# apt-get remove postgresql-client > >Reading Package Lists... Done > >Building Dependency Tree... Done > >The following packages will be REMOVED: > > postgresql postgresql-client > >0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded. > >Need to get 0B of archives. After unpacking 4530kB will be freed. > >Do you want to continue? [Y/n] y > >dpkg: conflicting diversions involving `/Package: mysql-common' or > >`/Status: ins > >tall ok installed' > >E: Sub-process /usr/bin/dpkg returned an error code (2) I don't know what that's about; you probably have some package installed that depends on either mysql or postgresql in some way, but I don't know of any file diversions involving postgresql packages. What have you got in /var/lib/dpkg/diversions? > >biko:/home/hesco# apt-get install postgresql-client > >Reading Package Lists... Done > >Building Dependency Tree... Done > >Sorry, postgresql-client is already the newest version. > >0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. You need to use the --reinstall option if the package is up to date: apt-get --reinstall install postgresql-client Then check the contents of /usr/lib/postgresql/bin. You should have the following real executable files, which are installed by postgresql-client: /usr/lib/postgresql/bin/readpgenv /usr/lib/postgresql/bin/psql /usr/lib/postgresql/bin/createuser /usr/lib/postgresql/bin/createdb /usr/lib/postgresql/bin/dropuser /usr/lib/postgresql/bin/dropdb /usr/lib/postgresql/bin/pg_dump /usr/lib/postgresql/bin/pg_restore You should be able to do the following as user postgres: $ /usr/bin/psql -d template1 or $ /usr/lib/postgresql/bin/psql -d template1 and get a connection in both cases. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Jesus saith unto him, I am the way, the truth, and the life; no man cometh unto the Father, but by me." John 14:6
Oliver Elphick asked: >What have you got in /var/lib/dpkg/diversions? Here is my preliminary answer, plus a question of my own: >biko:/var/lib/dpkg# ls -al | grep diversions >-rw-r--r-- 1 root root 361825 Nov 21 18:48 diversions >-rw-r--r-- 1 root root 361931 Nov 21 18:48 diversions-old >biko:/var/lib/dpkg# wc diversions > 8841 43017 361825 diversions >biko:/var/lib/dpkg# cat diversions | grep Package: > packages.txt >biko:/var/lib/dpkg# ls -al | grep packages.txt >-rw-r--r-- 1 root root 8147 Nov 23 19:44 packages.txt >biko:/var/lib/dpkg# wc packages.txt > 430 860 8147 packages.txt >biko:/var/lib/dpkg# Do you really want to see the whole list? Or is there perhaps something in particular you are looking for? Here is the dialogue for my reinstall attempt. Man, these error messages are starting to look familiar. >biko:/var/lib/dpkg# apt-get --reinstall install postgresql-client >Reading Package Lists... Done >Building Dependency Tree... Done >0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and >0 not up >graded. >Need to get 0B/280kB of archives. After unpacking 0B will be used. >Do you want to continue? [Y/n] y >dpkg: conflicting diversions involving `/Package: mysql-common' or >`/Status: ins >tall ok installed' >E: Sub-process /usr/bin/dpkg returned an error code (2) >biko:/var/lib/dpkg# With more interminable hard disk spinning as my only response to an attempt to once again invoke psql. -- Hugh Esco At 10:41 PM 11/24/02 +0000, you wrote: >On Sun, 2002-11-24 at 16:18, Hugh Esco wrote: > > > So it appears that instead of copying the symbolic link, it copied instead > > pg_wrapper, renaming it in the new directory as psql. > > > > >hesco@biko:~$ /usr/lib/postgresql/bin/psql -U hesco template1 > > > > hangs, and spins the hard drive interminably. > > So I open a second shell and do: > > >hesco@biko:~$ su postgres > > >Password: > > >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql > > >No database specified > > >postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql template1 > > > > > > and that invocation also hangs, and spins the hard drive interminably. > > > >Presumably it will try to call itself recursively. Since it does an >exec, each successive process will replace the one before. >... > > >biko:/home/hesco# apt-get remove postgresql-client > > >Reading Package Lists... Done > > >Building Dependency Tree... Done > > >The following packages will be REMOVED: > > > postgresql postgresql-client > > >0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded. > > >Need to get 0B of archives. After unpacking 4530kB will be freed. > > >Do you want to continue? [Y/n] y > > >dpkg: conflicting diversions involving `/Package: mysql-common' or > > >`/Status: ins > > >tall ok installed' > > >E: Sub-process /usr/bin/dpkg returned an error code (2) > >I don't know what that's about; you probably have some package installed >that depends on either mysql or postgresql in some way, but I don't know >of any file diversions involving postgresql packages. What have you got >in /var/lib/dpkg/diversions? > > > >biko:/home/hesco# apt-get install postgresql-client > > >Reading Package Lists... Done > > >Building Dependency Tree... Done > > >Sorry, postgresql-client is already the newest version. > > >0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. > >You need to use the --reinstall option if the package is up to date: > > apt-get --reinstall install postgresql-client > >Then check the contents of /usr/lib/postgresql/bin. You should have the >following real executable files, which are installed by >postgresql-client: > > /usr/lib/postgresql/bin/readpgenv > /usr/lib/postgresql/bin/psql > /usr/lib/postgresql/bin/createuser > /usr/lib/postgresql/bin/createdb > /usr/lib/postgresql/bin/dropuser > /usr/lib/postgresql/bin/dropdb > /usr/lib/postgresql/bin/pg_dump > /usr/lib/postgresql/bin/pg_restore > >You should be able to do the following as user postgres: > > $ /usr/bin/psql -d template1 > >or > > $ /usr/lib/postgresql/bin/psql -d template1 > >and get a connection in both cases. >-- >Oliver Elphick Oliver.Elphick@lfix.co.uk >Isle of Wight, UK http://www.lfix.co.uk/oliver >GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C > ======================================== > "Jesus saith unto him, I am the way, the truth, and the > life; no man cometh unto the Father, but by me." > John 14:6 > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://archives.postgresql.org
On Mon, 2002-11-25 at 06:58, Hugh Esco wrote: > Oliver Elphick asked: > >What have you got in /var/lib/dpkg/diversions? > > Do you really want to see the whole list? > Or is there perhaps something in particular you are looking for? > Anything relevant to mysql and postgresql > Here is the dialogue for my reinstall attempt. > Man, these error messages are starting to look familiar. > > >biko:/var/lib/dpkg# apt-get --reinstall install postgresql-client ... > >dpkg: conflicting diversions involving `/Package: mysql-common' or > >`/Status: ins > >tall ok installed' > >E: Sub-process /usr/bin/dpkg returned an error code (2) > >biko:/var/lib/dpkg# > > With more interminable hard disk spinning > as my only response to an attempt to once > again invoke psql. Since the reinstall failed, you're still in the same state you were in before. -- Oliver Elphick <olly@lfix.co.uk> LFIX Limited