summaryrefslogtreecommitdiff
path: root/src/shutdown
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-04-28 18:35:31 +0200
committerLennart Poettering <lennart@poettering.net>2023-05-03 17:55:55 +0200
commitf2c1d491a539035d6cc1fa53a7cef0cbc8d52902 (patch)
treeada41e8437d437c7b3c4e3fe949dbbd48d6b9a22 /src/shutdown
parentc4039ceb9e063d72f6afb7bc05d583de55966718 (diff)
downloadsystemd-f2c1d491a539035d6cc1fa53a7cef0cbc8d52902.tar.gz
switch-root: don't require /mnt/ when switching root into host OS
So far, we invoked pivot_root() specifying /mnt/ as second argument, which then unmounted right-after. We'd create /mnt/ if needed. This sucks, because it means /mnt/ must strictly be pre-created on immutable images. Remove this limitation, by using pivot_root() with "." as source and target, which will result in two stacked mounts afterwards: the new one underneath, the old one ontop. We can then simply unmount the top one, and have what we want without needing any extra /mnt/ dir. Since we don't need /mnt/ anymore we can get rid of the extra unmount_old_root parameter and simply specify it as NULL if we don't want the old mount to stick around.
Diffstat (limited to 'src/shutdown')
-rw-r--r--src/shutdown/shutdown.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index 802be44a79..cf0351cf78 100644
--- a/src/shutdown/shutdown.c
+++ b/src/shutdown/shutdown.c
@@ -169,7 +169,7 @@ static int switch_root_initramfs(void) {
* /run/initramfs/shutdown will take care of these.
* Also do not detach the old root, because /run/initramfs/shutdown needs to access it.
*/
- return switch_root("/run/initramfs", "/oldroot", false, MS_BIND);
+ return switch_root("/run/initramfs", "/oldroot", MS_BIND);
}
/* Read the following fields from /proc/meminfo: