Language

English

Who's Online

We have 3 guests online

Statistics

Members : 2
Content : 118
Web Links : 23
Content View Hits : 53247

Home Ubuntu Ubuntu FAQs General How to Reinstall all Installed Applications Without Reinstalling Ubuntu
How to Reinstall all Installed Applications Without Reinstalling Ubuntu Print E-mail
Written by myOltrans    Wednesday, 11 November 2009 13:41   

If you need to reinstall your applications due to whatever reason, use this instructions.

I just deleted some files in the lib folder and do not know what exactly are those files. So I do not know which application to reinstall. Reinstalling all applications will insure that all the neccessary files are in the lib folder.

Here is a script that uses dpkg to iterate through and reinstall all packages listed as installed by the package management database. Each package is installed individually; this gets around "package x pre-depends on package y" errors.

Also, the script skips certain packages, namely apt- and dpkg- related packages (because you don't want your package manager to change mid-stream), and packages relating to mysql and mythtv (because these packages don't take too well to non-interactive configuration), also packages that have deinstall status ("| egrep -v deinstall"). Feel free to add your own additional exception patterns to the egrep command embedded within the script.

Because the script reinstalls packages one at a time, it isn't fast, but it does get the job done. On an Intel 2.4GHz Q6600 with 2GB of RAM, a fast SATA-II drive, and using Ubuntu Gutsy (64-bit), the script will reinstall anywhere from 250 to 750 packages an hour, depending on the state of the package cache and other factors.

To use the script, follow the steps below:

Step 0: Backup all of your data.

Step 1: Open a plain text editor, and copy/paste the following code:

 

#!/bin/bash
for pkg in `dpkg --get-selections | egrep -v deinstall | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y install --reinstall $pkg ; done

Important: The commands "for pkg ... done" should all be on the same line.

Step 2: Save the file with an appropriate name, such as:

reinstall_all.sh

Step 3: Open a Bash shell, change the script's owner to "root", and make it executable:

sudo chown root:root reinstall_all.sh
sudo chmod 755 reinstall_all.sh

Step 4: Execute the script:

sudo ./reinstall_all.sh

I hope this helps...

Script based upon solution presented by Tod Detre on debianHELP.org at 2007-09-20 17:00. http://www.debianhelp.org/node/10487

Source: here.


blog comments powered by Disqus
 

© Copyright 2008-2010 Oltrans. Translation Agency Recourse Portal.
All rights reserved Various trademarks held by their respective owners.

Oltrans, 68, Evlogy Georgiev Str., fl. 3, Office 5, Plovdiv 4000 Bulgaria
General Inquiries: (Bulgaria) +359 32 511 272 | skype: Oltrans.org My status