Comment 5 for bug 1862417

Revision history for this message
Ryan Harper (raharper) wrote :

With some more debugging, the base image was older than when this fix went into upstream

https://github.com/canonical/cloud-init/pull/143/files

On current images, the following cloud-config is successful (I removed the swap: config):

#cloud-config
fs_setup:
  - label: vidi
    device: /dev/vdb
    filesystem: ext4
  - label: swap
    device: /dev/vdc
    filesystem: swap

mounts:
- [ /dev/vdb, /var/lib/vidispine, ext4, defaults, 0, 0 ]
- [ /dev/vdc, none, swap, sw, 0, 0 ]

mount_default_fields: [ None, None, "auto", "defaults", "0", "2" ]

----

ubuntu@test-mkswap:~$ cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
LABEL=UEFI /boot/efi vfat defaults 0 0
/dev/vdb /var/lib/vidispine ext4 defaults,comment=cloudconfig 0 0
/dev/vdc none swap sw,comment=cloudconfig 0 0
ubuntu@test-mkswap:~$ cat /proc/swaps
Filename Type Size Used Priority
/dev/vdc partition 41943036 0 -2
ubuntu@test-mkswap:~$ grep mkswap /var/log/cloud-init.log
2020-02-07 21:42:01,154 - cc_set_hostname.py[DEBUG]: Setting the hostname to test-mkswap.novalocal (test-mkswap)
2020-02-07 21:42:01,155 - __init__.py[DEBUG]: Non-persistently setting the system hostname to test-mkswap
2020-02-07 21:42:01,155 - util.py[DEBUG]: Running command ['hostname', 'test-mkswap'] with allowed return codes [0] (shell=False, capture=True)
2020-02-07 21:42:04,373 - cc_disk_setup.py[DEBUG]: Using cmd: ['/sbin/mkswap', '/dev/vdc', '-L', 'swap']
2020-02-07 21:42:04,373 - util.py[DEBUG]: Running command ['/sbin/mkswap', '/dev/vdc', '-L', 'swap'] with allowed return codes [0] (shell=False, capture=True)
2020-02-07 21:42:04,712 - cc_update_hostname.py[DEBUG]: Updating hostname to test-mkswap.novalocal (test-mkswap)
2020-02-07 21:42:04,712 - __init__.py[DEBUG]: Attempting to update hostname to test-mkswap in 1 files