← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1460715] Re: MBR disk setup fails because sfdisk no longer accepts M as a valid unit

 

This bug was fixed in the package cloud-init -
0.7.8-68-gca3ae67-0ubuntu1~16.10.1

---------------
cloud-init (0.7.8-68-gca3ae67-0ubuntu1~16.10.1) yakkety; urgency=medium

  * debian/cherry-pick: add utility for cherry picking commits from upstream
    into patches in debian/patches.
  * New upstream snapshot.
    - mounts: use mount -a again to accomplish mounts (LP: #1647708)
    - CloudSigma: Fix bug where datasource was not loaded in local search.
      (LP: #1648380)
    - when adding a user, strip whitespace from group list
      [Lars Kellogg-Stedman] (LP: #1354694)
    - fix decoding of utf-8 chars in yaml test
    - Replace usage of sys_netdev_info with read_sys_net (LP: #1625766)
    - fix problems found in python2.6 test.
    - OpenStack: extend physical types to include hyperv, hw_veb, vhost_user.
      (LP: #1642679)
    - tests: fix assumptions that expected no eth0 in system. (LP: #1644043)
    - net/cmdline: Consider ip= or ip6= on command line not only ip=
      (LP: #1639930)
    - Just use file logging by default [Joshua Harlow] (LP: #1643990)
    - Improve formatting for ProcessExecutionError [Wesley Wiedenmeier]
    - flake8: fix trailing white space
    - Doc: various documentation fixes [Sean Bright]
    - cloudinit/config/cc_rh_subscription.py: Remove repos before adding
      [Brent Baude]
    - packages/redhat: fix rpm spec file.
    - main: set TZ in environment if not already set. [Ryan Harper]
    - disk_setup: Use sectors as unit when formatting MBR disks with sfdisk.
      [Daniel Watkins] (LP: #1460715)

 -- Scott Moser <smoser@xxxxxxxxxx>  Mon, 19 Dec 2016 15:07:12 -0500

** Changed in: cloud-init (Ubuntu Yakkety)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1460715

Title:
  MBR disk setup fails because sfdisk no longer accepts M as a valid
  unit

Status in cloud-init:
  Fix Released
Status in Ubuntu Image:
  Invalid
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Xenial:
  Fix Released
Status in cloud-init source package in Yakkety:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  Cloud-init has function to partition disks on devices.
  Creating partitions on a disk no longer works with sfdisk as recent versions of
  sfdisk no accept the unit 'M' as input, this function is broken.

  [Test Case]
  1. Launch an instance with provided user-data

     On Azure, this will work:
       #cloud-config
       disk_setup:
         ephemeral0:
             table_type: mbr
             layout: [66, [33, 82]]
             overwrite: True
       fs_setup:
         - device: ephemeral0.1
           filesystem: ext4
         - device: ephemeral0.2
           filesystem: swap
       mounts:
         - ["ephemeral0.1", "/mnt2"]
         - ["ephemeral0.2", "none", "swap", "sw", "0", "0"]

     On a typical kvm openstack use:
       #cloud-config
       disk_setup:
         /dev/vdb:
             table_type: mbr
             layout: [66, [33, 82]]
             overwrite: True
       fs_setup:
         - device: /dev/vdb1
           filesystem: ext4
         - device: /dev/vdb2
           filesystem: swap
       mounts:
         - ["/dev/vdb1", "/mnt2"]
         - ["/dev/vdb2", "none", "swap", "sw", "0", "0"]

  2. Add proposed, update, and reboot as fresh instance.

     # enable proposed
     echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-proposed main | sudo tee /etc/apt/sources.list.d/proposed.list
     sudo apt-get -qy update && sudo apt-get -qy install cloud-init </dev/null

     # clear out previous state in cloud-init
     sudo rm -Rf /var/lib/cloud /var/log/cloud-init*

     # wipe the partition table and filesystem from the disk
     sudo dd if=/dev/zero of=/dev/[sv]db bs=1M count=10

     # remove cloud-init written entries in /etc/fstab to mimic clean first boot
     sudo sed -i '/cloudconfig/d' /etc/fstab
     sudo reboot

  3. login to system and look around.

     The target disk should be partitioned with 2 partitions.

     $ grep [sv]db /proc/partitions
     253       16   41943040 vdb
     253       17   27682406 vdb1
     253       18   14259200 vdb2

     There should entries in /etc/fstab for the configured devices
     $ cat /etc/fstab
     LABEL=cloudimg-rootfs   /   ext4 defaults 0 0
     LABEL=UEFI  /boot/efi   vfat  defaults 0 0
     /dev/vdb1   /mnt2 auto  defaults,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig  0  2
     /dev/vdb2   none  swap  sw,comment=cloudconfig  0  0

     A 'mount -a' will mount the necessary devices.
     Note, these should ideally be already mounted, but an as-yet unidentified
     issue (to be fixed in bug 1642383) means they are not mounted on first
     boot.
     $ mount -a
     $ df -h /mnt2
     Filesystem      Size  Used Avail Use% Mounted on
     /dev/vdb1        26G   45M   25G   1% /mnt2

     There should be swap used.
     $ free
               total  used         free   shared  buff/cache   available
     Mem:    2047792  73984     1804508     3252      169300     1825896
     Swap:  14259196      0    14259196

     $ grep [vs]db2 /proc/swaps
     /dev/vdb2      partition  14259196 0  -1

  [Regression Potential]
  Change from using Megabytes to Sectors could have caused math errors,
  most likely with sector sizes other than 512.
  Partitioning with sfdisk was broken previously, so it wont be worse.

  === End SRU Template ===

  Specifically, we get the following output in
  cc_disk_setup.exec_mkpart_mbr:

  sfdisk: --Linux option is unnecessary and deprecated
  sfdisk: unsupported unit 'M'

  and the manpage says:

         -u, --unit S
                Deprecated option.  Only the sector unit is supported.

  So we'll need to shift to using sectors.

  Related bugs:
   * bug 1642383: Unable to configure swap space on ephemeral disk in Azure

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1460715/+subscriptions


References