Unable to configure swap space on ephemeral disk in Azure
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Yakkety |
Confirmed
|
Medium
|
Unassigned | ||
Zesty |
Fix Released
|
High
|
Unassigned |
Bug Description
I'm following the instructions to send cloud-config and repartition the ephemeral disk in Azure: https:/
Repro:
1) Add the following content to a file such as customdata.txt:
#cloud-config
disk_setup:
ephemeral0:
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"]
2) Create a VM in Azure with this cloud-config:
$ azure group create ubtest 'east us'
$ azure vm create ubtest ubtest-1604 Linux --image-urn canonical:
Expected Result:
- /dev/disk/
- /dev/disk/
- /dev/disk/
- /etc/fstab should be configured correctly
Actual Results:
- /dev/disk/
- On Ubuntu 14.04, /dev/disk/
- On Ubuntu 16.04, /dev/disk/
- On Ubuntu 14.04 and 16.04, /etc/fstab includes an incorrect entry for the swap space:
ephemeral0.2 none swap sw,comment=
This clearly won't work, it should resolve to "/dev/disk/
FYI, I also tested with the latest cloud-init that is currently in xenial-proposed (0.7.8-
Related bugs:
* bug 1460715: MBR disk setup fails because sfdisk no longer accepts M as a valid unit
* bug 1647708: azure ephemeral disk not mounted at boot
description: | updated |
description: | updated |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
description: | updated |
Changed in cloud-init (Ubuntu): | |
importance: | Medium → High |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Attempting to re-run the specific config on an existing Trusty instance:
1) sudo umount /mnt
2) sudo vi /etc/fstab and remove /mnt entry, save, quit
3) write out #cloud-config from this bug to user-data.cfg
4) sudo cloud-init --files user-data.cfg single --name cc_disk_setup --frequency always
5) sudo cloud-init --files user-data.cfg single --name cc_mounts --frequency always
This correctly creates the partitions, links, mounts and fstab entries. Now to test
why this appears to fail during initial boot.
ubuntu@ trusty- 161117- 1648:~$ cat /etc/issue
Ubuntu 14.04.5 LTS \n \l
ubuntu@ trusty- 161117- 1648:~$ cat /etc/cloud/ build.info
build_name: server
serial: 20161111
ubuntu@ trusty- 161117- 1648:~$ cat /proc/partitions
major minor #blocks name
1 0 65536 ram0
1 1 65536 ram1
1 2 65536 ram2
1 3 65536 ram3
1 4 65536 ram4
1 5 65536 ram5
1 6 65536 ram6
1 7 65536 ram7
1 8 65536 ram8
1 9 65536 ram9
1 10 65536 ram10
1 11 65536 ram11
1 12 65536 ram12
1 13 65536 ram13
1 14 65536 ram14
1 15 65536 ram15
11 0 7168 sr0
8 0 30720000 sda
8 1 30718976 sda1
8 16 298844160 sdb
8 17 197236735 sdb1
8 18 101607424 sdb2
ubuntu@ trusty- 161117- 1648:~$ ls -al /dev/disk/azure/
total 0
drwxr-xr-x 2 root root 140 Nov 17 18:25 .
drwxr-xr-x 6 root root 120 Nov 17 16:50 ..
lrwxrwxrwx 1 root root 9 Nov 17 18:25 resource -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 17 18:28 resource-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 17 18:28 resource-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 9 Nov 17 16:50 root -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 17 16:50 root-part1 -> ../../sda1
ubuntu@ trusty- 161117- 1648:~$ cat /proc/swaps trusty- 161117- 1648:~$ cat /etc/fstab 7e64-403a- 9407-bf06b48032 a2 / ext4 defaults,discard 0 0
Filename Type Size Used Priority
/dev/sdb2 partition 101607420 0 -1
ubuntu@
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
UUID=167596ac-
# CLOUD_IMG: This file was created/modified by the Cloud Image build process interfaces. dynamic. d tmpfs nodev,noexec, nosuid, size=64K 0 0 azure/resource- part1 /mnt2 auto defaults, nobootwait, comment= cloudconfig 0 2 azure/resource- part2 none swap sw,comment= cloudconfig 0 0
# The following is used to dynamically configured additional
# NICs. Do not remove unless you know what you are doing.
none /etc/network/
/dev/disk/
/dev/disk/
ubuntu@ trusty- 161117- 1648:~$ cat /proc/mounts nodev,noexec, relatime 0 0 nodev,noexec, relatime 0 0 size=3561560k, nr_inodes= 890390, mode=755 0 0 noexec, relatime, gid=5,mode= 620,ptmxmode= 000 0 0 noexec, relatime, size=713472k, mode=755 0 0 discard, data=ordered 0 0 size=4k, mode=755 0 0 fuse/connection s fusectl rw,relatim...
sysfs /sys sysfs rw,nosuid,
proc /proc proc rw,nosuid,
udev /dev devtmpfs rw,relatime,
devpts /dev/pts devpts rw,nosuid,
tmpfs /run tmpfs rw,nosuid,
/dev/sda1 / ext4 rw,relatime,
none /sys/fs/cgroup tmpfs rw,relatime,
none /sys/fs/