Обсуждение: postgres 8.2 doesn't start after ubuntu upgrade
Hello, I recently upgraded from Ubuntu 8.04 to 8.10. After the OS upgrade I choose to upgrade software as well (all quite automated in ubuntu). Previously I was running postgres 8.2, but now I have postgres 8.3 (and hopefully 8.2 as well). I can run 8.3 and see the dbs (the default ones only; not mine) with psql. But when I try to start 8.2 nothing happens: $ /etc/init.d/postgresql-8.3 start * Starting PostgreSQL 8.3 database server [ OK ] $ /etc/init.d/postgresql-8.3 stop * Stopping PostgreSQL 8.3 database server [ OK ] $ /etc/init.d/postgresql-8.2 start $ /etc/init.d/postgresql-8.2 stop $ You can see I get no response when trying to start 8.2. What can I do? To complicate matters I was using pg_dumpall to daily backup the db and then used rdiff-backup to keep increments. For some reason on August 1, 2008 pg_dumpall went from 50MB output (correct) to a few lines (!?). So I can't simply restore to 8.3 (the last one is from six months ago :(. I do have an image of the hard drive (using partimage) from before the upgrade, but that would be getting pretty desperate to have to go back there. Bryan
Bryan Keith wrote: > I can run 8.3 and see the dbs (the default ones only; not mine) with psql. > I ran into this on an upgrade - however, I didn't do what I'm about to describe, and I lost all my data. Luckily, it wasn't the only place where it was, but there was some development stuff that I had to reaccomplish. Once I had lost it, I discovered the command below... The command you're looking for is pg_upgradecluster. There's a description of it at http://manpages.ubuntu.com/manpages/hardy/man8/pg_upgradecluster.8.html . I believe the only time you'll need this is if you change the major or minor version - for 8.3.5 to 8.3.6, for example, I believe there's no upgrade required. -- Daniel J. Summers *Owner, DJS Consulting* Support <http://support.djs-consulting.com/> • Tech Blog <http://www.djs-consulting.com/linux/blog> daniel@djs-consulting.com <mailto:daniel@djs-consulting.com> • http://www.djs-consulting.com <http://www.djs-consulting.com/> GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ y++++
On Sat, Feb 28, 2009 at 7:54 PM, Daniel J. Summers <daniel@djs-consulting.com> wrote: > Bryan Keith wrote: >> >> I can run 8.3 and see the dbs (the default ones only; not mine) with psql. >> > > I ran into this on an upgrade - however, I didn't do what I'm about to > describe, and I lost all my data. Luckily, it wasn't the only place where it > was, but there was some development stuff that I had to reaccomplish. Once I > had lost it, I discovered the command below... > > The command you're looking for is pg_upgradecluster. There's a description > of it at > http://manpages.ubuntu.com/manpages/hardy/man8/pg_upgradecluster.8.html . I > believe the only time you'll need this is if you change the major or minor > version - for 8.3.5 to 8.3.6, for example, I believe there's no upgrade > required. You're absolutely right. FYI, pg has a different numbering system where the first two digits are pretty much both major numbers. 8.4 and 8.3 are two distinct major versions, and are not binary on disc compatible etc. That means that 8.2 and 8.1 were as different as 8.0 and 7.4 in terms of things like file formatting and catalogues And pg_upgradescluster is a great little bit of code. I wish RedHat had such things. (If they do someone please tell me.)
> On Sat, Feb 28, 2009 at 7:54 PM, Daniel J. Summers > <daniel@djs-consulting.com> wrote: >> Bryan Keith wrote: >>> >>> I can run 8.3 and see the dbs (the default ones only; not mine) with >>> psql. >>> >> >> I ran into this on an upgrade - however, I didn't do what I'm about to >> describe, and I lost all my data. Luckily, it wasn't the only place >> where it >> was, but there was some development stuff that I had to reaccomplish. >> Once I >> had lost it, I discovered the command below... >> >> The command you're looking for is pg_upgradecluster. There's a >> description >> of it at >> http://manpages.ubuntu.com/manpages/hardy/man8/pg_upgradecluster.8.html >> . I >> believe the only time you'll need this is if you change the major or >> minor >> version - for 8.3.5 to 8.3.6, for example, I believe there's no upgrade >> required. > This sounds promising. However, how do I start the cluster? Here's what I did. Remember that trying to start 8.2 doesn't do anything. $ /etc/init.d/postgresql-8.2 start $ pg_upgradecluster 8.2 main Error: specified cluster is not running $ ls /etc/postgresql/8.2 main $ Am I doing something wrong here? Bryan
>> On Sat, Feb 28, 2009 at 7:54 PM, Daniel J. Summers >> <daniel@djs-consulting.com> wrote: >>> >>> The command you're looking for is pg_upgradecluster. There's a >>> description >>> of it at >>> http://manpages.ubuntu.com/manpages/hardy/man8/pg_upgradecluster.8.html >>> . I >>> believe the only time you'll need this is if you change the major or >>> minor >>> version - for 8.3.5 to 8.3.6, for example, I believe there's no upgrade >>> required. >> > > This sounds promising. However, how do I start the cluster? Here's what > I did. Remember that trying to start 8.2 doesn't do anything. > > $ /etc/init.d/postgresql-8.2 start > $ pg_upgradecluster 8.2 main > Error: specified cluster is not running > $ ls /etc/postgresql/8.2 > main > $ > > Am I doing something wrong here? > > Bryan > After thinking about this a little more, I realize that the problem for me is not that the upgrade didn't go well. It's that I can't access my data on 8.2. If upgrading the cluster allows me to access the data, great. If I can access the data on 8,2, that'd be great, too, and then I can worry about upgrading. It looks to me like the data is still there: $ du -shc /var/lib/postgresql/8.2/* 308M /var/lib/postgresql/8.2/main 308M total $ du -shc /var/lib/postgresql/8.3/* 30M /var/lib/postgresql/8.3/main 30M total $ How can I see it? Why won't 8.2 start? Note that I get no message at the prompt when trying to start 8.2. Bryan
Hi Bryan, Bryan Keith wrote: > After thinking about this a little more, I realize that the problem for me > is not that the upgrade didn't go well. It's that I can't access my data > on 8.2. Well, yeah, if your Postgres 8.2 doesn't even start up, you cannot dump the data from it. And pg_upgradecluster does not much more that a dump restore cycle. > If > I can access the data on 8,2, that'd be great, too, and then I can worry > about upgrading. That sounds like a reasonable approach, yeah. > How can I see it? Why won't 8.2 start? Note that I get no message at the > prompt when trying to start 8.2. Is the package postgresql-8.2 still installed? Or did the Ubuntu upgrade automatically deinstall that? What does the log in /var/log/postgresql/8.2/... say? Regards Markus Wanner
> > Is the package postgresql-8.2 still installed? I don't know. Maybe not. How can I tell? > Or did the Ubuntu upgrade > automatically deinstall that? What does the log in > /var/log/postgresql/8.2/... say? The last lines of the latest non-empty 8.2 log file are: $ sudo tail -n 15 /var/log/postgresql/postgresql-8.2-main.log.1 2009-02-24 14:01:51 MST LOG: shutting down 2009-02-24 14:01:51 MST LOG: database system is shut down 2009-02-24 14:01:52 MST LOG: could not load root certificate file "root.crt": no SSL error reported 2009-02-24 14:01:52 MST DETAIL: Will not verify client certificates. 2009-02-24 14:01:52 MST LOG: database system was shut down at 2009-02-24 14:01:51 MST 2009-02-24 14:01:52 MST LOG: checkpoint record is at 0/3222C388 2009-02-24 14:01:52 MST LOG: redo record is at 0/3222C388; undo record is at 0/0; shutdown TRUE 2009-02-24 14:01:52 MST LOG: next transaction ID: 0/2559565; next OID: 29907 2009-02-24 14:01:52 MST LOG: next MultiXactId: 1; next MultiXactOffset: 0 2009-02-24 14:01:52 MST LOG: database system is ready 2009-02-24 14:01:52 MST LOG: incomplete startup packet 2009-02-24 14:35:59 MST LOG: incomplete startup packet 2009-02-24 14:35:59 MST LOG: received fast shutdown request 2009-02-24 14:35:59 MST LOG: shutting down 2009-02-24 14:35:59 MST LOG: database system is shut down $ The last entries in the log file are from the day of the upgrade. So I'm guessing postgres 8.2 isn't installed. I guess now the questions are: How can I install postgres 8.2 without messing up the data in /var/lib/postgresql/8.2/main? Can I just copy that to a new location and copy it back after the installation? Or...? How do I install postgres 8.2? I think I installed 8.2 with something like sudo apt-get install postgresql, but that will install 8.3 now, I think. Thank you everyone for the help. Bryan > > Regards > > Markus Wanner >
Bryan Keith wrote: >> Is the package postgresql-8.2 still installed? >> > > I don't know. Maybe not. How can I tell? > Try dpkg --list 'postgres*' You'll see several packages - the first column will tell you the status of the package. (There's a key at the top of the output.) -- Daniel J. Summers *Owner, DJS Consulting* Support <http://support.djs-consulting.com/> • Tech Blog <http://www.djs-consulting.com/linux/blog> daniel@djs-consulting.com <mailto:daniel@djs-consulting.com> • http://www.djs-consulting.com <http://www.djs-consulting.com/> GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ y++++
Hi, Bryan Keith wrote: > How can I install postgres 8.2 without messing up the data in > /var/lib/postgresql/8.2/main? The way Postgres packages for Debian (and Ubuntu) are built, that's no problem. Just install postgresql-8.2 again. After the upgrade, you can remove the package and the data directory (after having made sure you don't need it anymore). > Can I just copy that to a new location and copy it back after the > installation? Or...? Not necessarily required, but having a backup is always a good thing. > How do I install postgres 8.2? I think I installed 8.2 with something > like sudo apt-get install postgresql, but that will install 8.3 now, I > think. Try: sudo apt-get install postgresql-8.2 I'm not sure about Ubuntu. Probably 8.2 isn't included in Intrepid anymore. (packages.ubuntu.com is currently not responding) (Why don't you stay at a LTS ubuntu version for a database server?) If that's the case, try adding the Hardy Heron repository back to /etc/apt/sources.list. If postgres-8.2 isn't available on Intrepid Ibex, it then falls back to that from Hardy Heron. After having installed that, you should be able to access your Postgres 8.2 data again. You can then do a dump/restore cycle to migrate from 8.2 to 8.3. You might want to check out pg_upgradecluster for that. Good Luck Markus Wanner
>> How do I install postgres 8.2? I think I installed 8.2 with something >> like sudo apt-get install postgresql, but that will install 8.3 now, I >> think. > > Try: sudo apt-get install postgresql-8.2 > > I'm not sure about Ubuntu. Probably 8.2 isn't included in Intrepid > anymore. (packages.ubuntu.com is currently not responding) (Why don't > you stay at a LTS ubuntu version for a database server?) > > If that's the case, try adding the Hardy Heron repository back to > /etc/apt/sources.list. If postgres-8.2 isn't available on Intrepid Ibex, > it then falls back to that from Hardy Heron. It looks to me like postgresql-8.2 is still available in the hardy repositories: http://packages.ubuntu.com/hardy/misc/postgresql-8.2 but I can't figure out what lines to add to /etc/apt/sources.list to find the repository. I keep getting this error: $ sudo apt-get install postgresql-8.2 Reading package lists... Done Building dependency tree Reading state information... Done Package postgresql-8.2 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package postgresql-8.2 has no installation candidate $ I even put the entire old (from hardy) file into sources.list, but that didn't work. sources.list looked like this at that point: deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted deb http://us.archive.ubuntu.com/ubuntu/ hardy universe deb-src http://us.archive.ubuntu.com/ubuntu/ hardy universe deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse deb http://security.ubuntu.com/ubuntu hardy-security main restricted deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted deb http://security.ubuntu.com/ubuntu hardy-security universe deb-src http://security.ubuntu.com/ubuntu hardy-security universe deb http://security.ubuntu.com/ubuntu hardy-security multiverse Same error. Any suggestions? Bryan
Hi, Bryan Keith wrote: > It looks to me like postgresql-8.2 is still available in the hardy > repositories: Yeah, it certainly is in Hardy, but not in Intrepid, as the packages.ubuntu.com website confirmed me now. > Same error. Any suggestions? Did you just forget an "apt-get update" in between? Hardy certainly ships postgresql-8.2. Regards Markus Wanner
>>> How do I install postgres 8.2? I think I installed 8.2 with something >>> like sudo apt-get install postgresql, but that will install 8.3 now, I >>> think. >> >> Try: sudo apt-get install postgresql-8.2 >> >> I'm not sure about Ubuntu. Probably 8.2 isn't included in Intrepid >> anymore. (packages.ubuntu.com is currently not responding) (Why don't >> you stay at a LTS ubuntu version for a database server?) >> >> If that's the case, try adding the Hardy Heron repository back to >> /etc/apt/sources.list. If postgres-8.2 isn't available on Intrepid Ibex, >> it then falls back to that from Hardy Heron. > > but I can't figure out what lines to add to /etc/apt/sources.list to find > the repository. I keep getting this error: > > $ sudo apt-get install postgresql-8.2 > Reading package lists... Done > Building dependency tree > Reading state information... Done > Package postgresql-8.2 is not available, but is referred to by another > package. > This may mean that the package is missing, has been obsoleted, or > is only available from another source > E: Package postgresql-8.2 has no installation candidate > $ > OK, there's an extra step that I was missing. Any changing the sources in sources.list, I needed to run [code]sudo apt-get update[/code] Now I have postgres 8.2 installed, and I can see my old databases. I'll try the upgrading, backup, and all that, and let you know how it goes. Thank you everyone for all the help. Bryan