7

After every kernel update I have to run update-burg manually. How do I make it automatic?

4 Answers 4

8

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.

2
  • I think your answer is better (shorter) , but I only change grub to burg ~ 1 year ago and have absolutely no problem.
    – Extender
    Sep 30, 2010 at 14:14
  • 2
    I just did an upgrade(using update-manager) and burg(located on MBR) got overwritten by grub during the upgrade. I had to reinstall burg. After this experience I have decided to remove grub altogether(hope there is no grub dependency for burg).
    – jumbli
    Sep 30, 2010 at 15:04
3

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
2
  • Are you sure that an update or something won't bork the symlink?
    – jumbli
    Sep 30, 2010 at 3:18
  • Posted another answer that should be slightly more resilient to updates. I'll leave this here as a quick-and-dirty replacement.
    – Oli
    Sep 30, 2010 at 14:07
1

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.

3
  • You can bind it to an alias by going to your "~/.bash_aliases" file, and adding the line "alias apgrade='~/apgrade.sh' " (without the double quotes). The change will take effect once you open a new terminal. I've found this to be the perfect method for updating, since all it takes is four key presses in any terminal (ap<TAB><ENTER>) and the rest is automatic.
    – Malabarba
    Oct 21, 2010 at 13:35
  • You can just stick it in ~/bin (and get rid of the .sh extension) if you want to run it as aupgrade.
    – Oli
    Oct 21, 2010 at 13:44
  • Indeed. I prefer aliases because they are easily carried over to new installations by copying the .bash_aliases file. But it's entirely a matter of preference.
    – Malabarba
    Oct 21, 2010 at 13:53
1

Thanks!

I created a script based on the most-helpful/best-rated information provided here. One subtle change is that the boot-loader executables are no longer exec'd (as in the case of grub it exits; thus the script exits and other loaders are not executed (@Ubuntu11)).

The script can be configured for multiple bootloaders.. (if the executable is update-name and in /usr/sbin;-).

It could be extended to allow update executables that are not update-name. To do this maybe use name:exec as values in the boot-loaders config variable and split the var then change the execution command accordingly (would probably need to use a different language for this to be elegant).

#!/bin/sh
# #################################################################
#
# Updates (multiple) bootloaders after kernel update.
#
# @shell bash
# @see http://askubuntu.com/questions/4905/how-to-automatically-update-burg-after-a-kernel-update
#
# #################################################################
#
# Install:
#
# -----------------------------------------------------------------
# * Save as:   /usr/sbin/update-bootloaders
# * Then:      chmod +x /usr/sbin/update-bootloaders
# * Edit /etc/kernel-img.conf and append/replace the following parameters:
# ** postinst_hook = update-bootloaders
# ** postrm_hook = update-bootloaders
#
# #################################################################
#
# Configuration:
#
# -----------------------------------------------------------------
# BOOTLOADERS: configuration variable to list bootloaders
BOOTLOADERS="grub burg"
#
# #################################################################
set -e
for BOOTLOADER in ${BOOTLOADERS}; do
    EXEC="/usr/sbin/update-${BOOTLOADER}"
    if [ -x ${EXEC} ]; then
        echo "Updating ${BOOTLOADER}..."
        ${EXEC} "$@"
    fi
done
# eof

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .