kernel compile = blam!

I just went through a fairly major ordeal with my desktop. I was trying to recompile a kernel the Debian way. “The Debian way” is apparently catastrophic failure. Upon reboot I discovered that my Master Boot Record was so damaged that I was unable to boot to any kernel, and unable to reinstall without formatting the partition flat. Very upsetting. I made several attempts to fix the problem, but nothing worked. I also tried to reinstall onto my secondary hard drive, but ran into similar problems, and my aged motherboard, already flaky, started throwing Drive Errors on boot.

I finally got Debian reinstalled, but with the flaky motherboard I needed something else. What I found was a new motherboard, processor, RAM and case for the same money as a lesser processor. It was significantly faster than what I was used to, though I will still have to look further into CPU-detection, because dmesg is not reporting its full clock speed, but the BIOS, I think, is.

The upshot is that I didn’t use tasksel and I didn’t use dselect to install non-basic packages, so my system is pretty lean. I am always pleased to not have printing daemons installed when I don’t need them. Now of course I want to export my installed packages to a file to keep safe, so I can do one fat apt-get at the beginning of any installation.

There is always lots to do.

apt and dpkg

I’ve been needlessly lax in my work here on, 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