From c60043c2db9f245b51061f6726ec53aa1c0c1827 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 15 Dec 2018 20:13:31 +0000 Subject: [PATCH] compose: Use dracut tmpdir under target root The problem here is that bare-user has `user.ostreemeta` xattrs, `tmpfs` (which bwrap uses for `/var/tmp` by default) doesn't support that. Pass through the tmpdir to the target rootfs, which is the same place as the repo in unified-core mode. Ref: https://github.com/coreos/coreos-assembler/issues/254 Closes: #1716 Approved by: cgwalters --- src/libpriv/rpmostree-kernel.c | 5 +---- src/libpriv/rpmostree-postprocess.c | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libpriv/rpmostree-kernel.c b/src/libpriv/rpmostree-kernel.c index 84982450..9eb052bd 100644 --- a/src/libpriv/rpmostree-kernel.c +++ b/src/libpriv/rpmostree-kernel.c @@ -457,7 +457,7 @@ rpmostree_run_dracut (int rootfs_dfd, "#!/usr/bin/bash\n" "set -euo pipefail\n" "extra_argv=; if (dracut --help; true) | grep -q -e --reproducible; then extra_argv=\"--reproducible --gzip\"; fi\n" - "dracut $extra_argv -v --add ostree --tmpdir=/tmp -f /tmp/initramfs.img \"$@\"\n" + "mkdir -p /tmp/dracut && dracut $extra_argv -v --add ostree --tmpdir=/tmp/dracut -f /tmp/initramfs.img \"$@\"\n" "cat /tmp/initramfs.img >/proc/self/fd/3\n"; g_autoptr(RpmOstreeBwrap) bwrap = NULL; g_autoptr(GPtrArray) rebuild_argv = NULL; @@ -543,9 +543,6 @@ rpmostree_run_dracut (int rootfs_dfd, if (kver) rpmostree_bwrap_append_child_argv (bwrap, "--kver", kver, NULL); - if (dracut_host_tmpdir) - rpmostree_bwrap_append_child_argv (bwrap, "--tmpdir", "/tmp/dracut", NULL); - rpmostree_bwrap_set_child_setup (bwrap, dracut_child_setup, GINT_TO_POINTER (tmpf.fd)); if (!rpmostree_bwrap_run (bwrap, cancellable, error)) diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c index 37cf9a49..0f7f7110 100644 --- a/src/libpriv/rpmostree-postprocess.c +++ b/src/libpriv/rpmostree-postprocess.c @@ -422,8 +422,11 @@ process_kernel_and_initramfs (int rootfs_dfd, g_ptr_array_add (dracut_argv, NULL); g_auto(GLnxTmpfile) initramfs_tmpf = { 0, }; + /* We use a tmpdir under the target root since dracut currently tries to copy + * xattrs, including e.g. user.ostreemeta, which can't be copied to tmpfs. + */ { g_auto(GLnxTmpDir) dracut_host_tmpd = { 0, }; - if (!glnx_mkdtempat (AT_FDCWD, "/var/tmp/rpmostree-dracut.XXXXXX", 0700, + if (!glnx_mkdtempat (rootfs_dfd, "rpmostree-dracut.XXXXXX", 0700, &dracut_host_tmpd, error)) return FALSE; if (!rpmostree_run_dracut (rootfs_dfd,