Comment 23 for bug 1493188

Revision history for this message
Chad Smith (chad.smith) wrote :

Extended the SRU verification test case to validate that expected
changes are present in mount-image-callback which loop over "fstype in overlay overlayfs".

I can confirm both that proper bits are uploaded in any overlay fs is functional using cloud-utils (0.27-0ubuntu25.2).

#### Updated test script

#!/bin/bash

set -x

cat > install_hwe_kernel_and_overlay_root.sh <<EOF
#!/bin/bash

echo "3.) Enable proposed, install HWE kernel and install overlayroot to show fix."
mirror=http://archive.ubuntu.com/ubuntu
echo deb \$mirror xenial-proposed main | tee /etc/apt/sources.list.d/proposed.list
apt-get update
apt-get install -qy cloud-utils overlayroot linux-generic-hwe-16.04 | egrep 'linux-image|cloud-utils'
EOF

expect_overlayfs_mounts(){
  expected_mounts=$1
  overlay_mounts=$(multipass exec $VM mount | grep overlay -c)
  [[ "$expected_mounts" = "$overlay_mounts" ]] && echo "SUCCESS: found $overlay_mounts overlay mounts" || echo "FAILURE: expected $expected_mounts overlay mounts found $overlay_mounts"
}

VM=sru-1493188
RELEASE=xenial
multipass launch daily:$RELEASE -n $VM
multipass exec $VM -- cloud-init status --wait --long > /dev/null
echo --- No overlayfs mounts on initial boot
expect_overlayfs_mounts 0
multipass transfer install_hwe_kernel_and_overlay_root.sh $VM:.
multipass exec $VM -- sudo bash ./install_hwe_kernel_and_overlay_root.sh
echo "--- confirm overlay overlayfs patch present in mount-image-callback"
fs_types=$(multipass exec $VM -- grep -c "for fstype in overlay overlayfs" /usr/bin/mount-image-callback)
[[ "1" = "$fs_types" ]] || echo "FAILURE: didn't find 'for fstype in overlay overlayfs'"
multipass exec $VM -- sudo sh -c "echo overlayroot=tmpfs:recurse=0 | sudo tee -a /etc/overlayroot.local.conf"
multipass restart $VM
echo "--- expect 1 overlayfs mounts because using HWE kernel"
multipass exec $VM -- cloud-init status --wait --long
expect_overlayfs_mounts 1
multipass exec $VM -- sudo sh -c "echo overlayroot=tmpfs:recurse=1 | sudo overlayroot-chroot tee /etc/overlayroot.local.conf"
multipass restart $VM
expect_overlayfs_mounts 1
multipass exec $VM -- grep overlay /etc/fstab || echo "FAIL: didn't find overlayroot"
multipass exec $VM -- grep success /run/initramfs/overlayroot.log || echo "FAIL: didn't find overlayroot"

