A Tiny Ubuntu Hack

I’m a happy Ubuntu user and usually upgrade to the latest version within a month or two of its being released. However, things seem to go better when I reinstall the system from scratch (leaving /home untouched of course) rather than upgrading in place. The only annoying thing about this plan is that I then keep tripping across missing packages that I use every day, that are not part of the default package set. My home machine running Ubuntu 10.10 contains 358 packages not part of the default package set, but when I looked at these it turned out that most of them are transitive dependencies. So I wrote a little Perl script that computes the minimal set of packages I need to install to get all the rest and it is just 49:

acroread apt-rdepends bibclean bzr cutils ddd debtree dejagnu delta emacs flex git-core gm-notify googleearth googleearth-package gperf hamster-applet htop imageshack-uploader indent inkscape kvm-pxe latex2html latexdiff libelf-dev libjpeg62-dev liblablgtk2-ocaml liblockfile-simple-perl libpng12-dev libsdl1.2-dev libsys-cpu-perl ocaml ocaml-base ocaml-base-nox openssh-server pdfchain pdfjam pdfsam pdfshuffler python-dev python-matplotlib shutter sqlite3 sun-java6-jdk texlive-math-extra tofrodos ubuntu-restricted-extras valgrind virtualbox-3.2

Of course, package names sometimes change across releases so this list won’t carry over 100%, but even so it should make my next upgrade a bit easier. Here’s the script, which requires apt-cache to be installed and assumes that the CWD contains the files packages_orig.txt and packages_custom.txt that were produced using dpkg -l on a fresh and customized install, respectively.

6 replies on “A Tiny Ubuntu Hack”

  1. When i have to change harddrive, i tipically just use
    dpkg –get-selections and dpkg –set-selections
    (and then an apt-get -u dselect-upgrade to apply the changes)
    …it may bring along some cruft i installed only one time and then never really used, but has always worked quite well for me

  2. I haven’t really looked at your script, but are you looking for the output of this?
    deborphan -a –no-show-section
    That’s the list of packages installed that aren’t there because of a dependency.

Comments are closed.