From 809886b7404c837acf5c702a619cbafc0ca6d342 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin@piware.de>
Date: Tue, 27 Aug 2024 13:03:22 +0200
Subject: [PATCH] images: Move ubuntu-stable to oracular

With the recent introduction of ubuntu-2404, let's move ubuntu-stable
off 24.04 to the current development series "oracular", which will
become 24.10. It is already past feature freeze, so now is a good time
to find and fix bugs.

Drop the workarounds which applied to 24.04.

Disable -proposed while this is still in the development phase, as that
are by definition the broken packages.

Copy naughty #6733 which oracular inherited from Debian testing.
---
 images/scripts/debian.setup                            | 9 +++++----
 images/scripts/ubuntu-stable.bootstrap                 | 5 +++++
 naughty/ubuntu-stable/6733-apparmor-qemu-max_map_count | 2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 naughty/ubuntu-stable/6733-apparmor-qemu-max_map_count

diff --git a/images/scripts/debian.setup b/images/scripts/debian.setup
index 3575efe7df..add05fc10f 100755
--- a/images/scripts/debian.setup
+++ b/images/scripts/debian.setup
@@ -105,7 +105,7 @@ if [ "$IMAGE" = "debian-stable" ] || [ "$IMAGE" = "ubuntu-2204" ] ; then
 fi
 
 # introduced in util-linux 2.40.1-5
-if [ "$IMAGE" = "debian-stable" ] || [ "$IMAGE" = "ubuntu-2204" ] || [ "$IMAGE" = "ubuntu-2404" ] || [ "$IMAGE" = "ubuntu-stable" ]; then
+if [ "$IMAGE" = "debian-stable" ] || [ "$IMAGE" = "ubuntu-2204" ] || [ "$IMAGE" = "ubuntu-2404" ]; then
     TEST_PACKAGES="${TEST_PACKAGES/lastlog2/}"
 fi
 
@@ -154,7 +154,8 @@ if [ "$IMAGE" = "debian-testing" ]; then
     COCKPIT_DEPS="${COCKPIT_DEPS/pcp /}"
 fi
 
-if [ "${IMAGE#ubuntu}" != "$IMAGE" ]; then
+# Attention: Enable proposed for ubuntu-stable after 24.10 release
+if [ "${IMAGE#ubuntu}" != "$IMAGE" ] && [ "$IMAGE" != "ubuntu-stable" ]; then
     echo "deb http://archive.ubuntu.com/ubuntu ${RELEASE}-proposed main restricted universe" > /etc/apt/sources.list.d/proposed.list
     cat <<EOF > /etc/apt/preferences.d/all-proposed
 Package: *
@@ -169,7 +170,7 @@ EOF
 fi
 
 # systemd-cryptsetup was split out in 256.1-2, older releases don't have it yet
-if [ "$IMAGE" = "debian-stable" ] || [ "$IMAGE" = "ubuntu-2204" ] || [ "$IMAGE" = "ubuntu-2404" ] || [ "$IMAGE" = "ubuntu-stable" ]; then
+if [ "$IMAGE" = "debian-stable" ] || [ "$IMAGE" = "ubuntu-2204" ] || [ "$IMAGE" = "ubuntu-2404" ]; then
     TEST_PACKAGES="${TEST_PACKAGES/systemd-cryptsetup /}"
 fi
 
@@ -362,7 +363,7 @@ if [ "$RELEASE" = "testing" ]; then
 fi
 
 # HACK: https://launchpad.net/bugs/2040483
-if [ "$IMAGE" = "ubuntu-2404" ] || [ "$IMAGE" = "ubuntu-stable" ]; then
+if [ "$IMAGE" = "ubuntu-2404" ]; then
     mkdir -p /etc/containers/containers.conf.d
     printf '[CONTAINERS]\napparmor_profile=""\n' > /etc/containers/containers.conf.d/disable-apparmor.conf
 fi
diff --git a/images/scripts/ubuntu-stable.bootstrap b/images/scripts/ubuntu-stable.bootstrap
index cea62ba87c..4f29ed4855 100755
--- a/images/scripts/ubuntu-stable.bootstrap
+++ b/images/scripts/ubuntu-stable.bootstrap
@@ -15,4 +15,9 @@ fi
 # release name is the last part of the URL
 rel=${rel##*/}
 
+# noble == 24.04 LTS, which we already have as ubuntu-2404; test the upcoming release
+if [ "$rel" = "noble" ]; then
+    rel="oracular"
+fi
+
 exec $(dirname $0)/lib/cloudimage.bootstrap "$1" "https://cloud-images.ubuntu.com/daily/server/$rel/current/$rel-server-cloudimg-amd64.img"
diff --git a/naughty/ubuntu-stable/6733-apparmor-qemu-max_map_count b/naughty/ubuntu-stable/6733-apparmor-qemu-max_map_count
new file mode 100644
index 0000000000..40d385a833
--- /dev/null
+++ b/naughty/ubuntu-stable/6733-apparmor-qemu-max_map_count
@@ -0,0 +1,2 @@
+testlib.Error: FAIL: Test completed, but found unexpected journal messages:
+*apparmor="DENIED" operation="open" class="file" profile="libvirt-*" name="/proc/sys/vm/max_map_count" * comm="qemu-system-x86" requested_mask="r" denied_mask="r"