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:30:07.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 12:13:16.000000000 -0600 @@ -157,6 +157,62 @@ # 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 cloud-init + 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*) safe_to_continue=1;; + *) safe_to_continue=0;; + esac + + if [ "$safe_to_continue" -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 + pdev=$(udevadm info -q path -n $root_dev | awk '-F/' '{print$5}') + [ -n "$pdev" ] && parent_dev="/dev/$pdev" + + # Make sure that we what we think is root, is the same as the parent + # device. We need to be safe about chroots. + root_matches=0 + if [ -e /etc/mtab ]; then + while read dev mount _ _ _ _; do + [ "$mount" = "/" -a "$root_dev" = "$dev" ] && + root_matches=1 && break + done < /etc/mtab + fi + + # 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" -a "$root_matches" -eq 1 ]; 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-02 13:50:11.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 +--- cloud-init-0.6.3.orig/cloudinit/CloudConfig/cc_grub_dpkg.py ++++ cloud-init-0.6.3/cloudinit/CloudConfig/cc_grub_dpkg.py +@@ -44,7 +44,8 @@ def handle(_name, cfg, _cloud, log, _arg + 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-02 13:46:52.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