Using apt-get dist-upgrade to upgrade software on a server, I get the following error:
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 28575 files and directories currently installed.)
Preparing to replace debianutils 2.8.4 (using .../debianutils_2.30_i386.deb) ...
Unpacking replacement debianutils ...
dpkg: error processing /var/cache/apt/archives/debianutils_2.30_i386.deb (--unpack):
trying to overwrite `/usr/sbin/add-shell', which is also in package passwd
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/debianutils_2.30_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I got a similar error some minutes prior with another package so I used apt-get remove to remove the package and then apt-get upgrade which seemed to get past that first little problem... Until it hit this next one. I can't use apt-get remove to remove debianutils as this is a core package and will break the system if removed.
Any pointers as to where to go from here?
The problem is that both debianutils and passwd both contain the same file (/usr/sbin/add-shell). I'm a little confused as to how you've got 2.8.4 installed, as it's not in any released version of Debian and was created in 2004. Are you trying to upgrade from a sarge box? You should be upgrading to etch, then lenny. Upgrading between more than one version is not supported.
This may end badly, but you can fix this by running:
but you may end up with even more problems. I think you should reconsider why you're upgrading such an old version first.
Try aptitude, it's the new apt-get, but with better problem resolution.
Please read Stephen's comments to this answer regarding not being for the novice and backing up before attempting this.
Ahhh, found what I was looking for:
As far as I can tell, this will remove the passwd package which would normally break the system and shouldn't be considered lightly.
In this particular situation, however, it was necessary because the passwd package was conflicting with another, probably due to upgrading from sarge to lenny (which shouldn't be done), rather than upgrading from sarge to etch and then to lenny. After the initial dist-upgrade was attempted, and failed, the sources.list was changed from stable to etch to attempt to dist-upgrade the system to etch, so a further editing of sources.list, changing etch to lenny, and then dist-upgrading again would fix the problem. It did not. The damage was already done.
The last resort was attempting something that normally should not be done.
I did it.
It worked.
Admittedly I did not, and still do not, know exactly what has gone on under the hood. I can only assume the old conflicting passwd package was removed (without removing dependencies?) leaving the system unstable, then the new passwd package was installed restoring the unstable system back to sanity.
I found the solution on a site that showed the error that I encountered verbatim. There was a large list of user posts thanking the author for the fix explaining that it had worked for them, and no comments were left saying that it didn't (OK, so that doesn't mean that it never did fail). As I was stuck with a broken, un-upgradable system, this was a last resort.
Thanks to the guys that pointed out that this is a "way bad" idea. In this situation, however, with this exact error, I can report that it did fix the problem.