K.Mandla's blog of Linux experiences

Taking out the trash with debfoster

Here’s the deal: You install xorg, and you get a boatload of crap with it.

Maybe calling it crap isn’t fair, but you get a mess of drivers and packages that, chances are, you won’t use. For example, I’m running Feisty on an old 1Ghz laptop with a 64Mb Nvidia Geforce 440 Go. What video drivers could I need? Well, considering I have to patch and compile my own video driver, and allowing for emergencies, I might want nv, vesa and vga — and that’s only if things go horribly, terribly wrong.

But what did I get with xorg? Drivers for just about every card ever made. I’ve got drivers in a default Feisty configuration that I will never, ever, ever use, mostly because it’s impossible for me to put a Matrox video card in my laptop. It’ll never happen, and so having all those drivers is, in simplest terms, a waste of space.

For a desktop user it’s not a big deal. There is the offhand chance that a new video card might be dropped in, or a new sound card or something. And granted, the space taken up by those drivers is not exactly huge. And there’s not much of a case to be made for dumping them.

But if you’re running an old machine on a small hard drive, or if you’re a fellow minimalist and you live to free up space, debfoster can come to your rescue.

Start it up with sudo debfoster -n, and when it asks if you want to keep xorg, say “no.” Don’t say “purge” — that’d pull everything out. Hit CTRL+C if you want to abort.

What’s that do, telling it “no?” It suddenly means everything installed under the xorg metapackage is fair game. And that includes things like xserver-xorg-video-all, xserver-xorg-input-all … and everything underneath those packages. Now you can really clean house. Yank out those darn Wacom drivers. Get rid of the old X utilities, like xcalc or xeyes. Chuck everything but a keyboard, a mouse and the video driver for your machine. You want to talk about saving some space, start with that stuff.

It’s not just the xorg superstructure either. If you don’t use the JFS filesystem, why keep jfsutils? Throw out ubuntu-minimal and ubuntu-standard, and now you can dump all those base-level packages that you never use.

It’s great fun, throwing things away. But of course, this comes with a warning: You can really, really screw up your machine doing this. You can so completely gut your installation as to make it completely and utterly unusable. As in dead. As in Charles-Dickens-Marley-was-dead-to-begin-with dead. And it might play havoc with your upgrades. You might find yourself installing or reinstalling an array of packages, because Ubuntu thinks they’re incomplete.

But there are ways around those issues. My best advice is to practice with a live CD, and see what you can comfortably yank out without destroying your full installation. Start pulling metapackages and then restarting X (yes, you can do that from a live CD). Pull this and delete that. If something doesn’t work, reinstall xorg, or reboot and try again. And when you’ve worked up a short list of candidates, go back to your full installation and start cleaning house.

debfoster remembers what you took out and will try to keep up with the packages you’ve installed and kept. It’s a courtesy, but it’s not one I particularly like … hence the -n flag I gave earlier. That tells it to ignore the list of kept packages it already has, and to start over from the ground up. If you think you’re repeating yourself, leave off the -n flag and debfoster should only run through the packages you’ve installed since the last time you ran it.