From dc047513b79816b251b2f64b5b5fbd2ee4a6f440 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 6 Jan 2025 20:16:19 +0100 Subject: [PATCH] tools/osbuild-image-info: skip swap partitions When iterating partitions to mount, skip any with filesystem type "swap". This is done in two places: 1. When mounting partitions to find /etc/fstab. 2. When mounting partitions and volumes to analyse the tree. --- tools/osbuild-image-info | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/osbuild-image-info b/tools/osbuild-image-info index daca1272..c7bafea6 100755 --- a/tools/osbuild-image-info +++ b/tools/osbuild-image-info @@ -2623,6 +2623,8 @@ def append_partitions(report, image): # find partition with fstab and read it fstab = [] for fs in filesystems.values(): + if fs["type"] == "swap": + continue dev, opts = fs["device"], fs.get("mntops") with mount(dev, opts) as tree: if os.path.exists(f"{tree}/etc/fstab"): @@ -2650,6 +2652,9 @@ def append_partitions(report, image): info = index.get_module_info("Mount", "org.osbuild.btrfs") elif "xfs" in part_fstype: info = index.get_module_info("Mount", "org.osbuild.xfs") + elif "swap" in part_fstype: + # can't mount swap partitions + continue else: raise RuntimeError(f"Unknown file system: {part_fstype}") if not info: