From a9ecf5a839c6fec113f86831877b19fa0d5d5ce6 Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Mon, 12 Jul 2021 17:18:00 +0200 Subject: [PATCH] image-info: cover situation when /boot is on a separate partition Some images with ESP, e.g. the `rhel-ec2-aarch64`, have the `/boot` on a separate partition. `image-info` currently produces traceback on such images, e.g.: Traceback (most recent call last): File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1997, in main() File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1991, in main report = analyse_image(target) File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1863, in analyse_image append_partitions(report, device, loctl) File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1849, in append_partitions append_filesystem(report, tree) File "/home/thozza/devel/osbuild-composer/./tools/image-info", line 1809, in append_filesystem with open(f"{tree}/grub2/grubenv") as f: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp3i__6m1w/grub2/grubenv' The reason is that `grub2/grubenv` on the `/boot` partition is a symlink to `../efi/EFI/redhat/grubenv`. However the `efi` directory on the `/boot` partition is empty and the ESP must be mounted to it for the expected path to exist. Modify `image-info` to mount the ESP to `efi` directory if it exists on the inspected partition. Signed-off-by: Tomas Hozza --- tools/image-info | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/image-info b/tools/image-info index 4df4aa5b7..225d80270 100755 --- a/tools/image-info +++ b/tools/image-info @@ -1845,6 +1845,10 @@ def append_partitions(report, device, loctl): if esp and os.path.exists(f"{tree}/boot/efi"): with mount_at(devices[esp_id], f"{tree}/boot/efi", options=['umask=077']): append_filesystem(report, tree) + # situation when /boot is on a separate partition + elif esp and os.path.exists(f"{tree}/efi"): + with mount_at(devices[esp_id], f"{tree}/efi", options=['umask=077']): + append_filesystem(report, tree) else: append_filesystem(report, tree)