ganeti: ganeti-instance-debootstrap grub hook fails: "unable to resolve UUID", "could not find menu.lst"

Originally reported of Google Code with ID 549.

What software version are you running? Please provide the output of "gnt-
cluster --version" and "gnt-cluster version".

root@wrn-vm1:~# gnt-cluster --version
gnt-cluster (ganeti v2.6.2) 2.6.2
root@wrn-vm1:~# gnt-cluster version
Software version: 2.6.2
Internode protocol: 2060000
Configuration format: 2060000
OS api version: 20
Export interface: 0

<b>What distribution are you using?</b>

Debian Wheezy (host), Ubuntu Precise (guest)

<b>What steps will reproduce the problem?</b>

1. Install /etc/ganeti/instance-debootstrap/hooks/grub from the examples/hooks directory. (Note: I also have the 'defaultpasswords' and 'timezone' hooks installed, and they work fine)

2. Build an Ubuntu VM. I have /etc/ganeti/instance-debootstrap/variants/precise.conf containing

MIRROR="http://archive.ubuntu.com/ubuntu/"
SUITE="precise"
EXTRA_PKGS="acpid,console-tools,udev,linux-image-virtual,openssh-server"
COMPONENTS="main,universe"
ARCH="amd64"

<b>What is the expected output? What do you see instead?</b>

The VM creation fails at the following point:

---- 8< ----
...
Searching for GRUB installation directory ... found: /boot/grub
findfs: unable to resolve 'UUID=310dafbb-8de6-42af-bf27-4c5752c99a94'
Cannot determine root device.  Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0
Searching for GRUB installation directory ... found: /boot/grub
Testing for an existing GRUB menu.lst file ...

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub: line 1094: read: read error: 0: Bad file descriptor
run-parts: /etc/ganeti/instance-debootstrap/hooks/grub exited with return code 1

Current default time zone: 'Europe/London'
Local time is now:      Sun Jul 14 11:10:12 BST 2013.
Universal Time is now:  Sun Jul 14 10:10:12 UTC 2013.
---- 8< ----

As a result, the VM won't boot. You need to boot it temporarily with an external kernel, and then run grub within the VM.

<b>Please provide any additional information below.</b>

I tried changing "sda" to "vda" in the grub script, but it didn't make a difference. Also reported at https://groups.google.com/forum/#!topic/ganeti/Wmyb_5dLvaI


Originally added on 2013-08-07 18:58:05 +0000 UTC.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18

Most upvoted comments

The script as Micah modified it works for me.  I did not have to remove the line:

ln -s $FSYSDEV /dev/disk/by-uuid/$ROOTUUID

I've attached the script as it works for me...  tested with drbd, plain (lvm) with jessie & trusty.

Thanks!

Originally added on 2015-06-24 21:35:13 +0000 UTC.

Attachments: grub

I ran into this exact issue, and decided to spend some time to fix it. I created a hook script that works for me(TM) using drbd and lvm. There are several issues/quirks to 'fake' everything such that grub works in a chroot:

- For drbd, grub-2.00 is needed from testing, this is installed by this script. For lvm, it is assumed that grub is available (put it in your EXTRA_PKGS in /etc/default/ganeti-instance-debootstrap). 
- There is no symlink created under $TARGET/dev/disk/by-uuid, this causes grub to use the device name in the kernel boot arguments instead of the uuid
- LVM needs a loop device, otherwise grub thinks we're installing to a partition
- For LVM, the create scripts mount /dev/<vgname>/<lvname>, but for some reason grub looks in device.map for /dev/mapper/<vgname>-<mangled-lvname> ...
- Two runs of grub-install are needed, the first one installs serial.mod, then the serial port can be added to the config, and then we run again

Originally added on 2014-08-05 14:17:21 +0000 UTC.

Attachments: grub-hook