, ,

Ubuntu – Resolving Package Problems

One of the many ways to resolve package issues in ubuntu ๐Ÿ™‚


sudo apt-get -f install

sudo apt-get update
# to update your package list.

sudo apt-get autoclean
# to clean up any partial packages.

sudo apt-get clean
# to clean up the apt cache.

sudo apt-get autoremove
# will clean up any unneeded dependencies.
#If while doing this you can identify the broken package this code will very forcefully remove it.

# reconfigure software
sudo dpkg --configure -a

sudo dpkg --remove -force --force-remove-reinstreq package name
# Change package name to the real name of course.

# Last resort
sudo apt-get -u dist-upgrade

# If it shows any held packages, it is best to eliminate them.
# Packages are held because of dependency conflicts that apt cannot resolve.
# Try this command to find and repair the conflicts:

sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade

# If it cannot fix the conflicts, it will exit with:

# Delete the held packages one by one, running dist-upgrade each time, until there are no more held packages.
# Then reinstall any needed packages. Be sure to use the --dry-run option,
# so that you are fully informed of consequences:

sudo apt-get remove --dry-run package-name

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.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

The following packages have unmet dependencies:
 libavcodec-extra-54:i386 : Conflicts: libavcodec54:i386 but 6:9.11-2ubuntu2 is to be installed
 libavcodec54:i386 : Conflicts: libavcodec-extra-54:i386 but 6:9.11-2ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

References

1. How to fix broken packages?
2. Fixing software center catalog