From d602b5ff7f40dd3abb956d29aa0c7573e6e0ed29 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 17 Jun 2022 12:04:24 +0000 Subject: [PATCH] stages/mkfs.fat: pass `-I` command line option The option will force `mkfs.fat` to ignore existing partitions on the target device. The check is done via the corresponding device node in sysfs, i.e. the contents of the `partition` attribute in `/sys/dev/block/:`. In certain situations this info can be stale. Passing `-I` will work-around these situations. --- stages/org.osbuild.mkfs.fat | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stages/org.osbuild.mkfs.fat b/stages/org.osbuild.mkfs.fat index 851a09f1..647d265d 100755 --- a/stages/org.osbuild.mkfs.fat +++ b/stages/org.osbuild.mkfs.fat @@ -5,6 +5,10 @@ Construct an FAT file-system via mkfs.fat(8) Construct a FAT file-system with the given options at the device specified via `device`. +NB: `mkfs.fat` is called via `-I` to ignore existing partitions +on the device. This should also prevent the situation where +the partition table information on a (loop-)device is outdated. + Buildhost commands used: `mkfs.fat`. """ @@ -64,7 +68,7 @@ def main(devices, options): if fatsize: opts = ["-F", str(fatsize)] - subprocess.run(["mkfs.fat", "-i", volid] + opts + [device], + subprocess.run(["mkfs.fat", "-I", "-i", volid] + opts + [device], encoding='utf-8', check=True)