Wednesday, September 8, 2010

Ubuntu 10.04: A Manual Approach to Installing the Automated installed-software List

In the process of reinstalling Ubuntu 10.04, I tried using the installed-software approach to automatically reinstall a number of software packages that I had installed on my previous Ubuntu installation.  Unfortunately, this time around, installed-software seemed to be screwing up my installation.  So I decided to see if I could take it apart and do it manually.  I wouldn't have the benefits of an automatic process, but perhaps I could at least get the list of what I had installed previously, and use that to guide me through a faster manual process, without damaging my basic Ubuntu setup.  This post describes that effort.

There seemed to be various versions of the installed-software approach.  One provided by nixCraft was simple enough.  Make the backup list with "dpkg --get-selections > installed-software.log," and then restore it with "dpkg --set-selections < installed-software.log."  Having already made my backup log and installed a new Ubuntu, now I opened installed-software.log.  But, whoa, what a list!  There were thousands of entries.

I decided I could simplify that list in a couple of ways.  First, I ran System > Administration > Update Manager to get the latest and greatest of what I already had.  When I was done running and rerunning that, it occurred to me that I would also want to set up all of the repositories I would be using, so I prepared a webpage describing that process.  Now, in the same folder as where I had the old installed-software.log file, I ran the dpkg step ("dpkg --get-selections > current-software.log) to get a current list.  Now, following skmdu's guidance, I typed this command:

sdiff current-software.log installed-software.log | grep '<' > Differences.log
The resulting Differences.log file contained a much smaller list of perhaps a hundred packages that were in the one list but not the other.  Looking down that short list, I recognized a few that I had uninstalled, or had installed but not used.  Others (e.g., the many lib files) seemed mostly to be supporting packages that would have been installed as part of some other program.  I was going to pick and choose among the few that actually caught my eye as something I should have now, but none did.

Incidentally, at this point, I found a webpage listing a bunch of apt-get commands.  One ("sudo apt-get update") appeared to be the same as the Reload button in Software Sources.  Another ("sudo apt-get clean") would clean up terminated installations.  I suspected that I probably should have run that last command before doing the comparison.

The upshot of this post, then, is that the manual approach did not result in any actual installation or removal of programs.  For that to happen, I would have had to recognize programs that I definitely needed or definitely did not want to have.  I guessed that many of the differences in the two lists were due to the fact that I had not yet installed some major programs (e.g., VMware, Google Earth) that would incidentally require some helper packages.