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.
/* Immediately get rid of the old root. Since we are
* running off it we need to do this lazily. */
/* 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) {
- log_error("Failed to umount old root dir %s: %m", temporary_old_root);
+ if (umount2("/mnt", MNT_DETACH) < 0) {
+ log_error("Failed to umount old root dir /mnt: %m");