osbuilder: Upgrade Ubuntu guest to 20.04

- no need to create `/usr/lib/systemd/systemd` link any more
- install `chrony` as extra package and install extra packages in chroot
  rather than `debootstrap`, because `chrony` provides `time-daemon`,
  which under 20.04 is provided by `systemd-timesyncd`, which is
  required by `systemd`, and `debootstrap`'s conflict resolvement can't
  handle this, but `apt`'s can.

Fixes: #2147
Depends-on: github.com/kata-containers/tests#3636
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob Naucke 2021-06-29 18:12:10 +02:00
parent 1ab55e5afd
commit 7effbdebcb
No known key found for this signature in database
GPG Key ID: 45FA1C7D310C0EBE
3 changed files with 9 additions and 14 deletions

View File

@ -11,6 +11,9 @@ FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
# This dockerfile needs to provide all the componets need to build a rootfs
# Install any package need to create a rootfs (package manager, extra tools)
# Avoid tzdata setup
ENV DEBIAN_FRONTEND noninteractive
# RUN commands
RUN apt-get update && apt-get install -y \
autoconf \

View File

@ -7,12 +7,13 @@
# loaded just before call the function. For more information see the
# rootfs-builder/README.md file.
OS_VERSION=${OS_VERSION:-18.04}
# this should be ubuntu's codename eg bionic for 18.04
OS_NAME=${OS_NAME:-"bionic"}
OS_VERSION=${OS_VERSION:-20.04}
# This should be Ubuntu's code name, e.g. "focal" (Focal Fossa) for 20.04
OS_NAME=${OS_NAME:-"focal"}
# packages to be installed by default
PACKAGES="systemd iptables init chrony kmod"
PACKAGES="systemd iptables init kmod"
EXTRA_PKGS+=" chrony"
DEBOOTSTRAP=${PACKAGE_MANAGER:-"debootstrap"}

View File

@ -59,19 +59,10 @@ build_rootfs() {
fi
# trim whitespace
PACKAGES=$(echo $PACKAGES |xargs )
EXTRA_PKGS=$(echo $EXTRA_PKGS |xargs)
# add comma as debootstrap needs , separated package names.
# Don't change $PACKAGES in config.sh to include ','
# This is done to maintain consistency
PACKAGES=$(echo $PACKAGES | sed -e 's/ /,/g' )
EXTRA_PKGS=$(echo $EXTRA_PKGS | sed -e 's/ /,/g' )
# extra packages are added to packages and finally passed to debootstrap
if [ "${EXTRA_PKGS}" = "" ]; then
echo "no extra packages"
else
PACKAGES="${PACKAGES},${EXTRA_PKGS}"
fi
${PKG_MANAGER} --variant=minbase \
--arch=${ARCHITECTURE}\
@ -79,7 +70,7 @@ build_rootfs() {
${OS_NAME} \
${ROOTFS_DIR}
chroot $ROOTFS_DIR ln -s /lib/systemd/systemd /usr/lib/systemd/systemd
[ -n "${EXTRA_PKGS}" ] && chroot $ROOTFS_DIR apt-get install -y ${EXTRA_PKGS}
# Reduce image size and memory footprint
# removing not needed files and directories.