### Xenial verification results
+ cat
+ VM=sru-1493188
+ RELEASE=xenial
+ multipass launch daily:xenial -n sru-1493188
Launched: sru-1493188
+ multipass exec sru-1493188 -- cloud-init status --wait --long
+ echo --- No overlayfs mounts on initial boot
--- No overlayfs mounts on initial boot
+ expect_overlayfs_mounts 0
+ expected_mounts=0
++ multipass exec sru-1493188 mount
++ grep overlay -c
+ overlay_mounts=0
+ [[ 0 = \0 ]]
+ echo 'SUCCESS: found 0 overlay mounts'
SUCCESS: found 0 overlay mounts
+ multipass transfer install_hwe_kernel_and_overlay_root.sh sru-1493188:.
+ multipass exec sru-1493188 -- sudo bash ./install_hwe_kernel_and_overlay_root.sh
3.) Enable proposed, install HWE kernel and install overlayroot to show fix.
deb http://archive.ubuntu.com/ubuntu xenial-proposed main
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [774 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [219 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8,236 B]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,888 B]
Get:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-proposed InRelease [260 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1,880 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1,195 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [349 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [23.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,632 B]
Get:19 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [9,812 B]
Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [4,456 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [11.3 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4,476 B]
Get:23 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages [80.1 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-proposed/main Translation-en [21.9 kB]
Fetched 17.3 MB in 4s (3,585 kB/s)
Reading package lists... Done
  linux-image-4.15.0-122-generic linux-image-generic-hwe-16.04
  cloud-utils-euca shunit2 wodim cdrkit-doc fdutils linux-hwe-tools
  amd64-microcode cloud-image-utils cloud-utils crda distro-info genisoimage
  linux-image-4.15.0-122-generic linux-image-generic-hwe-16.04
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-4.15.0-122-generic amd64 4.15.0-122.124~16.04.1 [7,996 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-generic-hwe-16.04 amd64 4.15.0.122.122 [2,386 B]
Get:36 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 cloud-utils all 0.27-0ubuntu25.2 [1,514 B]
Extracting templates from packages: 100%
Selecting previously unselected package linux-image-4.15.0-122-generic.
Preparing to unpack .../linux-image-4.15.0-122-generic_4.15.0-122.124~16.04.1_amd64.deb ...
Unpacking linux-image-4.15.0-122-generic (4.15.0-122.124~16.04.1) ...
Selecting previously unselected package linux-image-generic-hwe-16.04.
Preparing to unpack .../linux-image-generic-hwe-16.04_4.15.0.122.122_amd64.deb ...
Unpacking linux-image-generic-hwe-16.04 (4.15.0.122.122) ...
Selecting previously unselected package cloud-utils.
Preparing to unpack .../cloud-utils_0.27-0ubuntu25.2_all.deb ...
Unpacking cloud-utils (0.27-0ubuntu25.2) ...
Setting up linux-image-4.15.0-122-generic (4.15.0-122.124~16.04.1) ...
Setting up linux-image-generic-hwe-16.04 (4.15.0.122.122) ...
Setting up cloud-utils (0.27-0ubuntu25.2) ...
Processing triggers for linux-image-4.15.0-122-generic (4.15.0-122.124~16.04.1) ...
+ echo '--- confirm overlay overlayfs patch present in mount-image-callback'
--- confirm overlay overlayfs patch present in mount-image-callback
++ multipass exec sru-1493188 -- grep -c 'for fstype in overlay overlayfs' /usr/bin/mount-image-callback
+ fs_types=1
+ [[ 1 = \1 ]]
+ multipass exec sru-1493188 -- sudo sh -c 'echo overlayroot=tmpfs:recurse=0 | sudo tee -a /etc/overlayroot.local.conf'
overlayroot=tmpfs:recurse=0
+ multipass restart sru-1493188
+ echo '--- expect 1 overlayfs mounts because using HWE kernel'
--- expect 1 overlayfs mounts because using HWE kernel
+ multipass exec sru-1493188 -- cloud-init status --wait --long
..
status: done
time: Mon, 09 Nov 2020 04:16:57 +0000
detail:
DataSourceNoCloud [seed=/dev/sr0][dsmode=net]
+ expect_overlayfs_mounts 1
+ expected_mounts=1
++ multipass exec sru-1493188 mount
++ grep overlay -c
+ overlay_mounts=1
+ [[ 1 = \1 ]]
+ echo 'SUCCESS: found 1 overlay mounts'
SUCCESS: found 1 overlay mounts
+ multipass exec sru-1493188 -- sudo sh -c 'echo overlayroot=tmpfs:recurse=1 | sudo overlayroot-chroot tee /etc/overlayroot.local.conf'
INFO: Chrooting into [/media/root-ro]
overlayroot=tmpfs:recurse=1
+ multipass restart sru-1493188
+ expect_overlayfs_mounts 1
+ expected_mounts=1
++ multipass exec sru-1493188 mount
++ grep overlay -c
+ overlay_mounts=1
+ [[ 1 = \1 ]]
+ echo 'SUCCESS: found 1 overlay mounts'
SUCCESS: found 1 overlay mounts
+ multipass exec sru-1493188 -- grep overlay /etc/fstab
# This fstab is in an overlay. The real one can be found at
# sudo overlayroot-chroot
/media/root-ro/ / overlay lowerdir=/media/root-ro/,upperdir=/media/root-rw/overlay/,workdir=/media/root-rw/overlay-workdir/_ 0 0
+ multipass exec sru-1493188 -- grep success /run/initramfs/overlayroot.log
[success]: configured root with 'tmpfs:recurse=1' using overlay per /dev/sda1/etc/overlayroot.local.conf