From bc62fd519631be6591c5c62302f83b45b9d56328 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 9 Nov 2023 20:53:52 -0500 Subject: [PATCH] unlock: Don't pass options again to overlayfs There seems to be a tricky regression here with the util-linux support for the new mount API, plus overlays support for it. ``` [2023-11-09T21:05:30.633Z] Nov 09 21:05:26 qemu0 kola-runext-unlock-transient.sh[2108]: + unshare -m -- /bin/sh -c 'mount -o remount,rw /usr && echo hello from transient unlock >/usr/share/writable-usr-test' [2023-11-09T21:05:30.633Z] Nov 09 21:05:26 qemu0 kola-runext-unlock-transient.sh[2148]: mount: /usr: mount point not mounted or bad option. [2023-11-09T21:05:30.633Z] Nov 09 21:05:26 qemu0 kola-runext-unlock-transient.sh[2148]: dmesg(1) may have more information after failed mount system call. ``` OK this seems related to the new mount API support in util-linux and overlayfs. From a strace: ``` 2095 open_tree(AT_FDCWD, "/usr", OPEN_TREE_CLOEXEC) = 3 2095 mount_setattr(-1, NULL, 0, NULL, 0) = -1 EINVAL (Invalid argument) ... 2095 fspick(3, "", FSPICK_NO_AUTOMOUNT|FSPICK_EMPTY_PATH) = 4 2095 fsconfig(4, FSCONFIG_SET_FLAG, "seclabel", NULL, 0) = 0 2095 fsconfig(4, FSCONFIG_SET_STRING, "lowerdir", "usr", 0) = -1 EINVAL (Invalid argument) ``` I think the core problem here is it's trying to reconfigure the mount with existing options, but in the new mount namespace we can't see the lowerdir. Here we really really just want to remount writable. Telling util-linux to not pass existing options fixes it. --- tests/kolainst/destructive/unlock-transient.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kolainst/destructive/unlock-transient.sh b/tests/kolainst/destructive/unlock-transient.sh index 8dce222494..19b7b693ad 100755 --- a/tests/kolainst/destructive/unlock-transient.sh +++ b/tests/kolainst/destructive/unlock-transient.sh @@ -16,7 +16,7 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in fatal "modified /usr" fi # But, we can affect it in a new mount namespace - unshare -m -- /bin/sh -c 'mount -o remount,rw /usr && echo hello from transient unlock >'"${testfile}" + unshare -m -- /bin/sh -c 'mount --options-source=disable -o remount,rw /usr && echo hello from transient unlock >'"${testfile}" assert_file_has_content "${testfile}" "hello from transient unlock" # Still can't write to it from the outer namespace if touch ${testfile} || rm -v "${testfile}" 2>/dev/null; then