Updating grub2 in a Debian VM

1

I am running a series of debian server VMs under Xen. I am using pygrub, so the kernels and initrds are within the VM itself.

I would like to continue using the automatic grub.cfg generation provided through kernel updates that debian does, however I need to tweak it so that it doesn't attempt to install the grub img into the boot sector. All I need it to do is generate the grub.cfg, and not attempt to install the boot loader.

When it does attempt to install grub.img, it fails because there isn't way for it to do this, and so it becomes an unresolvable apt error. This is because the partitions defined in the VM are themselves LVM volumes, so there isn't a boot sector as such:

disk=['phy:/dev/raid5/dl-boot,xvda1,w', 'phy:/dev/raid5/dl-root,xvda2,w']

There doesn't seem to be an option available in /etc/default/grub to switch off grub-install?

Paul

Posted 2011-12-23T08:43:40.670

Reputation: 52 173

Answers

1

It turns out that this was an issue with zz-update-grub. It is supposed to attempt to install the img to the physical disk boot sector and revert to the boot partition if the physical disk is not present (precisely for these types of situation I imagine).

While it didn't do this when I last tested, it does now, so this was probably added as a feature or a bugfix recently.

Upgrading to a newer version of grub-pc fixed the problem.

Paul

Posted 2011-12-23T08:43:40.670

Reputation: 52 173

While i updated a debian VM i got a question about where to install grub. the possibilities where /dev/sda and /dev/sda1 i choose /dev/sda because you wront it needs to be installed at the physical drive and that was right. – Harrys Kavan – 2013-10-10T19:39:02.993

@derty The HVM approach with Xen (or other hypervisors) is different to paravirtualised in Xen. The /dev/sd* devices don't exist, and in the configuration above, only the partitions are visible to the guest, not the "whole device" - ie there is no /dev/sda or /dev/xvda. – Paul – 2013-10-10T21:13:28.760