Based on 23f25b1496c31ef4c20b8f3ee8328f7b1d5f3a54 Mon Sep 17 00:00:00 2001 From: Dan Dedrick Date: Tue, 29 Jul 2014 15:31:23 -0400 Subject: [PATCH] switch-root: umount the old root correctly The unmount occurs after the pivot_root, so the path used to unmount should take into account the new root directory. This will allow the umount to actually succeed. --- src/core/switch-root.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/core/switch-root.c +++ src/core/switch-root.c 2014-08-22 11:22:50.230735231 +0000 @@ -122,9 +122,9 @@ int switch_root(const char *new_root) { /* Immediately get rid of the old root. Since we are * running off it we need to do this lazily. */ - if (umount2(temporary_old_root, MNT_DETACH) < 0) { + if (umount2("/mnt", MNT_DETACH) < 0) { r = -errno; - log_error("Failed to umount old root dir %s: %m", temporary_old_root); + log_error("Failed to umount old root dir /mnt: %m"); goto fail; }