diff -Nru cloud-init-0.6.3/debian/changelog cloud-init-0.6.3/debian/changelog --- cloud-init-0.6.3/debian/changelog 2014-04-07 09:18:52.000000000 -0600 +++ cloud-init-0.6.3/debian/changelog 2014-07-03 12:34:10.000000000 -0600 @@ -1,3 +1,13 @@ +cloud-init (0.6.3-0ubuntu1.14) precise; urgency=medium + + * fixed issues where grub-pc does not consider xvda (LP: 1336855). + - debian/patches/lp-1336855-grub_xvda.patch: added xvda as a + considered device + - debian/cloud-init.postinst: check to see if grub-pc is configured + for the right device. + + -- Ben Howard Wed, 02 Jul 2014 13:42:12 -0600 + cloud-init (0.6.3-0ubuntu1.13) precise-proposed; urgency=medium * debian/patches/lp-1302229-fix_futils_azure.patch: fixed imports and diff -Nru cloud-init-0.6.3/debian/cloud-init.postinst cloud-init-0.6.3/debian/cloud-init.postinst --- cloud-init-0.6.3/debian/cloud-init.postinst 2014-04-07 08:57:55.000000000 -0600 +++ cloud-init-0.6.3/debian/cloud-init.postinst 2014-07-03 14:11:47.000000000 -0600 @@ -157,6 +157,57 @@ # if there is generic cloud-config preseed, apply them handle_preseed_local_cloud_config + + ### Begin fix for LP: 1336855 + # fix issue where cloud-init misidentifies the location of grub + if [ -x /usr/sbin/grub-install ]; then + + # First, identify the root device for the parent. + for parm in $(cat /proc/cmdline); do + dev=$(echo $parm | awk -F\= '{print$NF}') + case $parm in + root=UUID*) [ -d /dev/disk/by-uuid ] && + root_dev=$(readlink -f /dev/disk/by-uuid/$dev);; + root=LABEL*) [ -d /dev/disk/by-label ] && + root_dev=$(readlink -f /dev/disk/by-label/$dev);; + root=/dev*) [ -d /dev ] && + root_dev=$(readlink -f $dev);; + esac + [ -n "$root_dev" ] && break + done + + # Only deal with simple, cloud-based devices + case $root_dev in + /dev/vda*|/dev/xvda*|/dev/sda*) install_grub_safe=1;; + *) install_grub_safe=0;; + esac + + # Make sure that we are not chrooted. We want to be safe. + [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ] && + install_grub_safe=0; + + if [ "$install_grub_safe" -eq 1 ]; then + # Find out where grub thinks the root device is + db_get grub-pc/install_devices && grub_cfg_dev=${RET} || : + db_get grub-pc/install_devices_empty && grub_dev_empty=${RET} || : + + # Find out the parent device for the root device + block_path=$(udevadm info -q path -n $root_dev | awk '-Fblock/' '{print$NF}') + pdev=$(echo $block_path | awk '-F/' '{print$1}') + [ -n "$pdev" ] && parent_dev="/dev/$pdev" + + # If everything checks out, set grub-pc/install_devices and re-install + # grub. + if [ "$grub_dev_empty" = "false" -a -n "$parent_dev" -a "$parent_dev" != "$grub_cfg_dev" ]; then + echo "Reconfiguring grub install device due to mismatch" + db_set grub-pc/install_devices "$parent_dev" + grub-install $parent_dev || + echo "WARNING! Unable to fix grub device mismatch. You may be broken." + fi + fi + fi + ### END fix for LP: 1336855 + fi #DEBHELPER# diff -Nru cloud-init-0.6.3/debian/patches/lp-1336855-grub_xvda.patch cloud-init-0.6.3/debian/patches/lp-1336855-grub_xvda.patch --- cloud-init-0.6.3/debian/patches/lp-1336855-grub_xvda.patch 1969-12-31 17:00:00.000000000 -0700 +++ cloud-init-0.6.3/debian/patches/lp-1336855-grub_xvda.patch 2014-07-03 13:41:29.000000000 -0600 @@ -0,0 +1,19 @@ +Description: consider xvda devices for grub-pc configuration + Cloud-init previously did not consider /dev/xvda and /dev/xvda1 for + setting as the grub device. Subiquently, unattended updates with + grub may cause the instance to be unusable. +Author: Ben Howard +Bug: https://bugs.launchpad.net/bugs/1336855 +Forwarded: yes +--- a/cloudinit/CloudConfig/cc_grub_dpkg.py ++++ b/cloudinit/CloudConfig/cc_grub_dpkg.py +@@ -44,7 +44,8 @@ + idevs_empty = "false" + if idevs == None: + idevs = "/dev/sda" +- for dev in ("/dev/sda", "/dev/vda", "/dev/sda1", "/dev/vda1"): ++ for dev in ("/dev/sda", "/dev/vda", "/dev/xvda", ++ "/dev/xvda1", "/dev/sda1", "/dev/vda1"): + if os.path.exists(dev): + idevs = dev + break diff -Nru cloud-init-0.6.3/debian/patches/series cloud-init-0.6.3/debian/patches/series --- cloud-init-0.6.3/debian/patches/series 2014-04-07 08:58:13.000000000 -0600 +++ cloud-init-0.6.3/debian/patches/series 2014-07-03 12:34:10.000000000 -0600 @@ -22,3 +22,4 @@ lp-1269626-azure_new_instance.patch lp-1292648-azure-format-ephemeral-new.patch lp-1302229-fix_futils_azure.patch +lp-1336855-grub_xvda.patch