MBR disk setup fails because sfdisk no longer accepts M as a valid unit
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Ubuntu Image |
Undecided
|
Unassigned | ||
| | cloud-init |
Medium
|
Dan Watkins | ||
| | cloud-init (Ubuntu) |
Medium
|
Unassigned | ||
| | Xenial |
Medium
|
Scott Moser | ||
| | Yakkety |
Medium
|
Unassigned | ||
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:
layout: [66, [33, 82]]
fs_setup:
- device: ephemeral0.1
- device: ephemeral0.2
mounts:
- ["ephemeral0.1", "/mnt2"]
- ["ephemeral0.2", "none", "swap", "sw", "0", "0"]
On a typical kvm openstack use:
#cloud-config
disk_setup:
/dev/vdb:
layout: [66, [33, 82]]
fs_setup:
- device: /dev/vdb1
- device: /dev/vdb2
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://
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/
# 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=
LABEL=UEFI /boot/efi vfat defaults 0 0
/dev/vdb1 /mnt2 auto defaults,
/dev/vdb2 none swap sw,comment=
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_
sfdisk: --Linux option is unnecessary and deprecated
sfdisk: unsupported unit 'M'
and the manpage says:
-u, --unit S
So we'll need to shift to using sectors.
Related bugs:
* bug 1642383: Unable to configure swap space on ephemeral disk in Azure
Related branches
- Server Team CI bot: Needs Fixing (continuous-integration) on 2016-07-22
- cloud-init commiters: Pending requested 2015-10-19
-
Diff: 135 lines (+76/-8)2 files modifiedcloudinit/config/cc_disk_setup.py (+8/-8)
tests/unittests/test_handler/test_handler_disk_setup.py (+68/-0)
| Dan Watkins (daniel-thewatkins) wrote : | #1 |
| Changed in cloud-init: | |
| assignee: | nobody → Dan Watkins (daniel-thewatkins) |
| Changed in cloud-init: | |
| status: | New → In Progress |
| Changed in cloud-init: | |
| importance: | Undecided → Medium |
| Robert C Jennings (rcj) wrote : | #2 |
Removed "wily" in title as it is EOL but this issue still exists in supported releases.
| summary: |
- MBR disk setup fails in wily because sfdisk no longer accepts M as a - valid unit + MBR disk setup fails because sfdisk no longer accepts M as a valid unit |
| description: | updated |
| Changed in cloud-init: | |
| status: | In Progress → Fix Committed |
| Scott Moser (smoser) wrote : | #3 |
For reference, this is the commit that added the deprecated message on --Linux and insists on sectors.
http://
| Changed in cloud-init (Ubuntu): | |
| status: | New → Fix Released |
| importance: | Undecided → Medium |
| Changed in cloud-init (Ubuntu Xenial): | |
| status: | New → Confirmed |
| Changed in cloud-init (Ubuntu Yakkety): | |
| status: | New → Confirmed |
| Changed in cloud-init (Ubuntu Xenial): | |
| importance: | Undecided → Medium |
| Changed in cloud-init (Ubuntu Yakkety): | |
| importance: | Undecided → Medium |
| Changed in cloud-init (Ubuntu Xenial): | |
| status: | Confirmed → In Progress |
| assignee: | nobody → Scott Moser (smoser) |
| description: | updated |
| Changed in cloud-init (Ubuntu Yakkety): | |
| status: | Confirmed → In Progress |
Hello Dan, or anyone else affected,
Accepted cloud-init into xenial-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cloud-init (Ubuntu Xenial): | |
| status: | In Progress → Fix Committed |
| tags: | added: verification-needed |
| Scott Moser (smoser) wrote : | #5 |
$ dpkg-query --show cloud-init
cloud-init 0.7.8-49-
$ cat /etc/cloud/
build_name: server
serial: 20161214
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 1018216 0 1018216 0% /dev
tmpfs 204836 3180 201656 2% /run
/dev/vda1 20263528 973360 19273784 5% /
tmpfs 1024172 0 1024172 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1024172 0 1024172 0% /sys/fs/cgroup
tmpfs 204836 0 204836 0% /run/user/1000
$ grep [sv]db /proc/partitions
253 16 41943040 vdb
253 17 27682406 vdb1
253 18 14259200 vdb2
$ cat /etc/fstab
LABEL=cloudimg-
/dev/vdb1 /mnt2 auto defaults,
/dev/vdb2 none swap sw,comment=
$ sudo mount -a
$ df -h /mnt2
Filesystem Size Used Avail Use% Mounted on
/dev/vdb1 26G 44M 25G 1% /mnt2
$ free
total used free shared buff/cache available
Mem: 2048348 48596 1857652 3208 142100 1844252
Swap: 14259196 0 14259196
$ grep [vs]db2 /proc/swaps
/dev/vdb2 partition 14259196 0 -1
| description: | updated |
| description: | updated |
| Scott Moser (smoser) wrote : | #6 |
The above is verification done on an openstack instance after the 'clean' and reboot as seen in the bug description.
| description: | updated |
| tags: |
added: verification-done removed: verification-needed |
| Scott Moser (smoser) wrote : | #7 |
heres the same basic thing on azure.
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 321736 0 321736 0% /dev
tmpfs 68328 3216 65112 5% /run
/dev/sda1 29711408 1416484 28278540 5% /
tmpfs 341636 0 341636 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 341636 0 341636 0% /sys/fs/cgroup
tmpfs 68328 0 68328 0% /run/user/1000
$ dpkg-query --show cloud-init
cloud-init 0.7.8-49-
$ cat /etc/cloud/
build_name: server
serial: 20161213
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 321736 0 321736 0% /dev
tmpfs 68328 3216 65112 5% /run
/dev/sda1 29711408 1416484 28278540 5% /
tmpfs 341636 0 341636 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 341636 0 341636 0% /sys/fs/cgroup
tmpfs 68328 0 68328 0% /run/user/1000
$ grep [sv]db /proc/partitions
8 16 20971520 sdb
8 17 13841203 sdb1
8 18 7129088 sdb2
$ cat /etc/fstab
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
UUID=c50d1651-
/dev/disk/
/dev/disk/
$ sudo mount -a
$ df -h /mnt2
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 13G 33M 13G 1% /mnt2
$ free
total used free shared buff/cache available
Mem: 683276 109488 410920 3244 162868 445812
Swap: 7129084 0 7129084
$ grep [vs]db2 /proc/swaps
/dev/sdb2 partition 7129084 0 -1
| Barry Warsaw (barry) wrote : | #8 |
This probably affects u-i too.
| Steve Langasek (vorlon) wrote : | #9 |
We don't use the -u option to sfdisk.
| Changed in ubuntu-image: | |
| status: | New → Invalid |
| Launchpad Janitor (janitor) wrote : | #10 |
This bug was fixed in the package cloud-init - 0.7.8-49-
---------------
cloud-init (0.7.8-
* cherry-pick 18203bf: disk_setup: Use sectors as unit when formatting
MBR disks with sfdisk. (LP: #1460715)
* cherry-pick 6e92c5f: net/cmdline: Consider ip= or ip6= on command
line not only ip= (LP: #1639930)
* cherry-pick 8c6878a: tests: fix assumptions that expected no eth0 in
system. (LP: #1644043)
* cherry-pick 2d2ec70: OpenStack: extend physical types to include
hyperv, hw_veb, vhost_user. (LP: #1642679)
-- Scott Moser <email address hidden> Thu, 01 Dec 2016 16:57:39 -0500
| Changed in cloud-init (Ubuntu Xenial): | |
| status: | Fix Committed → Fix Released |
| Robie Basak (racb) wrote : Update Released | #11 |
The verification of the Stable Release Update for cloud-init has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.
| Scott Moser (smoser) wrote : | #12 |
This is fixed in cloud-init 0.7.9.
| Changed in cloud-init: | |
| status: | Fix Committed → Fix Released |
Hello Dan, or anyone else affected,
Accepted cloud-init into yakkety-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cloud-init (Ubuntu Yakkety): | |
| status: | In Progress → Fix Committed |
| tags: | removed: verification-done |
| tags: | added: verification-needed |
| Scott Moser (smoser) wrote : | #14 |
Marking this verification-done for yakkety.
## fresh instance openstack kvm instance of yakkety.
$ dpkg-query --show cloud-init
cloud-init 0.7.8-49-
$ lsb_release -sc
yakkety
$ cat /etc/cloud/
build_name: server
serial: 20170114
$ m=http://
$ echo deb $m $(lsb_release -sc)-proposed main |
sudo tee /etc/apt/
$ sudo apt-get -qy update && sudo apt-get -qy install cloud-init </dev/null
$ dpkg-query --show cloud-init
cloud-init 0.7.8-68-
# clear out state for cloud-init, wipe partition table, clean fstab, reboot
$ sudo rm -Rf /var/lib/cloud /var/log/
$ sudo dd if=/dev/zero of=/dev/[sv]db bs=1M count=10
$ sudo sed -i '/cloudconfig/d' /etc/fstab
## ssh back in look around.
# see that vdb is partitioned
$ grep [sv]db /proc/partitions
252 16 41943040 vdb
252 17 27682406 vdb1
252 18 14259200 vdb2
# There should entries in /etc/fstab for the configured devices
$ cat /etc/fstab
LABEL=cloudimg-
LABEL=UEFI /boot/efi vfat defaults 0 0
/dev/vdb1 /mnt2 auto defaults,
/dev/vdb2 none swap sw,comment=
## vdb1 is mounted at /mnt2 and swap is used
$ df | grep -v tmpfs
Filesystem 1K-blocks Used Available Use% Mounted on
udev 1016700 0 1016700 0% /dev
/dev/vda1 20145724 1069040 19060300 6% /
/dev/vda15 106858 3607 103251 4% /boot/efi
/dev/vdb1 27116088 45080 25670504 1% /mnt2
$ grep /dev/[sv]db1 /proc/mounts
/dev/vdb1 /mnt2 ext4 rw,relatime,
$ grep /dev/[sv]db2 /proc/swaps
/dev/vdb2 partition 14259196 0 -1
| tags: |
added: verification-done removed: verification-needed |
| Launchpad Janitor (janitor) wrote : | #15 |
This bug was fixed in the package cloud-init - 0.7.8-68-
---------------
cloud-init (0.7.8-
* 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 ProcessExecutio
- flake8: fix trailing white space
- Doc: various documentation fixes [Sean Bright]
- cloudinit/
[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 <email address hidden> Mon, 19 Dec 2016 15:07:12 -0500
| Changed in cloud-init (Ubuntu Yakkety): | |
| status: | Fix Committed → Fix Released |


I'll look at this in our next iteration (i.e. the second half of June).