Why Debian Is Not My Favourite Operating System

30th March 2003

1. Debian Package Management: Frequently Asked Questions
        1.1. How can I add a package?
        1.2. How can I upgrade my installation to the latest version?
        1.3. How can I search for a package?
        1.4. How can I reconfigure an already-installed package?
        1.5. How can I get cutting-edge versions of some packages?
        1.6. How can I keep stable versions of most packages?
        1.7. Why is php4 deleted when I install netpbm?
        1.8. Why can't I reinstall PHP4?
        1.9. How can I downgrade my system back to stable
        1.10. How can I fix ``also in package'' errors?
        1.11. How can I fix another, seemingly identical, error?
        1.12. How can I fix yet another, also seemingly identical, error?
        1.13. How can I fix all the other similar errors?
        1.14. So how the hell are you supposed to downgrade?
        1.15. What's the relationship between apt, dpgk and dselect?
        1.16. Remind me again how easy Debian makes package-management?
2. The Moral
3. Four years later: a solution?

1. Debian Package Management: Frequently Asked Questions

1.1. How can I add a package?

That's easy! Just use:

apt-get install package
  

1.2. How can I upgrade my installation to the latest version?

That's easy! Just use:

apt-get dist-upgrade
  

1.3. How can I search for a package?

That's easy! Just use:
apt-cache search keyword
  

Why not apt-get search keyword?

Shut up, be happy. That's just how it is.

1.4. How can I reconfigure an already-installed package?

That's easy! Just use:
dpkg-reconfigure xserver-xfree86
  

Why not apt-get config xserver-xfree86, or at least apt-reconfigure?

Shut up, be happy. That's just how it is.

1.5. How can I get cutting-edge versions of some packages?

That's easy! Just add the following lines to /etc/apt/sources.list:

deb http://http.us.debian.org/debian testing main contrib non-free
deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free
deb http://security.debian.org testing/updates main contrib non-free
  
Then run apt-get update followed by apt-get package or apt-get dist-upgrade.

1.6. How can I keep stable versions of most packages?

That's easy! Just add the following line to /etc/apt/apt.conf.d/70debconf:

APT::Default-Release "stable";
  
Don't forget the semi-colon or every single APT-related command you try to issue will fail with a nonsensical error message!

1.7. Why is php4 deleted when I install netpbm?

PHP4 is a server-side scripting language for building web applications; NetPBM is a set of conversion utilites and image manipulation programs for bitmap files. I don't have the slightest idea why installing the latter (apt-get install netpbm) should cause the former to be uninstalled (along with a lot of other stuff), but do you know what? That's just how it is. Shut up, be happy.

1.8. Why can't I reinstall PHP4?

After PHP4 hs been removed by installing NetPBM, any attempt to reinstall it fails as follows:

# apt-get install php4
Reading Package Lists... Done
Building Dependency Tree... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:

Sorry, but the following packages have unmet dependencies:
  php4: Depends: libbz2-1.0 but it is not going to be installed
        Depends: libc6 (>= 2.2.4-4) but it is not going to be installed
        Depends: libdb2 (>= 2:2.7.7.0-7) but it is not going to be installed
        Depends: libexpat1 (>= 1.95.2-6) but it is not going to be installed
        Depends: libmm11 but it is not going to be installed
        Depends: libpam0g (>= 0.72-1) but it is not going to be installed
        Depends: libpcre3 but it is not going to be installed
        Depends: zlib1g (>= 1:1.1.4) but it is not going to be installed
        Depends: apache-common (>= 1.3.26) but it is not going to be installed
        Depends: fileutils (>= 4.0-5)
E: Sorry, broken packages
# 
  

Why? That's just how it is, I guess.

1.9. How can I downgrade my system back to stable

One might think that apt-get dist-upgrade/stable would work, but no: the system informs you that you already have the most recent versions of all packages. (And I want to cry out, ``I know that, you moron. That's why I'm trying to downgrade to older versions.'')

