Archive for April 2011

Fixing grub errors after Ubuntu distribution upgrade

Written 2011-04-29 by Timo Dickscheid, tagged as computers, ubuntu

After running an Ubuntu distribution upgrade on a machine where the primary boot disk is not /dev/sda, but let's say /dev/sdb, you may experience the following grub error:

error: symbol not found: 'grub_env_export'

This happens because the grub-update is apparently run on the first disk by default. You'll need to reinstall grub using the correct partition by booting from a live disk, as explained in this post. In the live system, fire up a terminal and (assuming your desired boot partition is on /dev/sdb1) do

sudo mount /dev/sdb1 /mnt/sdb1
sudo mount -o bind /dev /mnt/sdb1/dev
sudo mount -o bind /sys /mnt/sdb1/sys
sudo mount -o bind /proc /mnt/sdb1/proc
sudo chroot /mnt/sdb1

This will make the boot partition your current root directory tree. Then reinstall grub there:

grub-install /dev/sdb
update-grub

Reboot the machine, and hope for the best - it worked for me when upgrading from Maverick to Natty.

How did I live without vim's wildmenu all these years?

Written 2011-04-20 by Timo Dickscheid, tagged as programming, vim

Even after years of extensive usage, vim will surprise you eventually. Like today: I had a feeling that the way of switching buffers that I use (:b abc<Tab>, where 'abc' is a fragment of a file's name) may not be the most convenient one. I used the BufExplorer plugin for some months, but found it too bloated.

Then I stumbled upon vim's builtin wildmenu function, which really knocked me off of my feet! How was it possible that I didn't discover it earlier? Simply put the following line in your .vimrc:

set wildmenu

Then open a bunch of files, and try

:b <Tab>

to get a horizontal list of buffer names that you can navigate and select interactively. The improved Tab completion works for all commands, e.g.

:e <Tab>

will open a minimalistic file explorer for the current directory. Wowee!