During some tests of Ubuntu in a virtual machine, I ran across an issue I’ve seen before, but never been able to fix, until now.
If you have a RAID array that contains a swap partition, you will not be able to delete it in the Ubuntu installer. Here’s the situation:
And if you try to delete the RAID array (“delete MD device”), here’s the error message:
An educated guess at the problem would be that the swap is in use, and as such, not able to be deleted. You’re right, but it’s (almost) not that simple. But let’s hit CTRL-ALT-F2 to get a console open, and try to turn off swap:
Yet it still won’t delete.
Okay, let’s try to force-stop the MD array. First, let’s find out for sure which MD devices there are. Doing this:
ls -l /dev/md
linux:0 -> ../md127
So we know the device is md127. Let’s try to force-stop it now:
mdadm --stop --force /dev/md127
Gives this message:
mdadm: Cannot get exclusive access to /dev/md127:Perhaps a running process, mounted filesystem or active volume group?
Well, what now?
Note: If you’re jumping back to the installer, don’t do an mdadm –stop /dev/md127. That’s going to confuse the installer. Just swapoff and then return to the installer and delete the software raid.