Cleanup broken package

I tried to downgrade the flashplugin to the previous 9 release, but all .deb installer packages I found on the web fail, cause they try to download a non-existing file from Macromedia website.

The problem I run into was that my Ubuntu system thought that the flashplugin-nonfree package was installed on the system, but I always failed to remove it with aptitude, apt-get or synaptic, leaving the package marked as broken.

Couldn't reinstall, nor purge, nor install any other package, because my system always claimed about the flashplugin-nonfree package.

Errors like these appeared:
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Finally, I found some instructions which are able to remove the package information completely from the system, leaving apt in a state, where the package isn't marked as installed nor broken.

Install instructions

sudo rm -rf /var/lib/dpkg/info/flashplugin-nonfree.*
sudo dpkg --remove --force-depends --force-remove-reinstreq flashplugin-nonfree

Just replace flashplugin-nonfree with any package name that gives you trouble.

Global problems with the package repository

Sometimes you might not be able to install any package and you receive strange errors, like this:
Could not initialize the package information
A unresolvable problem occurred while initializing the package information.
Please report this bug against the 'update-manager' package and include the following error message:
'E:Encountered a section with no Package: header, E:Problem
 with MergeList 
/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_hardy-updates_multiverse_binary-i386_Packages,
 E:The package lists or status file could not be parsed or opened.'
Somehow, apt's internal package repository cache got corrupted, so with the following commands you can recreate it from scratch.
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
Now, you should be able to install packages as usual.

Trying to install from an outdated repository

It might be even worse, your Ubuntu version is an old release and is not supported any longer.
In that case, it's repositories are moved to an archive server.
You get errors like:
Reading package lists... Done               
Building dependency tree       
Reading state information... Done    
E: Couldn't find package xyz

But your package is probably available at http://old-releases.ubuntu.com
 The reason for this is that it is now out of support and no longer receiving updates and security patches.
If you don't want to upgrade to a newer distribution but want to continue using your outdated release then edit /etc/apt/sources.list and change archive.ubuntu.com to old-releases.ubuntu.com
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update

1 comment: