From 8879f9a09b19f46affaada45a597bca5b6fb99dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 8 Jan 2021 21:24:24 +0100 Subject: [PATCH] rootfs: apparmor=unconfined is needed for non Red Hat host OSes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not needed for Fedora, RHEL, and CentOS, but it is required when using any other host OS. Having --security-opt apparmor=unconfined used unconditionally is a no go as it'd break podman. The reason this was only added when building for SUSE (as target distro) was because debian and ubuntu condition would fall-through the switch to the suse case (which makes me think that the fall-through was not accidental). Signed-off-by: Fabiano FidĂȘncio --- tools/osbuilder/rootfs-builder/rootfs.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index 6f627d14ec..dc53653212 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -196,10 +196,23 @@ docker_extra_args() args+=" -v ${gentoo_local_portage_dir}:/usr/portage/packages" args+=" --volumes-from ${gentoo_portage_container}" ;; - suse) - # When AppArmor is enabled, mounting inside a container is blocked with docker-default profile. - # See https://github.com/moby/moby/issues/16429 - args+=" --security-opt apparmor=unconfined" + debian | ubuntu | suse) + source /etc/os-release + + case "$ID" in + fedora | centos | rhel) + # Depending on the podman version, we'll face issues when passing + # `--security-opt apparmor=unconfined` on a system where not apparmor is not installed. + # Because of this, let's just avoid adding this option when the host OS comes from Red Hat. + + # A explict check for podman, at least for now, can be avoided. + ;; + *) + # When AppArmor is enabled, mounting inside a container is blocked with docker-default profile. + # See https://github.com/moby/moby/issues/16429 + args+=" --security-opt apparmor=unconfined" + ;; + esac ;; *) ;;