Ubuntu yakkety cloud image does not grow root partition

Bug #1591181 reported by Benjamin Drung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-images
New
Undecided
Unassigned
cloud-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

The yakkety-server-cloudimg-amd64.img as of 2016-06-09 does not grow the root partition.

Jun 10 09:39:34 ubuntu [CLOUDINIT] util.py[DEBUG]: Failed: growpart /dev/vda 1
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_growpart.py", line 109, in resize
    util.subp(["growpart", diskdev, partnum])
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1714, in subp
    cmd=args)#012cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['growpart', '/dev/vda', '1']
Exit code: 2
Reason: -
Stdout: 'FAILED: pt_resize failed\n'
Stderr: 'failed [pt_update:1] pt_update /dev/vda 1\npartx: partition and disk name do not match\n'

I used following commands to launch the cloud images:

========<8========
#!/bin/sh
set -eu

wget -c https://cloud-images.ubuntu.com/yakkety/current/yakkety-server-cloudimg-amd64.img

qemu-img convert yakkety-server-cloudimg-amd64.img cloudimg.raw
qemu-img resize -f raw cloudimg.raw 20G

mnt_dir=$(mktemp -d)
echo "${0##*/}: Mounting cloudimg.raw into $mnt_dir"
mount -o loop,offset=1048576 cloudimg.raw $mnt_dir

mkdir -p $mnt_dir/var/lib/cloud/seed/nocloud
printf "dsmode: local\n" > $mnt_dir/var/lib/cloud/seed/nocloud/meta-data
echo > $mnt_dir/var/lib/cloud/seed/nocloud/user-data <<EOF
#cloud-config
chpasswd:
  expire: False
  list: |
    root:passw0rd
EOF

umount $mnt_dir

qemu-system-x86_64 -enable-kvm -m 512 -net nic -net user,hostfwd=tcp::2222-:22 -drive file=cloudimg.raw,if=virtio,format=raw
========<8========

Here is the error log of cloud-init:
========<8========
root@ubuntu:~# grep -i error /var/log/cloud-init.log
Jun 10 09:39:34 ubuntu [CLOUDINIT] util.py[DEBUG]: Failed: growpart /dev/vda 1#012Traceback (most recent call last):#012 File "/usr/lib/python3/dist-packages/cloudinit/config/cc_growpart.py", line 109, in resize#012 util.subp(["growpart", diskdev, partnum])#012 File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1714, in subp#012 cmd=args)#012cloudinit.util.ProcessExecutionError: Unexpected error while running command.#012Command: ['growpart', '/dev/vda', '1']#012Exit code: 2#012Reason: -#012Stdout: 'FAILED: pt_resize failed\n'#012Stderr: 'failed [pt_update:1] pt_update /dev/vda 1\npartx: partition and disk name do not match\n'
Jun 10 09:39:34 ubuntu [CLOUDINIT] cc_growpart.py[DEBUG]: '/' FAILED: failed to resize: disk=/dev/vda, ptnum=1: Unexpected error while running command.#012Command: ['growpart', '/dev/vda', '1']#012Exit code: 2#012Reason: -#012Stdout: 'FAILED: pt_resize failed\n'#012Stderr: 'failed [pt_update:1] pt_update /dev/vda 1\npartx: partition and disk name do not match\n'
Jun 10 12:36:22 ubuntu [CLOUDINIT] util.py[DEBUG]: failed stage init-local#012Traceback (most recent call last):#012 File "/usr/bin/cloud-init", line 536, in status_wrapper#012 ret = functor(name, args)#012 File "/usr/bin/cloud-init", line 250, in main_init#012 init.fetch(existing=existing)#012 File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 357, in fetch#012 return self._get_data_source(existing=existing)#012 File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 252, in _get_data_source#012 ds, desc = self._restore_from_checked_cache(existing)#012 File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 238, in _restore_from_checked_cache#012 ds.check_instance_id(self.cfg)):#012 File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceNoCloud.py", line 197, in check_instance_id#012 quick_id = _quick_read_instance_id(cmdline_id=self.cmdline_id,#012AttributeError: 'DataSourceNoCloud' object has no attribute 'cmdline_id'
========<8========

Benjamin Drung (bdrung)
affects: cloud-init (Ubuntu) → cloud-utils (Ubuntu)
Revision history for this message
Scott Moser (smoser) wrote :

your recreate steps have a bit of an issue above, in that you 'echo' and then <<EOF. which just doesn't do anything but create empty user-data.

I might suggest using mount-image-callback as it makes a bit nicer.

sdir=$PWD/sdir
echo "Mounting cloudimg.raw into $sdir"
mkdir -p $sdir/var/lib/cloud/seed/nocloud
printf "dsmode: local\n" > $mnt_dir/var/lib/cloud/seed/nocloud/meta-data
cat > $sdir/var/lib/cloud/seed/nocloud/user-data <<EOF
#cloud-config
chpasswd:
  expire: False
  list: |
    root:passw0rd
EOF

tar -cf - -C "$sdir" . | sudo mount-image-callback cloudimg.raw -- tar -C _MOUNTPOINT_ -xvf -

That way you dont have to be root for anything other than the mount-image-callback or know about the offset of the partition.

the resize issue is actually fixed under bug 1587971. Your stacktrace above showed a bug that I'm fixing now that occurred on reboot of a DataSourceNoCloud. I opened that as bug 1592505.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.