Ubuntu – Gave up waiting for root device after update to 12.04 in hyper-v

hyper-vUbuntu

I have an Ubuntu 11.10 VM which I just upgraded to 12.04. The installation went fine, but now using the 3.2.0 Kernel it fails at boot with

Gave up waiting for root device.

...

ALERT! /dev/mapper/uvm-root does not exist. Dropping to a shell!

If I boot using the previous kernel Linux uvm 3.0.0-17-server #30-Ubuntu SMP Thu Mar 8 22:15:30 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux everything works. In the previous kernel, I have manually enabled the hyper-v modules as described here (http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/10/21/installing-ubuntu-server-10-10-on-hyper-v.aspx) — basically, they have been added to the /etc/initramfs-tools/modules.

How can I debug the problem? I have the machine running Ubuntu 12.04 with the 3.0 Kernel now, so I can investigate. Nothing seems really fishy, looking at /boot/grub/grub.cfg I can see the exact same IDs being passed around; I have also tried an update-initramfs -u -v and I can see that the hv_storvsc.ko is being included.

Best Answer

My answer here, copied below, is most likely applicable to you as well and explains why the kernel update and kernel module (storvsc) fixed your issue. Here's how to get a stock Ubuntu 12.04 machine running on Hyper-V:

Copied from my answer here: https://serverfault.com/a/522332/72237

The easiest way to get Ubuntu 12.04 running well under Hyper-V on the 2012 platform would be to download the Windows Azure Cloud Image - unfortunately as I check today (July 10 2013) the images are not available on the Ubuntu Cloud Images image store. I've filed a question on their answers site which you can follow to see if they restore the cloud images.

That said, let's discuss why you have an issue: 12.04.2 has an older kernel without the latest Hyper-V integration (kernel modules) that were baked into 12.10 and are in 13.04 as well. The cure is to get a newer kernel. As I said earlier, the easiest way to get the right image is to get an image built for Windows Azure - the Azure public cloud and your private Hyper-V server both run essentially the same hypervisor, so any instructions applicable to Azure are applicable to you.

To run on the Azure platform, aka the 2012 Hyper-V hypervisor, Microsoft recommends under their list of endorsed distributions of Linux that you follow a number of steps to update 12.04.x distributions to use a backported kernel and kernel modules. You do not need to install the walinuxagent or reconfigure GRUB, which is only necessary for Windows Azure. The full instructions are reproduced here with the walinuxagent and GRUB instructions removed:

  1. sudo sed -i "s,archive.ubuntu.com,azure.archive.ubuntu.com,g" /etc/apt/sources.list

    This step updates the mirrors to point to an Azure hosted mirror.

  2. sudo apt-add-repository ‘http://archive.canonical.com/ubuntu precise-backports main’

    This step adds the repository needed to get the kernel and agent changes.

  3. sudo apt-get update
  4. sudo apt-get install linux-backports-modules-hv-precise-virtual

    This step adds the update kernel and associated modules.

  5. sudo apt-get install hv-kvp-daemon-init

    This step adds the updated agent.

    NOTE: I have removed the walinuxagent from this command. It is not needed for private clouds, but is for Windows Azure. This update does however install the key value pair exchange which may be used for time sync and other things, but I am not entirely certain.

  6. This step removed as it pertains to modifying GRUB to run more efficiently on Windows Azure.
  7. (recommended) sudo apt-get dist-upgrade
  8. sudo reboot

A final note: these instructions add a new repository to your Ubuntu machines and you should be aware of the effect this has. Ensure that the first command runs correctly (I have not tested it myself in the past week) to replace archive.ubuntu.com with azure.archive.ubuntu.com. I have performed these steps myself but I cannot say they will work in the future. Just be aware that the goal of the first step is to point your Ubuntu distribution to use a new set of default repositories designed to backport support for Windows Azure and the 2012 Hyper-V hypervisor.