Skip to content

Instantly share code, notes, and snippets.

@sunnyone
Last active June 27, 2020 13:22
Show Gist options
  • Save sunnyone/adf535ca79c24cfda640aa79229961b2 to your computer and use it in GitHub Desktop.
Save sunnyone/adf535ca79c24cfda640aa79229961b2 to your computer and use it in GitHub Desktop.
cloud-init on Ubuntu 20.04 fails disk_setup
2020-06-27 13:16:19,956 - stages.py[DEBUG]: Running module disk_setup (<module 'cloudinit.config.cc_disk_setup' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py'>) with frequency once-per-instance
2020-06-27 13:16:19,956 - handlers.py[DEBUG]: start: init-network/config-disk_setup: running config-disk_setup with frequency once-per-instance
2020-06-27 13:16:19,957 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/iid-local01/sem/config_disk_setup - wb: [644] 24 bytes
2020-06-27 13:16:19,957 - helpers.py[DEBUG]: Running config-disk_setup using lock (<FileLock using file '/var/lib/cloud/instances/iid-local01/sem/config_disk_setup'>)
2020-06-27 13:16:19,957 - cc_disk_setup.py[DEBUG]: Partitioning disks: {'/dev/vdb': {'layout': True, 'overwrite': False, 'table_type': 'mbr'}}
2020-06-27 13:16:19,957 - cc_disk_setup.py[DEBUG]: Creating new partition table/disk
2020-06-27 13:16:19,957 - util.py[DEBUG]: Running command ['udevadm', 'settle'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:19,975 - cc_disk_setup.py[DEBUG]: Checking values for /dev/vdb definition
2020-06-27 13:16:19,975 - cc_disk_setup.py[DEBUG]: Checking against default devices
2020-06-27 13:16:19,975 - cc_disk_setup.py[DEBUG]: Checking if device /dev/vdb is a valid device
2020-06-27 13:16:19,975 - util.py[DEBUG]: Running command ['/usr/bin/lsblk', '--pairs', '--output', 'NAME,TYPE,FSTYPE,LABEL', '/dev/vdb', '--nodeps'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:19,979 - cc_disk_setup.py[DEBUG]: Checking if device layout matches
2020-06-27 13:16:19,979 - util.py[DEBUG]: Running command ['udevadm', 'settle'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:19,995 - util.py[DEBUG]: Running command ['/usr/sbin/blockdev', '--rereadpt', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:19,999 - util.py[DEBUG]: Running command ['udevadm', 'settle'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,015 - util.py[DEBUG]: Running command ['/usr/sbin/sfdisk', '-l', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,018 - cc_disk_setup.py[DEBUG]: called check_partition_mbr_layout(/dev/vdb, True), returned: []
2020-06-27 13:16:20,018 - cc_disk_setup.py[DEBUG]: Checking if device is safe to partition
2020-06-27 13:16:20,018 - util.py[DEBUG]: Running command ['/usr/bin/lsblk', '--pairs', '--output', 'NAME,TYPE,FSTYPE,LABEL', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,021 - util.py[DEBUG]: Running command ['/usr/sbin/blkid', '-c', '/dev/null', '/dev/vdb'] with allowed return codes [0, 2] (shell=False, capture=True)
2020-06-27 13:16:20,029 - util.py[DEBUG]: Running command ['/usr/sbin/blkid', '-c', '/dev/null', '/dev/vdb'] with allowed return codes [0, 2] (shell=False, capture=True)
2020-06-27 13:16:20,036 - cc_disk_setup.py[DEBUG]: Checking for device size of /dev/vdb
2020-06-27 13:16:20,036 - util.py[DEBUG]: Running command ['/usr/sbin/blockdev', '--getsize64', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,037 - util.py[DEBUG]: Running command ['/usr/sbin/blockdev', '--getss', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,039 - cc_disk_setup.py[DEBUG]: Calculating partition layout
2020-06-27 13:16:20,039 - cc_disk_setup.py[DEBUG]: Layout is: 0,
2020-06-27 13:16:20,039 - cc_disk_setup.py[DEBUG]: Creating partition table on /dev/vdb
2020-06-27 13:16:20,039 - util.py[DEBUG]: Running command ['/usr/sbin/sfdisk', '--Linux', '--unit=S', '--force', '/dev/vdb'] with allowed return codes [0] (shell=False, capture=True)
2020-06-27 13:16:20,054 - util.py[DEBUG]: Creating partition on /dev/vdb took 0.097 seconds
2020-06-27 13:16:20,054 - util.py[WARNING]: Failed partitioning operation
Failed to partition device /dev/vdb
Unexpected error while running command.
Command: ['/usr/sbin/sfdisk', '--Linux', '--unit=S', '--force', '/dev/vdb']
Exit code: 1
Reason: -
Stdout: Checking that no-one is using this disk right now ... OK
Disk /dev/vdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Created a new DOS disklabel with disk identifier 0xec74b803.
/dev/vdb1: Leaving.
Stderr: sfdisk: --Linux option is unnecessary and deprecated
Start sector 0 out of range.
Failed to add #1 partition: Numerical result out of range
2020-06-27 13:16:20,054 - util.py[DEBUG]: Failed partitioning operation
Failed to partition device /dev/vdb
Unexpected error while running command.
Command: ['/usr/sbin/sfdisk', '--Linux', '--unit=S', '--force', '/dev/vdb']
Exit code: 1
Reason: -
Stdout: Checking that no-one is using this disk right now ... OK
Disk /dev/vdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Created a new DOS disklabel with disk identifier 0xec74b803.
/dev/vdb1: Leaving.
Stderr: sfdisk: --Linux option is unnecessary and deprecated
Start sector 0 out of range.
Failed to add #1 partition: Numerical result out of range
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 700, in exec_mkpart_mbr
util.subp(prt_cmd, data="%s\n" % layout)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2084, in subp
raise ProcessExecutionError(stdout=out, stderr=err,
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['/usr/sbin/sfdisk', '--Linux', '--unit=S', '--force', '/dev/vdb']
Exit code: 1
Reason: -
Stdout: Checking that no-one is using this disk right now ... OK
Disk /dev/vdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Created a new DOS disklabel with disk identifier 0xec74b803.
/dev/vdb1: Leaving.
Stderr: sfdisk: --Linux option is unnecessary and deprecated
Start sector 0 out of range.
Failed to add #1 partition: Numerical result out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 138, in handle
util.log_time(logfunc=LOG.debug,
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2542, in log_time
ret = func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 814, in mkpart
exec_mkpart(table_type, device, part_definition)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 737, in exec_mkpart
return get_dyn_func("exec_mkpart_%s", table_type, device, layout)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 426, in get_dyn_func
return globals()[func_name](*func_args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py", line 702, in exec_mkpart_mbr
raise Exception("Failed to partition device %s\n%s" % (device, e))
Exception: Failed to partition device /dev/vdb
Unexpected error while running command.
Command: ['/usr/sbin/sfdisk', '--Linux', '--unit=S', '--force', '/dev/vdb']
Exit code: 1
Reason: -
Stdout: Checking that no-one is using this disk right now ... OK
Disk /dev/vdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Created a new DOS disklabel with disk identifier 0xec74b803.
/dev/vdb1: Leaving.
Stderr: sfdisk: --Linux option is unnecessary and deprecated
Start sector 0 out of range.
Failed to add #1 partition: Numerical result out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment