Comment 0 for bug 1687712

Revision history for this message
Paul Meyer (paul-meyer) wrote :

This reproduces on Azure, but it should fail similarly elsewhere. Consider repro.yml:

#cloud-config
fs_setup:
    - special:
      cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
      filesystem: ext4
      device: /dev/sdb1
      label: repro

Create a VM with this cloud config:
$ az vm create -g $rg -l westus2 --custom-data @repro.yml --image UbuntuLTS -n repro2

Then cloud-init will fail with:
Failed to exec of 'mkfs -t ext4 -L repro /dev/sdb1':
Unexpected error while running command.
Command: mkfs -t ext4 -L repro /dev/sdb1
Exit code: -
Reason: [Errno 2] No such file or directory: 'mkfs -t ext4 -L repro /dev/sdb1'

$ dpkg-query -W -f='${Version}' cloud-init
0.7.9-48-g1c795b9-0ubuntu1~16.04.1

Bug is in mkfs() in cc_disk_setup.py, which creates a shell-like string in the case that cmd was specified and a exec-like array in the other case (around line 913).