Skip to content

Commit

Permalink
ignition-ostree-rootfs: use our own tmpfs with size=80%
Browse files Browse the repository at this point in the history
In f33 systemd, /run is now mounted with a smaller size cap instead of
the default 50%:

systemd/systemd#15424

This was causing the rootfs reprovisioning code to run out of space.

Let's use this as an opportunity to be more explicit about the memory
semantics we want. Notably, we don't care about starving the host here;
either we have enough memory to reprovision the rootfs, or we should
fail. So let's just mount our own tmpfs with `size=80%`.

This in turn means that machines need even *less* RAM for rootfs
reprovisioning to work. A local test shows 2.5G seems to be enough.
Though let's keep recommending 4G in the docs to be safe.

A minor thing this also fixes is that we now clean up a leftover
directory and file from `/run` before we switchroot.

Closes: coreos/fedora-coreos-tracker#644
  • Loading branch information
jlebon committed Oct 14, 2020
1 parent 4e6c4b4 commit 1c9a493
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 0 additions & 7 deletions kola-denylist.yaml
Expand Up @@ -12,10 +12,3 @@
streams:
- next
- next-devel
# The ext.config.root-reprovision* tests are failing on Fedora 33
# for now. Exclude running the test on `next` and `next-devel`.
- pattern: ext.config.root-reprovision.*
tracker: https://github.com/coreos/fedora-coreos-tracker/issues/644
streams:
- next
- next-devel
Expand Up @@ -17,6 +17,10 @@ case "${1:-}" in
fi
echo "Detected rootfs replacement in fetched Ignition config: /run/ignition.json"
mkdir "${saved_sysroot}"
# use 80% of RAM: we want to be greedy since the boot breaks anyway, but
# we still want to leave room for everything else so it hits ENOSPC and
# doesn't invoke the OOM killer
mount -t tmpfs tmpfs "${saved_sysroot}" -o size=80%
;;
save)
mount "${rootdisk}" /sysroot
Expand All @@ -32,6 +36,12 @@ case "${1:-}" in
find "${saved_sysroot}" -mindepth 1 -maxdepth 1 -exec mv -t /sysroot {} \;
chattr +i $(ls -d /sysroot/ostree/deploy/*/deploy/*/)
;;
cleanup)
if [ -d "${saved_sysroot}" ]; then
umount "${saved_sysroot}"
rm -rf "${saved_sysroot}" "${partstate}"
fi
;;
*)
echo "Unsupported operation: ${1:-}" 1>&2; exit 1
;;
Expand Down
Expand Up @@ -15,3 +15,4 @@ After=systemd-udevd.service
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/ignition-ostree-dracut-rootfs detect
ExecStop=/usr/libexec/ignition-ostree-dracut-rootfs cleanup

0 comments on commit 1c9a493

Please sign in to comment.