Ubuntu: Half installed package nightmare



Question:

At some point, one of my servers stopped writing to its network attached storage device (I presume), and it resulted in a week or more's worth of packages ending up in the "half-installed" state.

What is odd is that apt-get does not report any issues and I was able to get the most recent updates to install as intended.

It was only when I took a look through the logs (dpkg.log*) and found that there was many more packages in this state.

I need a way to go through all of the packages in apt-get or dpkg, and perform an apt-get install <packagename> --reinstall operation.

Unless there is another way to clean up this mess.

Does anybody have any idea on how I can do this? or have any other ideas on how to resolve this issue?


Solution:1

Try sudo dpkg --configure -a. That should automatically repair those packages.

If that doesn't work, try running sudo apt-get install -f and then running sudo dpkg --configure -a again

If you really want to go through each package and reinstall,

And keep in mind, this is definitely not the ideal solution.

Only do this if the sudo dpkg --configure -a command does not work.

This will take a really, really long time since it has to download all the packages again and install them:

for pkg in `dpkg --get-selections | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y --force-yes install --reinstall $pkg ; done  

Source


Solution:2

to Pranav Marathe answer:

   --force-yes         Force yes; this is a dangerous option that will cause apt to         continue without prompting if it is doing something potentially         harmful. It should not be used except in very special situations.         Using force-yes can potentially destroy your system! Configuration         Item: APT::Get::force-yes. This is deprecated and replaced by         --allow-downgrades, --allow-remove-essential,         --allow-change-held-packages in 1.1.       -y, --yes, --assume-yes           Automatic yes to prompts; assume "yes" as answer            to all prompts  and run non-interactively.            If an undesirable situation, such as changing a held package,            trying to install a unauthenticated package            or removing an essential package occurs then apt-get will abort.             Configuration Item: APT::Get::Assume-Yes.  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »