apt and dpkg

I’ve been needlessly lax in my work here on nerd.cx, as is my wont. I’m much prefer to be active here, adding all of my wee discoveries and tribulations, so I have a better record of them. Perhaps when school calms down.

Anyway, after some recent computer troubles, I was chatting with emma and she mentioned that she uses some command to list her installed packages, and from there can reinstall her system in one big chunk. To me, with two computers, this is a fabulous idea, because if I need to reinstall one of them, I can do it from the installed software image of the other. Very pleasing.

After some poking about I found these two commands, which I think are going to make my life a bunch easier: dpkg --list and apt-show-versions -u. The first is the one that tells me what all I’ve installed – not as easy a thing to remember, even on a stripped-down system, and it is likely to be more than you think. The second is quite handy if, like me, you don’t want to run apt-get upgrade blind. It should be good.

Moving /usr

When I set up my hard drive to take Debian, I didn’t take into account the vast range of software that I was going to find immediately indispensible. So, /usr was on the same partition as /, and it was taking up 1.1 Gb of a 2 Gb partition. That was unsupportable, of course, so I had to move /usr to it’s own wee data fiefdom.

I’ve moved /home a few times, and I have a procedure for that, but I wasn’t sure you could do the same thing with /usr. I asked Arthur, and he pointed out something very important – the editiors are on /usr, and so I had to edit /etc/fstab before renaming /usr. Once I had the order worked out though, it went perfectly. Here is the procedure:

# Set up a partition table on the new hard drive
cfdisk /dev/hdb

# Get a filesystem on the partition
# you're going to use
mkfs.ext2 /dev/hdb1

# Mount the soon-to-/usr partition
mount /dev/hdb1 /mnt/tmp/

# Edit the filesystem table
vi /etc/fstab
# Add the new /usr to the table
/dev/hdb1   /usr    ext2    defaults   1   2

# Get into /usr and prepare to copy
cd /usr

# Single-user mode
# a bare root for low-level maintenance
init 1

# Copy everything into the new /usr
cp -ax * /mnt/tmp/

# Rename /usr so that you can mount
# the new /usr in the right place
mv /usr /usr.old

# Set up the mount point
mkdir /usr

# Cross your fingers


Emma suggested that I try Openbox, and so far I am very pleased. Unlike Blackbox, there are people still working on Openbox, and they are doing a fine job. So far it is not feature-perfect, but it is function-perfect as far as I can tell, and that is really something.

I was pretty happy with Blackbox, but I didn’t like some of the ways that things were configured, especially the fact that I had to elevate my priviledge to edit my menu or style file. Openbox uses locally specified XML files for configuration, and I am very pleased with how that system works. It is especially nice (though it would be good if it were clearly documented) that if you screw up your local settings you will get the default — but fully functional — settings and menu.

My wishlist for Openbox is for better documentation (so I’ve started to write it) and better management of where windows appear. I run two monitors, and the windows will spawn on the left edge of the right screen, which is not where I want them. I’d also like them to appear in columns rather than rows if I so choose. Still, it’s a nice window manager with active participation, and I’m glad to use it.