
Failed Ubuntu Package Installation Fix
Source (link to git-repo or to original if based on someone elses unmodified work):
Description:
This is the Preparing Packages Fix.
After many hours manually going through the process of fixing bad installations, I automated the process.
The script fixes the "preparing package" error that can occur during software installations in Ubuntu.
I assume those who use it will have forced their installation to quit, leaving it in a state of disrepair.
The script will stop all DPKG processes, reconfigure DPKG, remove the broken package, and finally remove the lock on DPKG.
To install, copy this script into /home//.gnome2/nautilus-scripts
Replace with your own.
All .folders are hidden ones. The command line ctrl+h will reveal it.
The script requires the exact name of the failed package.
Please rate and leave your thoughts on the script.
Thank you. Last changelog:
After many hours manually going through the process of fixing bad installations, I automated the process.
The script fixes the "preparing package" error that can occur during software installations in Ubuntu.
I assume those who use it will have forced their installation to quit, leaving it in a state of disrepair.
The script will stop all DPKG processes, reconfigure DPKG, remove the broken package, and finally remove the lock on DPKG.
To install, copy this script into /home//.gnome2/nautilus-scripts
Replace with your own.
All .folders are hidden ones. The command line ctrl+h will reveal it.
The script requires the exact name of the failed package.
Please rate and leave your thoughts on the script.
Thank you.
1.1
Compressed script so browser will download script, not just display in window.
Known Issues:
Sometimes the script will not run the package removal process.
Rerunning the script often fixes it.
Ratings & Comments
6 Comments
hi Dear, strange, that you got into such a situation. I didn't get this situation until up to now, although I am running Linux for three years now. The only thing, that I got into trouble with, was openoffice during the development-time of Ubuntu 10.10. I needed this office-solution. But during all the updates, it was pushed out of installation and I had to reinstall that. So this was no real working (doing office-work), I changed over to LinuxMint and this helped me. LinuxMint is an ubuntu-based derivate and this gives so much more possibility than Ubuntu. So I think, I will stay with this distribution. But I also heard and read about the new rumors, that the basic Gnome-Desktop will be pushed out of the Basic system and will be replaced by Unity (the new Desktop of Ubuntu 11.04). I hope, they won't do the same with LinuxMint. On the one hand, Unity is a better alternative to the gnome-shell. But on the other hand, I need the free space on the desktop, for working on it. So I would be happy, if it is posssible, to reinstall the normal Gnome-Session additionally to Unity. Why I won't change over to Gnome-shell? The reason is, that this session does not work properly until up to now and it takes too much space on the desktop. That's why I am not a friend of Gnome-shell. Greetings Karmicbastler
hi together, if I understand the thing right, this script can be run, if a package is not installed completely or even not installed, because of a failure. But then, there is another much easier way to fix this. Just open your Terminal and type in this command: sudo apt-get -f install. This installs the ramining packages. Or if a package remains unconfigured, then you can easily use this command in your Terminal: sudo dpkg --configure pending. Perhaps this also helps, to fix your problems. Greetings Karmicbastler
Hey Karmicblaster, The two commands normally work well, but not if synaptic or update manager has been forced to quit, or an install via terminal is stopped via CTRL+C. When the three force quit, they keep their lock on /var/lib/dpkg In these situations, sudo apt-get -f install is unable to lock the administration directory, and sudo dpkg --configure does not work because the status database is locked by the improperly. Before anything can fix the packages sudo rm /var/lib/dpkg/lock must be run.
I've just downloaded it, but haven't tried it yet. As far as I saw your code it seems like nice and simple script. One thing I think you should implement would be file selection so user doesn't need to type package's name. Also, you could add $LANG to detect user's system language and make it multi-language script. Feel free to download my script and use it for some of your ideas and solutions. Don't forget to read license (tho it will show it during install) and vote for it! ;) Link is bellow this message.
Thanks for your comment! I appreciate your suggestions a lot and will look for ways to implement them. If I understand your first suggestion correctly, I think a file selection window would not be as useful in the event an install from the Software Center or Synaptic fails. I looked at your script and found it very impressive. Multilingual support would be great, but I do not know how to write such script, nor do I have the linguist prowess to do it justice! Thanks again for your suggestions. Please feel free to edit, improve, and contribute to the script in anyway you see fit!
I'm not sure why you think file selection window would not be as useful in the event of install from the Software Center or Synaptic, but I guess you think it's because you need to have root privileges. That also can be done pretty much easy. If you need help making it even better, just PM me, I'd be glad to help! :) Still, this is one pretty nice idea, and I'm sure it will preform as it should! ;)