#1114519 When re-using an existing ESP, check it's actually mountable as vfat

#1114519#5
Date:
2025-09-06 14:09:33 UTC
From:
To:
Just found in d-i testing on a VM which has been swapped backwards and
forwards between testing BIOS and EFI installations.

On a machine with an existing partition in the right place that
matches our default location for the ESP (1 MiB from the beginning of
the disk), we will end up trying to mount that partition as our new
ESP. If it's *not* a VFAT-formatteD ESP, then things will go badly.

In my particular case, the test failed as it tried to mount an
existing ext4-formatted fs (the rootfs from a previous BIOS-boot
test), and this failed with EINVAL.

We should actually validate that the ESP we're proposing to use is
*actually usable*. It's better to fail up front here with a "this is
not as expected" than later on with a generic "failed" message.

#1114519#10
Date:
2025-12-06 09:54:21 UTC
From:
To:
Adding two related unanswered bug reports to the Cc: list.
This may happen with guided partitioning using an entire disk or manual
partitioning after deleting the existing partition or creating a new
partition table. I suspect it happens because partman-partitioning does
not properly clean partman device directory during these operations.

Other use cases are in manual partitioning or guided partitioning using
free space when re-using an existing partition, either non-EFI or EFI
with a filesystem other than FAT, as EFI.

To summarize the troublesome use cases:

* manual partitioning
- re-use an existing EFI partition containing a non-FAT filesystem
- re-use an existing non-EFI partition as EFI
- delete an existing partition and create an EFI partition at the same
location
- create a new partition table and an EFI partition at the same location
as an old partition

* guided partitioning using free space
- re-use an existing EFI partition containing a non-FAT filesystem

* guided partitioning using an entire disk
- create a new partition table and an EFI partition at the same location
as an old partition

Cleaning partman device directory when creating a new partition table or
deleting a partition would not fix the partition re-use use cases.

Should we enforce that an EFI partition must have a FAT filesystem ?
It has been reported that some UEFI firmware may support other
filesystems such as exFAT or NTFS.