group.of.nepali.translators team mailing list archive
-
group.of.nepali.translators team
-
Mailing list archive
-
Message #09779
[Bug 1460715] Re: MBR disk setup fails because sfdisk no longer accepts M as a valid unit
This probably affects u-i too.
** Also affects: ubuntu-image
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
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 Committed
Status in Ubuntu Image:
New
Status in cloud-init package in Ubuntu:
Fix Released
Status in cloud-init source package in Xenial:
Fix Committed
Status in cloud-init source package in Yakkety:
In Progress
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