How to automatically update burg after a kernel update

Another method for you is to edit /etc/kernel-img.conf

do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = update-burg
postrm_hook = update-burg

From: https://bugs.launchpad.net/burg/+bug/594431 (a bug report echos your experience)

This can similarly be wiped out by updates but as it's in /etc/ you should (I think) get a prompt to keep your existing configuration when an update does hit.

As people in the bug go on to say, this still isn't ideal as there's every possibility that somebody might want to run both burg and grub or at the very least keep the two synced.

You could go one further and write a new script like this:

#!/bin/sh
set -e
exec update-grub "$@"
exec update-burg "$@"

Save it as /usr/sbin/update-bootloaders, chmod +x it, and then stick update-bootloaders in /etc/kernel-img.conf in place of update-grub or update-burg.

I guess in the long term, an alternatives system needs to be set up for various bootloaders as exists for java, audio and other interchangeable subsystems.


Normally update-grub gets called. This is just something that happens. The system expects grub to be the bootloader. Assuming you're never going to use grub again, you can do this:

cd /usr/sbin/
sudo mv update-grub update-grub.backup
sudo ln -s update-burg update-grub

This moves update-grub out the way and creates a symlink in its place that actually runs update-burg. So when a new kernel installs, it'll call update-grub which is actually update-burg.

Hacky but it should work.

To reverse:

cd /usr/sbin/
sudo rm update-grub # this is only a symlink
sudo mv update-grub.backup update-grub

If you have the habit of doing sudo apt-get upgrade to update your packages and kernels, the following script will solve your problem and is 100% resilient to updates:

#!/bin/bash
# Check what kernels are installed.
KERLST=`ls /boot | grep vmlinu`

# Do updates.
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade

# Update burg if kernels changed. 
if [ "$KERLST" != "`ls /boot | grep vmlinu`" ]; then
    sudo update-burg
fi

Save is as a text file apgrade.sh and mark it as executable. This script will perform every possible update, check whether the kernel list has changed, and update burg in case it did. I've been using it since 10.04 (bound to an alias), and no updates have broken it so far.

If, however, you like doing your updates manually through synaptic, then Oli's method might be better.