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.

Here is the steps I've followed to install postgresql on Debian server:

  1. add backports deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free to /etc/apt/sources.list

  2. run sudo apt-get update

  3. run apt-get -t squeeze-backports install postgresql-9.1

I get dependency errors at step #3:

The following packages have unmet dependencies:
postgresql-9.1 : Depends: postgresql-common (>= 115~) but it is not going to be installed

When I add add postgresql-common and run apt-get -t squeeze-backports install postgresql-9.1 postgresql-common, I get the following dependency error:

The following packages have unmet dependencies:
postgresql-common : Breaks: logrotate (>= 3.8) but 3.8.1-4 is to be installed

Is something wrong with my system, or installation steps are incorrect? Is it safe to remove logrotate and let postgresql install the required one?

Here is output for apt-cache policy postgresql-9.1 postgresql-common logrotate: enter image description here That's my output /etc/apt/sources.list: enter image description here And I don't have /etc/apt/preferences: enter image description here

share|improve this question
1  
Please post your /etc/apt/preferences and the output of apt-cache policy postgresql-9.1 postgresql-common logrotate. –  kce Jun 2 '13 at 0:52
    
And your /etc/apt/sources.list. –  kce Jun 2 '13 at 1:31

2 Answers 2

up vote 1 down vote accepted
+50

First there's a subtle but important difference between using the -t switch and the $package/$suite switch:

  • apt-get install <package>/squeeze-backports - This will install from squeeze-backports and dependencies from stable
  • apt-get -t squeeze-backports install <package> - This will install both and dependencies from squeeze-backports.


Just as a first pass try giving the $package/$suite switch as apt-get will then try to install postgresql and postgresql-common from squeeze-backports but not its dependencies (in this case logrotate).

I don't have a Squeeze system to test with, but I think this is what is happening:

Squeeze is no longer the current release of Stable and is now oldstable. Squeeze-backports pulls its packages from the then version of testing (Wheezy) which is now the current Stable. The version of postgresql that you are trying to install is actually from the current version of Stable but was designed to run with most of its dependencies from oldstable (i.e., logrotate 3.7.8-6 from oldstable/squeeze compared to logrotate 3.8.1-4 from stable/wheezy) but since squeeze-backports and wheezy are roughly analogous using the -t switch means that it's trying to pull logrotate from wheezy's repositories for some reason instead of being satisfied with version 3.7.8-6 which is included in oldstable/squeeze. Generally this is caused by either having the wheezy repositories added explicitly with bad apt-pinning policies setup or you have repositories that are pointed at a release-type (stable/testing/unstable) and not a Release (squeeze/wheezy) in which case you have a much larger problem.

You should endeavor to fix your issue by upgrading to Wheezy as it is the current version of Stable. This is the best solution for a whole number of reasons. If you can't or are unwilling to do that, try using the -t switch so you don't pull the dependencies for postgresql from backports or using apt-pinning to pull the required stuff from Wheezy.


I hesitate to update Debian to Wheezy as I can easily break something important on the server.

Unfortunately, you are going to have to upgrade to Wheezy sooner or later. The Debian Security team only provides security patches for oldstable for roughly a year and so you really should already be planning to upgrade to Wheezy at this point. Please don't take this the wrong way, but if you don't have the expertise to do an upgrade you should seek out and hire someone who does.

I think you have two approaches: You can either do an in place upgrade from Squeeze to Wheezy or you can build a new Wheezy-based server and migrate from one to the other. The in place upgrade is actually pretty simple to do provided you have a healthy system to start with. I've seen some boxes that have been upgraded through three or four different release cycles and they work just fine. Make sure you read the release notes carefully and that you test both the upgrade process and your application/s in your development environment prior to doing the upgrade on your production server (which is presumably the one we're talking about). However it sounds like we're not working with a healthy server so I suggest you take the migration path as you'll get a nice clean slate.

It goes without saying that regardless of the path you take to Wheezy, you should already have a verified backup and recovery procedures.


If there is an easier way to solve my problem

Yes. There is an easier way to solve your immediate problem but it doesn't solve the root cause and professionals solve the root cause.

Look at your apt-cache policy results. You're pulling postgresql and postgresql-common from the non-debian apt.postgresql.org repositories but it looks like you have the ones added for Ubuntu (precise-pgdg) instead of Debian Squeeze (squeeze-pgdg) which could have an entirely different set of dependencies. In the case of logrotate it is 3.7.8-6ubuntu5 instead of the 3.7.8-6 from oldstable/squeeze.

Logrotate is being pulled from the Debian Stable repositories which means from Wheezy which is presumably out of sync with the rest of your oldstable/squeeze system. Your postgresql packages from Ubuntu Precise are looking for 3.7.8-6ubuntu5 but the closest you have is 3.8.1-4 from stable/wheezy.

You need to 1) stop using Ubuntu repositories when you're using Debian and 2) figure out what release (Squeeze or Wheezy) you're actually running and change the Stable to that. I suspect that will fix your problem.

That being said, your /etc/apt/sources.list is not at all configured correctly and there is a distinct possibility your server is pretty messed up. You shouldn't have Ubuntu repositories if you're using Debian. Ubuntu is based on Debian but they are two separate beasts and there is an unfortunate amount of advice on the Internet recommending that if you need a certain version of a package or a package that exists in the Ubuntu PPAs but not in the Debian repos to just add the Ubuntu PPAs. This is wrong. Please don't do it or listen to people that recommend it.

You're also tracking a release-type (stable) and not a Release (Squeeze or Wheezy). This means that as soon as Wheezy was released as Stable all of those packages became available. You may already be running Wheezy or some horrible amalgamation of Squeeze and Wheezy. This is also bad.

I really recommend you do a clean install and migrate your application there.


it was modified multiple times by different people

RCS is trivially simple to setup and use. I heartily recommend it for even the smallest of installations. It will help mitigate these problems in the future.

share|improve this answer
    
Thank you for your response! To be honest, I hesitate to update Debian to Wheezy as I can easily break something important on the server. If there is an easier way to solve my problem, I would rather do that. (I added files as you requested.) It could be easily something wrong with /etc/apt/sources.list as it was modified multiple times by different people (( Your help is greatly appreciated! –  Ivan Zamylin Jun 2 '13 at 21:59
    
@IvanZamylin - Please see my edit. –  kce Jun 3 '13 at 6:20
    
Thank you very much! I didn't expect to get such a profound and detailed answer! –  Ivan Zamylin Jun 3 '13 at 8:51

Any time I've come across strange things like this (mainly cascading removals where it has tried to uninstall half my OS) I find aptitude in ncurses mode to be smarter at fixing it.

It seems to look at the whole list at one time in ncurses mode instead of working on the list you typed in the cli one at a time and creating conflicting dependancies.

Just type aptitude at the cli to start. Use / to start a search and + or - to add and remove from the list. Then hit g when your finished.

share|improve this answer

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.