Comment 62 for bug 946663

mcelrath (bob+launchpad) wrote :

This is caused by the script /lib/partman/finish.d/10clear_partitions when umount fails after deleting critical directories from the (existing) target filesystem. There appears to be a race condition between subshell commands which access the partition mounted on /mnt/tmpmount, and the umount. e.g. commands run in a sub-shell, such as the several (rm -rf "$x" ...) have not fully exited before the umount was run.

I was able to work around this by inserting 'sleep 5' before the umount $tmp on line 82. Not an elegant solution, but it worked for me. There are three umounts in this file, on line 82 (for /) on line 93 (for /home) and line 106 (for /usr/local), the other two probably have the same problem, which is why people above were seeing this when trying to preserve /home too.

Attached is a patch which inserts a 1s delay before each of the three umounts. If that doesn't work for you, try increasing the delay.

A better solution would be to not use subshell commands like () in this script.