Make sure $TMP_BUILD_DIR/mnt is owned by root

The path $TMP_BUILD_DIR/mnt becomes the / inside the chroot during
the chroot phases of diskimage-builder. Previously this path was being
created using the account running diskimage-builder. This account may
not be valid inside the chroot. This causes path validation, when running
on a Ubuntu bionic host, to fail.
This patch chown's the $TMP_BUILD_DIR/mnt to root.root to make sure
that / is owned by a valid account inside the chroot.

Change-Id: Ifedc136baa67c7952942aed2c8cb1041902fef91
Closes-Bug: 1811113
This commit is contained in:
Michael Johnson 2019-01-09 18:27:59 -08:00
parent 8ca7b6b9b9
commit cfba9ea79d

View File

@ -339,6 +339,10 @@ function arg_to_elements() {
function create_base () {
mkdir $TMP_BUILD_DIR/mnt
# Make sure the / inside the chroot is owned by root
# If it is not owned by root, some Ubuntu bionic packages will fail
# path validation at install time.
sudo chown root.root $TMP_BUILD_DIR/mnt
export TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt
# Copy data in to the root.
TARGET_ROOT=$TMP_MOUNT_PATH run_d root