However! Turns out that it's easy! Just create the file /etc/apt/preferences with the folllwing contents:

Package: *
Pin: release a=stable
Pin-Priority: 1001
  
and run apt-get dist-upgrade.

It all seems so obvious now. It makes me feel ashamed that I didn't just guess that I had to create this brand new configuration file that I'd never needed before instead of editing either of the two I've already had to mess with.

Once you've done this, though, life is sweet. The upgrade process (really a downgrade) trundles merrily along, until -

1.10. How can I fix ``also in package'' errors?

error processing /hulk/archives/debian-3.0/cd2/pool/main/libp/libpaper/libpaperg_1.1.8_i386.deb (--unpack):
trying to overwrite `/usr/lib/libpaper.so.1.1.2', which is also in package libpaper1
  

That's easy! Just use:

	apt-get -f install
	apt-get dist-upgrade	# again
  

Of course!

1.11. How can I fix another, seemingly identical, error?

dpkg: error processing /hulk/archives/debian-3.0/cd2/pool/main/d/dpkg/dpkg_1.9.21_i386.deb (--unpack):
trying to overwrite `/etc/dpkg/dselect.cfg', which is also in package dselect
  

Well, certainly not with apt-get -f install, anyway.

Try apt-get install dselect

Tread very carefully or you'll break the package-manager.

	dpkg --force-depends -r dselect
	dpkg -i /where/ever/you/keep/packages/dpkg_1.9.21_i386.deb
	apt-get dist-upgrade	# yet again
  
(I learned this from a German posting.)

1.12. How can I fix yet another, also seemingly identical, error?

dpkg: error processing /hulk/archives/debian-3.0/cd2/pool/main/f/fileutils/fileutils_4.1-10_i386.deb (--unpack):
trying to overwrite `/bin/chgrp', which is also in package coreutils
  

apt-get -f install appears to work for this one, but doesn't actually fix anything.

	dpkg --force-depends -r fileutils
	dpkg -i --force-overwrite /where/ever/you/keep/packages/fileutils_4.1-10_i386.deb
	# ignore the 98 lines of warnings
	apt-get dist-upgrade	# yet again ... again!
  
(dpkg -i without the --force-overwrite option won't work this time.)

1.13. How can I fix all the other similar errors?

By careful trial and error on each one.

1.14. So how the hell are you supposed to downgrade?

In short the answer was: Downgrades are not supported.

1.15. What's the relationship between apt, dpgk and dselect?

It sure beats the hell out of me.

1.16. Remind me again how easy Debian makes package-management?

Har har har.

2. The Moral

Never, ever, ever, put testing in your sources.list. Never.

3. Four years later: a solution?

David Batley sent me this email, which contains what might just be a solution to Debian update problems. (I've not yet used it myself, so all disclaimers apply.)

Date: Sun, 15 Apr 2007 12:41:54 +0100
From: David Batley <D.J.Batley@exeter.ac.uk>
To: mike@miketaylor.org.uk
Subject: Apt-get hell - a better solution

Hello

The other day, when using apt-get, I got the dreaded error:

     trying to overwrite ..., which is also in package ...
and came across this on your site
     http://www.miketaylor.org.uk/tech/wxinmfpl/debian.html#1.10
This was some help, but couldn't fix it for my rather odd case (an essential package with changed dependancies)

After a lot of searching, I found this solution which always works! No messing around, just one command:

     apt-get install package-name -o DPkg::options::="--force-overwrite"
This sends --force-overwrite to the dpkg call, and so it overwrites stuff without complaining; but still lets apt handle all the dependency issues.

You could also force all, and ignore pretty much any complaint - which may not always be a good idea:

     apt-get install package-name -o DPkg::options::="--force-all"

If it's not too much to ask, I thought maybe you'd like to update that page so others with the same issue could find the help more easily? It would be great if you could.

Yours
David

Feedback to <mike@miketaylor.org.uk> is welcome!