Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force CgroupsV1 on Ubuntu #146

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 48 additions & 15 deletions cache_images/ubuntu_packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,54 @@ if [[ "$OS_RELEASE_VER" -le 2004 ]]; then
fi

# The OpenSuse Open Build System must be utilized to obtain newer
# development versions of podman/buildah/skopeo & dependencies,
# in order to support upstream (i.e. bleeding-edge) development and
# automated testing. These packages are not otherwise intended for
# end-user consumption.
VERSION_ID=$(source /etc/os-release; echo $VERSION_ID)
# Overview: https://build.opensuse.org/project/show/devel:kubic:libcontainers:unstable
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_$VERSION_ID/"
GPG_URL="https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$VERSION_ID/Release.key"

echo "deb $REPO_URL /" | ooe.sh $SUDO \
tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable:ci.list
curl --fail --silent --location --url "$GPG_URL" | \
gpg --dearmor | \
$SUDO tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable_ci.gpg &> /dev/null

# development versions of some tools. This helper sets up config
# files for apt to fetch packages from OBS. We can be called with
# a variable number of arguments; I think the term is "subprojects"?
function setup_obs() {
# Version of ubuntu, e.g., 22.04
local xubuntu_version
xubuntu_version="xUbuntu_$(source /etc/os-release; echo $VERSION_ID)"

local base_url="https://download.opensuse.org/repositories/devel"

# Assemble the .deb repo URL by appending colon-slash-item for each arg
local repo_url="$base_url"
local repo_file="/etc/apt/sources.list.d/devel"
for i in "$@"; do
repo_url+=":/$i"
repo_file+=":$i"
done
repo_url+="/${xubuntu_version}/"
repo_file+=":ci.list"
echo "deb $repo_url /" | ooe.sh $SUDO tee "$repo_file"

# GPG key URL is similar to .deb repo, but just colons, no slashes
local gpg_url="$base_url"
local gpg_file="/etc/apt/trusted.gpg.d/devel"
for i in "$@"; do
gpg_url+=":$i"
gpg_file+="_$i"
done
gpg_url+="/${xubuntu_version}/Release.key"
gpg_file+="_ci.gpg"
curl --fail --silent --location --url "$gpg_url" | \
gpg --dearmor | \
$SUDO tee "$gpg_file" &> /dev/null
}
cevich marked this conversation as resolved.
Show resolved Hide resolved

# OBS: podman/buildah/skopeo & dependencies, in order to support
# upstream (i.e. bleeding-edge) development and automated testing.
# These packages are not otherwise intended for end-user consumption.
# We expect to need this repo for the foreseeable future.
# See https://build.opensuse.org/project/show/devel:kubic:libcontainers:unstable
setup_obs kubic libcontainers unstable

# OBS: FIXME! TEMPORARY! 2022-07-20! Needed because a glibc update broke criu.
# >>> PLEASE REMOVE THIS ONCE CRIU GETS FIXED IN REGULAR UBUNTU!
# >>> (No, I -- Ed -- have no idea how to even check that, sorry).
# Context: https://github.com/containers/podman/pull/14972
# Context: https://github.com/checkpoint-restore/criu/issues/1935
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, thanks for the comment and links.

setup_obs tools criu

# N/B: DO NOT install the bats package on Ubuntu VMs, it's broken.
# ref: (still open) https://bugs.launchpad.net/ubuntu/+source/bats/+bug/1882542
Expand Down
3 changes: 2 additions & 1 deletion cache_images/ubuntu_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ bash $SCRIPT_DIRPATH/ubuntu_packaging.sh

if ! ((CONTAINER)); then
warn "Making Ubuntu kernel to enable cgroup swap accounting"
SEDCMD='s/^GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory swapaccount=1"/'
warn "Forcing CgroupsV1"
SEDCMD='s/^GRUB_CMDLINE_LINUX="(.*)"/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=0"/'
ooe.sh $SUDO sed -re "$SEDCMD" -i /etc/default/grub.d/*
ooe.sh $SUDO sed -re "$SEDCMD" -i /etc/default/grub
ooe.sh $SUDO update-grub
Expand Down