Cleaning up your Ubuntu Installation
Published on April 22nd, 2007 in Ubuntu
After upgrading my Ubuntu 6.10 installation to the newest 7.04 (Feisty Fawn) over a thousand packages were upgraded. So it’s obvious that there were left some dependencies which are not needed anymore. Sure everything still works, but I like to clean up things on Operating Systems I use productively. That’s why I wrote a script to clean up those dependencies with a single command. Here’s what you should do if you want to clean up your Ubuntu Installation (no matter which version) as well:
- Download and install the deborphan package. This is the application that finds unnecessary dependencies: “sudo apt-get install deborphan”
- Execute this command until there are no more dependencies: “apt-get remove $(deborphan)”
Alternatively, you can also put that command into a script, if you don’t want to remember that line:
- Download the script here: del_orph_pkgs.txt
- Change the filename from “del_orph_pkgs.txt” to “del_orph_pkgs.sh” and do a “chmod +x del_orph_pkgs.sh” so we can execute it.
- Execute the script with “sudo del_orph_pkgs.sh” multiple times until it won’t find anymore dependencies. This is necessary, because those libraries, which are not needed anymore, might have dependencies them self, which become obsolete. So another execution cycle will eliminate those as well.
Trackback URL for this post:
http://www.yatblog.com/2007/04/22/cleaning-up-your-ubuntu-installation/trackback/
bonQ.net/flipp » last 10 del.icio.us links April 23rd, 2007
[...] Cleaning up your Ubuntu Installation | Yet another Tech Blog [...]
Mike Hayes April 24th, 2007
Thanks, this seems to work nicely. However, the command “sudo sh del_orph_pkgs.sh” works. You left out the “sh”. Also, how is this different than running “sudo apt-get autoremove”? I’m curious.
Mark Stosberg April 25th, 2007
What’s the difference between this approach and “apt-get autoremove” ?
Martin April 25th, 2007
I’m not quite sure about the differences between apt-get autoremove and deborphan, since I was unable to find any documentation comparing those two. In my experience though, deborphan show me orphaned packages even when apt-get autoremove did not show anything. So I personally, prefer to use deborphan. It has always served me well.
Martin May 3rd, 2007
After today’s updates I ran deborphan and saw some orphaned (unnecessary) packages. Executing “apt-get autoremove” did not clean out any of those! So I guess deborphan really digs deeper into the system. I never have had any bad experiences with removing packages that deborphan suggested, so it’s safe to use IMHO.
Tommy Keswick May 29th, 2007
I ran this today repeatedly like this site said to. I noticed some audio and video codecs on the list of packages to be removed, but I thought they may be old versions. It turned out to not be the case. This method removed important codecs. I could no longer view ID3 tag information in Rhythmbox without it crashing, and I could no longer use MusicBrainz Picard to tag mp3 files after running deborphan.
Micky Mike June 17th, 2007
apt-get autoremove only tracks packages you installed since the newest version of apt-get (the one that has that feature) but deborpahn looks for all orphaned programs. Also, deborphan will freqently remove things as “uneccesary dependencies” which are actually very necessary (this is especially a problem with audio and video libraries for mplayer and the like). Use both with some caution.