Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I upgraded our gentoo server, got lost in the messages and, to make the story short, I ended up removing my postgresql 9.1 BEFORE I run a pg_upgrade to 9.2.. Then I discovered that pg_upgrade requires the binary of the previous version to still be there!

How can I re-install postgresql 9.1 without removing 9.2?

I know I can specify a version with /etc/portage/package.mask

eg.

>dev-db/postgresql-server-9.1.9
<dev-db/postgresql-server-9.1.9

but I'm afraid doing so I would replace the postgresql installed and end up more screwed up than before.

share|improve this question
    
the "slot" keyword helped me find this related question: unix.stackexchange.com/questions/12427/… –  Stefano Apr 13 '13 at 14:42
add comment

2 Answers

up vote 1 down vote accepted

dev-db/postgresql-server is SLOT-ed on the major and minor version, so reinstalling 9.1 should not force a remove of 9.2 (in theory, the dependencies of two SLOTable versions of a package can conflict though and might prevent you from doing so):

$ eix -c postgresql-base --or postgresql-server
[I] dev-db/postgresql-base (9.1.8(9.1)@04/13/2013 9.2.3-r1(9.2)@04/13/2013): PostgreSQL libraries and clients
[I] dev-db/postgresql-server (9.1.8-r1(9.1)@04/13/2013 9.2.3-r1(9.2)@04/13/2013): PostgreSQL server
Found 2 matches.

As you can see, both versions are installed at the same time.

On a side note, to help with unslotted packages, you can use quickpkg to package the currently installed version. The rough workflow would be:

  • quickpkg v2
  • uninstall v2
  • install v1
  • do_your_stuff()
  • update from v1 to v2 using the previously generated binary package (see portages -k/-K switches)

quickpkg has a switch to include the package's config files (--include-config), you probably want to use this as well (see man quickpkg).

Before performing a big bunch of upgrades (tm) you can always quickpkg the most important packages that you think might cause headaches later for some reason (like MySQL, PostgreSQL, Apache, ...), then you can quickly switch back to the earlier version if necessary.

This does not mean that you don't have to have backups of your data (and config files, even when included in your binary package)!

share|improve this answer
    
great tip for quickpkg. I should just make a list of my most-critical packages and always quickpgk before upgrades! –  Stefano Apr 13 '13 at 14:16
    
and fantastic reference to "slotted packages" in gentoo. This I didn't know and it definitely clarifies the concept. Now I'll play with the cli to find the easiest way to select the ones I need... –  Stefano Apr 13 '13 at 14:18
1  
Exactly! It's always good to have quickpkgs of the critical packages handy :-) I just don't understand why your 9.1 version was removed in the first place - did you uninstall it manually before installing 9.2...? –  Adrian Frühwirth Apr 13 '13 at 14:43
1  
no, but I run --depclean without thinking it will remove the previous version (and without paying enough attention to the list, there were just too many things, lazy me!) –  Stefano Apr 13 '13 at 14:50
add comment

Just as a reference, based on Adrian's answer, I fearlessy did a

emerge /dev-db/postgresql-server:9.1

please note that i used :9.1 and not :9.1.9 (latest version) which resulted in a

there are no ebuilds to satisfy "dev-db/postgresql-server:9.1.9"

and got me confused at first.

Now I have them happily living together:

$ equery l postgresql-server
* Searching for postgresql-server ...
[IP-] [  ] dev-db/postgresql-server-9.1.9:9.1
[IP-] [  ] dev-db/postgresql-server-9.2.4:9.2
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.