Repository: OSInside/kiwi

Issue:
ia32 binaries are not copied on x86_64 ISO image builds
## Problem description

When [trying to make x86_64 images that can boot from 32-bit x86 UEFI](https://pagure.io/fedora-kiwi-descriptions/pull-request/193), I noticed that ia32 EFI stuff is not getting copied:

```
[ WARNING ]: 11:08:34 | Running fallback setup for shim secure boot efi image
[ INFO    ]: 11:08:34 | --> Using shim image: /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/shimx64.efi
[ DEBUG   ]: 11:08:34 | Looking for cp in /root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
[ DEBUG   ]: 11:08:34 | EXEC: [cp /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/shimx64.efi /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/live-media.bxztyszs/EFI/BOOT/bootx64.efi]
[ INFO    ]: 11:08:34 | --> Using grub image: /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/gcdx64.efi
[ DEBUG   ]: 11:08:34 | Looking for cp in /root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
[ DEBUG   ]: 11:08:34 | EXEC: [cp /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/gcdx64.efi /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/live-media.bxztyszs/EFI/BOOT/grubx64.efi]
[ INFO    ]: 11:08:34 | --> Using mok image: /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/mmx64.efi
[ DEBUG   ]: 11:08:34 | Looking for cp in /root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
[ DEBUG   ]: 11:08:34 | EXEC: [cp /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/build/image-root/boot/efi/EFI/fedora/mmx64.efi /var/ARTIFACTS/work-build-desktop-liven7po8cwl/tmt/plans/desktop/kde/build-desktop-live/execute/data/guest/default-0/tmt/tests/build-image-1/data-build/live-media.bxztyszs/EFI/BOOT]
```

This is a regression for Fedora as we previously shipping ia32 and x64 EFI stuff for our images.

## Reproducer
1. `git clone --branch ia32efi-on-x64 https://pagure.io/fedora-kiwi-descriptions.git`
2. `cd fedora-kiwi-descriptions`
3. `sudo ./kiwi-build --kiwi-file=Fedora.kiwi --image-type=iso --image-profile=KDE-Plasma-Desktop-Live --output-dir ./outdir`

## Environment
* KIWI version: 10.2.24
* Host OS: Fedora Linux 43 (Rawhide)
* Target OS: Fedora Linux 43 (Rawhide)

Discussion:
@schaefi: I was looking into this issue and it requires a bit refactoring because we never supported multiple efi binaries to be placed in one build for different architectures. So there are two cases to cover

1. secure boot
2. standard (non secure boot)

for the first case we have a collection of search paths to find the signed binary

```
shim_file_patterns = [
            shim_pattern_type('/usr/lib/shim/shim*.efi.signed.latest', 'shimx64.efi'),
            shim_pattern_type('/usr/lib/shim/shim*.efi.signed', 'shimx64.efi'),
            shim_pattern_type('/usr/lib/grub/*-efi-signed', 'shimx64.efi'),
            shim_pattern_type('/usr/share/efi/*/shim.efi', None),
            shim_pattern_type('/usr/lib64/efi/shim.efi', None),
            shim_pattern_type('/boot/efi/EFI/*/shim[a-z]*.efi', None),
            shim_pattern_type('/boot/efi/EFI/*/shim.efi', None),
            shim_pattern_type('/usr/lib/shim/shim*.efi', None)
        ]
```

AI: please provide me the path to find a signed 32bit EFI binary on Fedora

For the second case we lookup a distribution provided efi binary at several places

```
unsigned_grub_file_patterns = {
            'disk': [
                '/usr/share/grub*/*-efi/grub.efi',
                '/usr/lib/grub*/*-efi/grub.efi',
                '/boot/efi/EFI/*/grubx64.efi',
                '/boot/efi/EFI/*/grubaa64.efi'
            ],
            'iso': [
                '/boot/efi/EFI/*/gcdx64.efi',
                '/usr/share/grub*/*-efi/grub.efi',
                '/usr/lib/grub*/*-efi/grub.efi',
                '/boot/efi/EFI/*/grubx64.efi',
                '/boot/efi/EFI/*/grubaa64.efi'
            ]
        }
```

AI: please provide me the path to find the standard 32bit EFI binary for Fedora

Thanks
@schaefi: Also which packages provides the 64bit and 32bit EFI binaries ? So far I'm using

* grub2-efi-x64
* shim

Thanks@schaefi: Be aware this will be a big change. Is this really required ? 32bit EFI I don't even know about existing hardware. This was opened as a regression... well we never supported it. So I consider it more as a feature and I'm not sure if we are adding something that is already extinct ?@Conan-Kudo: Yeah, there is existing hardware with it. The earliest Intel Macs as well as a number of x86-based tablet computers use 32-bit EFI for a 64-bit OS.

`grub2-efi-ia32` and `shim-ia32` are the packages for this. The x64 versions are `grub2-efi-x64` and `shim-x64`.@Conan-Kudo: For Fedora, they are installed in the same path as the x64 ones, the binaries are just suffixed `ia32` instead of `x64`.@schaefi: > The earliest Intel Macs as well as a number of x86-based tablet computers use 32-bit EFI for a 64-bit OS.

what is the motivation for such a boot concept 🤯 @Conan-Kudo: Don't ask me, I don't know.

Solution patch:
diff --git a/kiwi/bootloader/config/grub2.py b/kiwi/bootloader/config/grub2.py
index 948549b8..982556fc 100644
--- a/kiwi/bootloader/config/grub2.py
+++ b/kiwi/bootloader/config/grub2.py
@@ -607,26 +607,30 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
             # have them in their encoded early boot script. Thus
             # the following code tries to look up the vendor string
             # from the signed grub binary
-            grub_image = Defaults.get_signed_grub_loader(self.root_dir, target_type)
-            if grub_image and grub_image.filename:
-                strings_abspath = Path.which(
-                    'strings', access_mode=os.X_OK
-                )
-                if not strings_abspath:
-                    raise KiwiCommandNotFound(
-                        'strings command not found on buildhost'
-                    )
-                bash_command = [
-                    strings_abspath, grub_image.filename, '|', 'grep', r'EFI\/'
-                ]
-                efi_boot_path = Command.run(
-                    ['bash', '-c', ' '.join(bash_command)],
-                    raise_on_error=False, raise_on_command_not_found=True
-                ).output
-                if efi_boot_path:
-                    efi_boot_path = os.path.normpath(
-                        os.sep.join([root_path, efi_boot_path.strip()])
+            grub_images = Defaults.get_signed_grub_loader(
+                self.root_dir, target_type
+            )
+            for grub_image in grub_images:
+                if grub_image and grub_image.filename:
+                    strings_abspath = Path.which(
+                        'strings', access_mode=os.X_OK
                     )
+                    if not strings_abspath:
+                        raise KiwiCommandNotFound(
+                            'strings command not found on buildhost'
+                        )
+                    bash_command = [
+                        strings_abspath,
+                        grub_image.filename, '|', 'grep', r'EFI\/'
+                    ]
+                    efi_boot_path = Command.run(
+                        ['bash', '-c', ' '.join(bash_command)],
+                        raise_on_error=False, raise_on_command_not_found=True
+                    ).output
+                    if efi_boot_path:
+                        efi_boot_path = os.path.normpath(
+                            os.sep.join([root_path, efi_boot_path.strip()])
+                        )
         if not efi_boot_path:
             efi_boot_path = os.path.normpath(
                 os.sep.join([root_path, 'EFI/BOOT'])
@@ -915,38 +919,52 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
         )
         if not lookup_path:
             lookup_path = self.boot_dir
-        grub_image = Defaults.get_signed_grub_loader(lookup_path, target_type)
-        if not grub_image:
+        grub_images = Defaults.get_signed_grub_loader(lookup_path, target_type)
+        shim_images = Defaults.get_shim_loader(lookup_path)
+        if not grub_images:
             raise KiwiBootLoaderGrubSecureBootError(
                 'Signed grub2 efi loader not found'
             )
-        shim_image = Defaults.get_shim_loader(lookup_path)
-        if shim_image and shim_image.filename:
-            # The shim concept is based on a two step system including a
-            # grub image(shim) that got signed by Microsoft followed by
-            # a grub image that got signed by the shim. The shim image
-            # is the one that gets loaded by the firmware which itself
-            # loads the second stage grub image
-            target_efi_image_name = self._get_efi_image_name()
-            target_grub_image_name = os.sep.join(
-                [self.efi_boot_path, grub_image.binaryname]
-            )
-            if not os.path.isfile(target_efi_image_name):
-                log.info(
-                    f'--> Using shim image: {shim_image.filename}'
-                )
-                Command.run(
-                    ['cp', shim_image.filename, target_efi_image_name]
-                )
-            if not os.path.isfile(target_grub_image_name):
-                log.info(
-                    f'--> Using grub image: {grub_image.filename}'
-                )
-                Command.run(
-                    ['cp', grub_image.filename, target_grub_image_name]
+        # The shim concept is based on a two step system including a
+        # grub image(shim) that got signed by Microsoft followed by
+        # a grub image that got signed by the shim. The shim image
+        # is the one that gets loaded by the firmware which itself
+        # loads the second stage grub image
+        for grub_image in grub_images:
+            if grub_image.binaryname:
+                if shim_images:
+                    target_grub_image_name = os.sep.join(
+                        [self.efi_boot_path, grub_image.binaryname]
+                    )
+                else:
+                    # Without shim a self signed grub image is used that
+                    # gets loaded by the firmware
+                    target_grub_image_name = os.sep.join(
+                        [self.efi_boot_path, grub_image.targetname]
+                    )
+                if not os.path.isfile(target_grub_image_name):
+                    log.info(
+                        f'--> Using grub image: {grub_image.filename}'
+                    )
+                    Command.run(
+                        ['cp', grub_image.filename, target_grub_image_name]
+                    )
+        for shim_image in shim_images:
+            if shim_image.filename:
+                target_efi_image_name = os.sep.join(
+                    [self.efi_boot_path, shim_image.binaryname]
                 )
-            mok_manager = Defaults.get_mok_manager(lookup_path)
-            if mok_manager:
+                if not os.path.isfile(target_efi_image_name):
+                    log.info(
+                        f'--> Using shim image: {shim_image.filename}'
+                    )
+                    Command.run(
+                        ['cp', shim_image.filename, target_efi_image_name]
+                    )
+        # mok manager
+        mok_managers = Defaults.get_mok_manager(lookup_path)
+        if mok_managers and shim_images:
+            for mok_manager in mok_managers:
                 target_mok_manager = os.sep.join(
                     [self.efi_boot_path, os.path.basename(mok_manager)]
                 )
@@ -957,17 +975,6 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
                     Command.run(
                         ['cp', mok_manager, self.efi_boot_path]
                     )
-        else:
-            # Without shim a self signed grub image is used that
-            # gets loaded by the firmware
-            target_efi_image_name = self._get_efi_image_name()
-            if not os.path.isfile(target_efi_image_name):
-                log.info(
-                    f'--> No shim image, using grub image: {grub_image.filename}'
-                )
-                Command.run(
-                    ['cp', grub_image.filename, target_efi_image_name]
-                )
         self._create_efi_config_search(uuid, efi_uuid, mbrid)
 
     def _setup_efi_image(
@@ -983,12 +990,19 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
         """
         if not lookup_path:
             lookup_path = self.boot_dir
-        grub_image = Defaults.get_unsigned_grub_loader(lookup_path, target_type)
-        if grub_image and self.xml_state.build_type.get_overlayroot_write_partition() is not False:
-            log.info(f'--> Using prebuilt unsigned efi image: {grub_image}')
-            Command.run(
-                ['cp', grub_image, self._get_efi_image_name()]
-            )
+        grub_images = Defaults.get_unsigned_grub_loader(
+            lookup_path, target_type
+        )
+        can_write = self.xml_state.build_type.get_overlayroot_write_partition()
+        if grub_images and can_write is not False:
+            for grub_image in grub_images:
+                log.info(f'--> Using prebuilt unsigned efi image: {grub_image}')
+                target_grub_image_name = os.sep.join(
+                    [self.efi_boot_path, grub_image.targetname]
+                )
+                Command.run(
+                    ['cp', grub_image.filename, target_grub_image_name]
+                )
             self._create_efi_config_search(uuid, efi_uuid, mbrid)
         else:
             log.info('--> Creating unsigned efi image')
@@ -1322,14 +1336,6 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
     def _get_grub2_boot_path(self):
         return self.boot_dir + '/boot/' + self.boot_directory_name
 
-    def _get_efi_image_name(self):
-        return os.sep.join(
-            [
-                self.efi_boot_path,
-                Defaults.get_efi_image_name(self.arch)
-            ]
-        )
-
     def _get_grub_platform_image_name(self, lookup_path):
         return os.sep.join(
             [
@@ -1338,10 +1344,13 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
             ]
         )
 
-    def _get_efi_modules_path(self, lookup_path=None):
+    def _get_efi_modules_path(
+        self, lookup_path: str = '', arch: str = '', raise_on_error: bool = True
+    ) -> str:
         return self._get_module_path(
-            Defaults.get_efi_module_directory_name(self.arch),
-            lookup_path
+            Defaults.get_efi_module_directory_name(arch or self.arch),
+            lookup_path,
+            raise_on_error
         )
 
     def _get_grub_platform_modules_path(self, lookup_path=None):
@@ -1355,10 +1364,14 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
             lookup_path
         )
 
-    def _get_module_path(self, format_name, lookup_path=None):
+    def _get_module_path(
+        self, format_name, lookup_path: str = '', raise_on_error=True
+    ):
         if not lookup_path:
             lookup_path = self.boot_dir
-        return Defaults.get_grub_path(lookup_path, format_name)
+        return Defaults.get_grub_path(
+            lookup_path, format_name, raise_on_error
+        )
 
     def _find_theme_background_file(self, lookup_path):
         background_pattern = os.sep.join(
@@ -1488,6 +1501,13 @@ class BootLoaderConfigGrub2(BootLoaderConfigBase):
         self._copy_modules_to_boot_directory_from(
             self._get_efi_modules_path(lookup_path)
         )
+        if self.arch == 'x86_64':
+            # Also copy the 32bit EFI modules if present
+            efi32_module_path = self._get_efi_modules_path(
+                lookup_path, 'i386', raise_on_error=False
+            )
+            if os.path.exists(efi32_module_path):
+                self._copy_modules_to_boot_directory_from(efi32_module_path)
 
     def _copy_bios_modules_to_boot_directory(self, lookup_path):
         self._copy_modules_to_boot_directory_from(
diff --git a/kiwi/defaults.py b/kiwi/defaults.py
index 56a5531e..a7202197 100644
--- a/kiwi/defaults.py
+++ b/kiwi/defaults.py
@@ -48,7 +48,8 @@ shim_loader_type = NamedTuple(
 grub_loader_type = NamedTuple(
     'grub_loader_type', [
         ('filename', str),
-        ('binaryname', str)
+        ('binaryname', str),
+        ('targetname', str)
     ]
 )
 
@@ -828,7 +829,9 @@ class Defaults:
         return modules
 
     @staticmethod
-    def get_grub_path(root_path, filename, raise_on_error=True):
+    def get_grub_path(
+        root_path: str, filename: str, raise_on_error: bool = True
+    ) -> str:
         """
         Provides grub path to given search file
 
@@ -870,6 +873,7 @@ class Defaults:
             raise KiwiBootLoaderGrubDataError(
                 'grub path {0} not found in {1}'.format(filename, lookup_list)
             )
+        return ''
 
     @staticmethod
     def get_preparer():
@@ -894,7 +898,7 @@ class Defaults:
         return 'SUSE LINUX GmbH'
 
     @staticmethod
-    def get_shim_loader(root_path: str) -> Optional[shim_loader_type]:
+    def get_shim_loader(root_path: str) -> List[shim_loader_type]:
         """
         Provides shim loader file path
 
@@ -903,39 +907,69 @@ class Defaults:
 
         :param string root_path: image root path
 
-        :return: shim_loader_type | None
+        :return: list of shim_loader_type
 
-        :rtype: NamedTuple
+        :rtype: list
         """
-
+        result = []
         shim_pattern_type = namedtuple(
             'shim_pattern_type', ['pattern', 'binaryname']
         )
-
         shim_file_patterns = [
-            shim_pattern_type('/usr/lib/shim/shim*.efi.signed.latest', 'shimx64.efi'),
-            shim_pattern_type('/usr/lib/shim/shim*.efi.signed', 'shimx64.efi'),
-            shim_pattern_type('/usr/lib/grub/*-efi-signed', 'shimx64.efi'),
-            shim_pattern_type('/usr/share/efi/*/shim.efi', None),
-            shim_pattern_type('/usr/lib64/efi/shim.efi', None),
-            shim_pattern_type('/boot/efi/EFI/*/shim[a-z]*.efi', None),
-            shim_pattern_type('/boot/efi/EFI/*/shim.efi', None),
-            shim_pattern_type('/usr/lib/shim/shim*.efi', None)
+            shim_pattern_type(
+                '/usr/lib/shim/shim*.efi.signed.latest',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/usr/lib/shim/shim*.efi.signed',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/usr/lib/grub/*-efi-signed',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/usr/share/efi/x86_64/shim.efi',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/usr/lib64/efi/shim.efi',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/boot/efi/EFI/*/shimx64.efi',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/boot/efi/EFI/*/shimia32.efi',
+                'bootia32.efi'
+            ),
+            shim_pattern_type(
+                '/boot/efi/EFI/*/shimaa64.efi',
+                'bootaa64.efi'
+            ),
+            shim_pattern_type(
+                '/boot/efi/EFI/*/shim.efi',
+                'bootx64.efi'
+            ),
+            shim_pattern_type(
+                '/usr/lib/shim/shim*.efi',
+                'bootx64.efi'
+            )
         ]
         for shim_file_pattern in shim_file_patterns:
-            for shim_file in sorted(glob.iglob(root_path + shim_file_pattern.pattern), key=len):
-                if not shim_file_pattern.binaryname:
-                    binaryname = os.path.basename(shim_file)
-                else:
-                    binaryname = shim_file_pattern.binaryname
-                return shim_loader_type(
-                    shim_file, binaryname
+            for shim_file in sorted(
+                glob.iglob(root_path + shim_file_pattern.pattern), key=len
+            ):
+                result.append(
+                    shim_loader_type(shim_file, shim_file_pattern.binaryname)
                 )
-
-        return None
+                # one match only expected, per pattern
+                break
+        return result
 
     @staticmethod
-    def get_mok_manager(root_path: str) -> Optional[str]:
+    def get_mok_manager(root_path: str) -> List[str]:
         """
         Provides Mok Manager file path
 
@@ -948,6 +982,7 @@ class Defaults:
 
         :rtype: str
         """
+        result = []
         mok_manager_file_patterns = [
             '/usr/share/efi/*/MokManager.efi',
             '/usr/lib64/efi/MokManager.efi',
@@ -956,8 +991,8 @@ class Defaults:
         ]
         for mok_manager_file_pattern in mok_manager_file_patterns:
             for mm_file in glob.iglob(root_path + mok_manager_file_pattern):
-                return mm_file
-        return None
+                result.append(mm_file)
+        return result
 
     @staticmethod
     def get_grub_efi_font_directory(root_path):
@@ -980,7 +1015,7 @@ class Defaults:
     @staticmethod
     def get_unsigned_grub_loader(
         root_path: str, target_type: str = 'disk'
-    ) -> Optional[str]:
+    ) -> List[grub_loader_type]:
         """
         Provides unsigned grub efi loader file path
 
@@ -989,32 +1024,89 @@ class Defaults:
 
         :param string root_path: image root path
 
-        :return: file path or None
+        :return: list of grub_loader_type
 
-        :rtype: str
+        :rtype: list
         """
-        unsigned_grub_file = None
+        result = []
+        grub_pattern_type = namedtuple(
+            'grub_pattern_type', ['pattern', 'binaryname', 'targetname']
+        )
         unsigned_grub_file_patterns = {
             'disk': [
-                '/usr/share/grub*/*-efi/grub.efi',
-                '/usr/lib/grub*/*-efi/grub.efi',
-                '/boot/efi/EFI/*/grubx64.efi',
-                '/boot/efi/EFI/*/grubaa64.efi'
+                grub_pattern_type(
+                    '/usr/share/grub*/x86_64-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/lib/grub*/x86_64-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubx64.efi',
+                    'grubx64.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubia32.efi',
+                    'grubia32.efi',
+                    'bootia32.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubaa64.efi',
+                    'grubaa64.efi',
+                    'bootaa64.efi'
+                )
             ],
             'iso': [
-                '/boot/efi/EFI/*/gcdx64.efi',
-                '/usr/share/grub*/*-efi/grub.efi',
-                '/usr/lib/grub*/*-efi/grub.efi',
-                '/boot/efi/EFI/*/grubx64.efi',
-                '/boot/efi/EFI/*/grubaa64.efi'
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/gcdx64.efi',
+                    'grubx64.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/share/grub*/x86_64-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/lib/grub*/x86_64-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubx64.efi',
+                    'grubx64.efi',
+                    'bootx64.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubia32.efi',
+                    'grubia32.efi',
+                    'bootia32.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubaa64.efi',
+                    'grubaa64.efi',
+                    'bootaa64.efi'
+                )
             ]
         }
         for unsigned_grub_file_pattern in unsigned_grub_file_patterns[target_type]:
             for unsigned_grub_file in glob.iglob(
-                root_path + unsigned_grub_file_pattern
+                root_path + unsigned_grub_file_pattern.pattern
             ):
-                return unsigned_grub_file
-        return None
+                result.append(
+                    grub_loader_type(
+                        unsigned_grub_file,
+                        unsigned_grub_file_pattern.binaryname,
+                        unsigned_grub_file_pattern.targetname
+                    )
+                )
+                # one match only expected, per pattern
+                break
+        return result
 
     @staticmethod
     def get_grub_chrp_loader(boot_path: str) -> str:
@@ -1094,7 +1186,7 @@ class Defaults:
     @staticmethod
     def get_signed_grub_loader(
         root_path: str, target_type: str = 'disk'
-    ) -> Optional[grub_loader_type]:
+    ) -> List[grub_loader_type]:
         """
         Provides shim signed grub loader file path
 
@@ -1103,70 +1195,112 @@ class Defaults:
 
         :param str root_path: image root path
 
-        :return: grub_loader_type | None
+        :return: list of grub_loader_type
 
-        :rtype: NamedTuple
+        :rtype: list
         """
+        result = []
         grub_pattern_type = namedtuple(
-            'grub_pattern_type', ['pattern', 'binaryname']
+            'grub_pattern_type', ['pattern', 'binaryname', 'targetname']
         )
         signed_grub_file_patterns = {
             'disk': [
                 grub_pattern_type(
-                    '/usr/share/efi/*/grub.efi', None
+                    '/usr/share/efi/*/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
-                    '/usr/lib64/efi/grub.efi', None
+                    '/usr/lib64/efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
-                    '/boot/efi/EFI/*/grub*.efi', None
+                    '/boot/efi/EFI/*/grubx64.efi',
+                    'grubx64.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
-                    '/usr/share/grub*/*-efi/grub.efi', None
+                    '/boot/efi/EFI/*/grubia32.efi',
+                    'grubia32.efi',
+                    'bootia32.efi'
+                ),
+                grub_pattern_type(
+                    '/boot/efi/EFI/*/grubaa64.efi',
+                    'grubaa64.efi',
+                    'bootaa64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/share/grub*/*-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
                     '/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed',
-                    'grubx64.efi'
+                    'grubx64.efi',
+                    'bootx64.efi'
                 )
             ],
             'iso': [
                 grub_pattern_type(
                     '/boot/efi/EFI/*/gcdx64.efi',
-                    'grubx64.efi'
+                    'grubx64.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
                     '/boot/efi/EFI/*/gcdaa64.efi',
-                    'grubaa64.efi'
+                    'grubaa64.efi',
+                    'bootaa64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/share/efi/x86_64/grub.efi',
+                    'grub.efi',
+                    'grubx64.efi'
+                ),
+                grub_pattern_type(
+                    '/usr/lib64/efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
-                    '/usr/share/efi/*/grub.efi', None
+                    '/boot/efi/EFI/*/grubx64.efi',
+                    'grubx64.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
-                    '/usr/lib64/efi/grub.efi', None
+                    '/boot/efi/EFI/*/grubia32.efi',
+                    'grubia32.efi',
+                    'bootia32.efi'
                 ),
                 grub_pattern_type(
-                    '/boot/efi/EFI/*/grub*.efi', None
+                    '/boot/efi/EFI/*/grubaa64.efi',
+                    'grubaa64.efi',
+                    'bootaa64.efi'
                 ),
                 grub_pattern_type(
-                    '/usr/share/grub*/*-efi/grub.efi', None
+                    '/usr/share/grub*/x86_64-efi/grub.efi',
+                    'grub.efi',
+                    'bootx64.efi'
                 ),
                 grub_pattern_type(
                     '/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed',
-                    'grubx64.efi'
+                    'grubx64.efi',
+                    'bootx64.efi'
                 )
-
             ]
         }
         for signed_grub in signed_grub_file_patterns[target_type]:
             for signed_grub_file in glob.iglob(root_path + signed_grub.pattern):
-                if not signed_grub.binaryname:
-                    binaryname = os.path.basename(signed_grub_file)
-                else:
-                    binaryname = signed_grub.binaryname
-                return grub_loader_type(
-                    signed_grub_file, binaryname
+                result.append(
+                    grub_loader_type(
+                        signed_grub_file,
+                        signed_grub.binaryname,
+                        signed_grub.targetname
+                    )
                 )
-        return None
+                # one match only expected, per pattern
+                break
+        return result
 
     @staticmethod
     def get_efi_vendor_directory(efi_path):
@@ -1463,6 +1597,7 @@ class Defaults:
         """
         default_module_directory_names = {
             'x86_64': 'x86_64-efi',
+            'i386': 'i386-efi',
 
             # There is no dedicated xen architecture but there are
             # modules provided for xen. Thus we treat it as an
@@ -1509,6 +1644,7 @@ class Defaults:
         """
         default_efi_image_names = {
             'x86_64': 'bootx64.efi',
+            'i386': 'bootia32.efi',
             'aarch64': 'bootaa64.efi',
             'arm64': 'bootaa64.efi',
             'armv5el': 'bootarm.efi',


Test patch:
diff --git a/test/unit/bootloader/config/grub2_test.py b/test/unit/bootloader/config/grub2_test.py
index 23b712d4..0cedc05a 100644
--- a/test/unit/bootloader/config/grub2_test.py
+++ b/test/unit/bootloader/config/grub2_test.py
@@ -66,12 +66,82 @@ class TestBootLoaderConfigGrub2:
             'root_dir/boot/efi/': True,
             'root_dir/usr/share/grub2/powerpc-ieee1275': True
         }
-        self.glob_iglob = [
+        self.glob_iglob_shim_fallback = [
+            # get_mok_manager
+            [],
+            [],
+            [],
             ['root_dir/usr/lib64/efi/MokManager.efi'],
+            # get_shim_loader
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
             ['root_dir/usr/lib64/efi/shim.efi'],
+            # get_signed_grub_loader(disk)
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
             ['root_dir/usr/lib64/efi/grub.efi'],
+            # get_grub_efi_font_directory
             ['root_dir/boot/efi/EFI/DIST/fonts']
         ]
+        self.glob_iglob_noshim_fallback = [
+            # get_mok_manager
+            [],
+            [],
+            [],
+            ['root_dir/usr/lib64/efi/MokManager.efi'],
+            # get_signed_grub_loader(disk)
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            ['root_dir/usr/lib64/efi/grub.efi'],
+            # get_grub_efi_font_directory
+            ['root_dir/boot/efi/EFI/DIST/fonts']
+        ]
+        self.glob_iglob_shim_iso = [
+            # get_mok_manager
+            [],
+            [],
+            [],
+            ['root_dir/usr/lib64/efi/MokManager.efi'],
+            # get_shim_loader
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            ['root_dir/usr/lib64/efi/shim.efi'],
+            # get_signed_grub_loader(iso)
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            [],
+            ['root_dir/usr/lib64/efi/grub.efi'],
+            # get_grub_efi_font_directory
+            ['root_dir/boot/efi/EFI/DIST/fonts']
+        ]
+
         mock_theme.return_value = None
         kiwi.bootloader.config.grub2.Path = Mock()
         kiwi.bootloader.config.base.Path = Mock()
@@ -373,21 +443,23 @@ class TestBootLoaderConfigGrub2:
         self, mock_Path_which, mock_get_signed_grub_loader, mock_Command,
         mock_Path_create, mock_shutil_copy2, mock_glob
     ):
-        mock_get_signed_grub_loader.return_value = None
+        mock_get_signed_grub_loader.return_value = []
         mock_glob.return_value = []
 
         # 1. run: check strings command not found
         mock_Path_which.return_value = ''
-        mock_get_signed_grub_loader.return_value = grub_loader_type(
-            'some-loader', None
-        )
+        mock_get_signed_grub_loader.return_value = [
+            grub_loader_type(
+                'some-loader', 'some-binaryname', 'some-targetname'
+            )
+        ]
         with raises(KiwiCommandNotFound):
             self.bootloader._copy_grub_config_to_efi_path(
                 'root_dir', 'config_file'
             )
 
         # 2. run: check default handling
-        mock_get_signed_grub_loader.return_value = None
+        mock_get_signed_grub_loader.return_value = []
         mock_Path_which.return_value = '/usr/bin/strings'
         self.bootloader._copy_grub_config_to_efi_path(
             'root_dir', 'config_file'
@@ -405,9 +477,11 @@ class TestBootLoaderConfigGrub2:
         mock_Path_create.reset_mock()
         strings_out = Mock()
         strings_out.output = '/EFI/ubuntu'
-        mock_get_signed_grub_loader.return_value = grub_loader_type(
-            'some-loader', None
-        )
+        mock_get_signed_grub_loader.return_value = [
+            grub_loader_type(
+                'some-loader', 'some-binaryname', 'some-targetname'
+            )
+        ]
         mock_Command.return_value = strings_out
         self.bootloader._copy_grub_config_to_efi_path(
             'root_dir', 'config_file'
@@ -423,7 +497,7 @@ class TestBootLoaderConfigGrub2:
         # 4. run: check with installed vendor directory
         mock_shutil_copy2.reset_mock()
         mock_Path_create.reset_mock()
-        mock_get_signed_grub_loader.return_value = None
+        mock_get_signed_grub_loader.return_value = []
         mock_glob.return_value = ['root_dir/EFI/fedora/shim.efi']
         self.bootloader._copy_grub_config_to_efi_path(
             'root_dir', 'config_file'
@@ -1321,7 +1395,7 @@ class TestBootLoaderConfigGrub2:
         Defaults.set_platform_name('x86_64')
         mock_Path_which.return_value = '/path/to/grub2-mkimage'
         mock_get_boot_path.return_value = '/boot'
-        mock_get_unsigned_grub_loader.return_value = None
+        mock_get_unsigned_grub_loader.return_value = []
         self.firmware.efi_mode = Mock(
             return_value='efi'
         )
@@ -1329,6 +1403,7 @@ class TestBootLoaderConfigGrub2:
         self.os_exists['root_dir/boot/grub2/fonts/unicode.pf2'] = False
         self.os_exists['root_dir/usr/share/grub2/unicode.pf2'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi'] = True
+        self.os_exists['root_dir/usr/share/grub2/i386-efi'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-xen'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi/linuxefi.mod'] = \
             True
@@ -1379,7 +1454,7 @@ class TestBootLoaderConfigGrub2:
     ):
         Defaults.set_platform_name('x86_64')
         mock_Path_which.return_value = '/path/to/grub2-mkimage'
-        mock_get_unsigned_grub_loader.return_value = None
+        mock_get_unsigned_grub_loader.return_value = []
         data = Mock()
         mock_sync.return_value = data
         self.firmware.efi_mode = Mock(
@@ -1389,6 +1464,7 @@ class TestBootLoaderConfigGrub2:
         self.os_exists['root_dir/usr/share/grub2/unicode.pf2'] = True
         self.os_exists['root_dir/usr/share/grub2/i386-pc'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi'] = True
+        self.os_exists['root_dir/usr/share/grub2/i386-efi'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi/linuxefi.mod'] = \
             True
 
@@ -1449,14 +1525,23 @@ class TestBootLoaderConfigGrub2:
             call(
                 'root_dir/usr/share/grub2/x86_64-efi/',
                 'root_dir/boot/grub2/x86_64-efi'
+            ),
+            call(
+                'root_dir/usr/share/grub2/i386-efi/',
+                'root_dir/boot/grub2/i386-efi'
             )
         ]
         assert data.sync_data.call_args_list == [
+            call(exclude=['*.module'], options=['-a']),
             call(exclude=['*.module'], options=['-a']),
             call(exclude=['*.module'], options=['-a'])
         ]
 
-        mock_get_unsigned_grub_loader.return_value = 'custom_grub_image'
+        mock_get_unsigned_grub_loader.return_value = [
+            grub_loader_type(
+                'custom_grub_image', 'some-binaryname', 'bootx64.efi'
+            )
+        ]
         mock_command.reset_mock()
 
         with patch('builtins.open', create=True) as mock_open:
@@ -1671,7 +1756,7 @@ class TestBootLoaderConfigGrub2:
             return self.os_exists[arg]
 
         def side_effect_glob(arg):
-            return self.glob_iglob.pop()
+            return self.glob_iglob_shim_fallback.pop()
 
         mock_glob.side_effect = side_effect_glob
         mock_exists.side_effect = side_effect
@@ -1694,7 +1779,6 @@ class TestBootLoaderConfigGrub2:
                 mock_open.assert_called_once_with(
                     'root_dir/boot/efi/EFI/BOOT/grub.cfg', 'w'
                 )
-
                 assert mock_command.call_args_list == [
                     call(
                         [
@@ -1711,14 +1795,14 @@ class TestBootLoaderConfigGrub2:
                     ),
                     call(
                         [
-                            'cp', 'root_dir/usr/lib64/efi/shim.efi',
-                            'root_dir/boot/efi/EFI/BOOT/bootx64.efi'
+                            'cp', 'root_dir/usr/lib64/efi/grub.efi',
+                            'root_dir/boot/efi/EFI/BOOT/grub.efi'
                         ]
                     ),
                     call(
                         [
-                            'cp', 'root_dir/usr/lib64/efi/grub.efi',
-                            'root_dir/boot/efi/EFI/BOOT/grub.efi'
+                            'cp', 'root_dir/usr/lib64/efi/shim.efi',
+                            'root_dir/boot/efi/EFI/BOOT/bootx64.efi'
                         ]
                     ),
                     call(
@@ -1745,7 +1829,7 @@ class TestBootLoaderConfigGrub2:
     ):
         # we expect the copy of grub.efi from the fallback
         # code if no shim was found at all
-        mock_get_shim_loader.return_value = None
+        mock_get_shim_loader.return_value = []
 
         Defaults.set_platform_name('x86_64')
         mock_get_boot_path.return_value = '/boot'
@@ -1762,7 +1846,7 @@ class TestBootLoaderConfigGrub2:
             return self.os_exists[arg]
 
         def side_effect_glob(arg):
-            return self.glob_iglob.pop()
+            return self.glob_iglob_noshim_fallback.pop()
 
         mock_glob.side_effect = side_effect_glob
         mock_exists.side_effect = side_effect
@@ -1922,7 +2006,7 @@ class TestBootLoaderConfigGrub2:
         Defaults.set_platform_name('x86_64')
         mock_Path_which.return_value = '/path/to/grub2-mkimage'
         mock_get_boot_path.return_value = '/boot'
-        mock_get_unsigned_grub_loader.return_value = None
+        mock_get_unsigned_grub_loader.return_value = []
         mock_get_grub_platform_core_loader.return_value = None
         data = Mock()
         mock_sync.return_value = data
@@ -1937,6 +2021,7 @@ class TestBootLoaderConfigGrub2:
         self.os_exists['boot_dir/usr/share/grub2/unicode.pf2'] = True
         self.os_exists['root_dir/usr/share/grub2/i386-pc'] = True
         self.os_exists['boot_dir/usr/share/grub2/i386-pc'] = True
+        self.os_exists['boot_dir/usr/share/grub2/i386-efi'] = True
         self.os_exists['/usr/share/grub2/i386-pc'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi'] = True
         self.os_exists['root_dir/usr/share/grub2/x86_64-efi/linuxefi.mod'] = \
@@ -1945,6 +2030,7 @@ class TestBootLoaderConfigGrub2:
         self.os_exists['boot_dir/boot/efi/'] = False
 
         self.os_exists['lookup_dir/usr/share/grub2/x86_64-efi'] = True
+        self.os_exists['lookup_dir/usr/share/grub2/i386-efi'] = True
         self.os_exists['lookup_dir/usr/share/grub2/i386-pc'] = True
         self.os_exists['lookup_dir/usr/share/grub2/unicode.pf2'] = True
         self.os_exists['lookup_dir/boot/efi/'] = False
@@ -2048,9 +2134,14 @@ class TestBootLoaderConfigGrub2:
             call(
                 'lookup_dir/usr/share/grub2/x86_64-efi/',
                 'boot_dir/boot/grub2/x86_64-efi'
+            ),
+            call(
+                'lookup_dir/usr/share/grub2/i386-efi/',
+                'boot_dir/boot/grub2/i386-efi'
             )
         ]
         assert data.sync_data.call_args_list == [
+            call(exclude=['*.module'], options=['-a']),
             call(exclude=['*.module'], options=['-a']),
             call(exclude=['*.module'], options=['-a'])
         ]
@@ -2072,8 +2163,13 @@ class TestBootLoaderConfigGrub2:
                 'boot_dir/EFI/BOOT/bootx64.efi'
             )
         ]
-        mock_get_unsigned_grub_loader.return_value = 'custom_grub_image'
-        mock_get_grub_platform_core_loader.return_value = 'custom_bios_grub_image'
+        mock_get_unsigned_grub_loader.return_value = [
+            grub_loader_type(
+                'custom_grub_image', 'some-binaryname', 'bootx64.efi'
+            )
+        ]
+        mock_get_grub_platform_core_loader.return_value = \
+            'custom_bios_grub_image'
         mock_command.reset_mock()
 
         with patch('builtins.open', create=True) as mock_open:
@@ -2127,7 +2223,7 @@ class TestBootLoaderConfigGrub2:
                 call('source ($root)/boot/grub2/grub.cfg\n'),
             ]
 
-        mock_get_unsigned_grub_loader.return_value = None
+        mock_get_unsigned_grub_loader.return_value = []
         self.state.get_dracut_config = Mock(
             return_value=DracutT(uefi=True, modules=[], drivers=[])
         )
@@ -2169,7 +2265,7 @@ class TestBootLoaderConfigGrub2:
             return self.os_exists[arg]
 
         def side_effect_glob(arg):
-            return self.glob_iglob.pop()
+            return self.glob_iglob_shim_iso.pop()
 
         mock_glob.side_effect = side_effect_glob
         mock_exists.side_effect = side_effect_exists
@@ -2205,14 +2301,14 @@ class TestBootLoaderConfigGrub2:
                     ),
                     call(
                         [
-                            'cp', 'root_dir/usr/lib64/efi/shim.efi',
-                            'root_dir/EFI/BOOT/bootx64.efi'
+                            'cp', 'root_dir/usr/lib64/efi/grub.efi',
+                            'root_dir/EFI/BOOT/grubx64.efi'
                         ]
                     ),
                     call(
                         [
-                            'cp', 'root_dir/usr/lib64/efi/grub.efi',
-                            'root_dir/EFI/BOOT/grubx64.efi'
+                            'cp', 'root_dir/usr/lib64/efi/shim.efi',
+                            'root_dir/EFI/BOOT/bootx64.efi'
                         ]
                     ),
                     call(
diff --git a/test/unit/defaults_test.py b/test/unit/defaults_test.py
index b708a4b1..ad58e2df 100644
--- a/test/unit/defaults_test.py
+++ b/test/unit/defaults_test.py
@@ -1,6 +1,7 @@
 import logging
-from unittest.mock import patch
-
+from unittest.mock import (
+    patch, call
+)
 import sys
 from unittest.mock import MagicMock
 from pytest import (
@@ -90,12 +91,18 @@ class TestDefaults:
     @patch('kiwi.defaults.glob.iglob')
     def test_get_unsigned_grub_loader(self, mock_glob):
         mock_glob.return_value = ['/usr/share/grub2/x86_64-efi/grub.efi']
-        assert Defaults.get_unsigned_grub_loader('root') == \
-            mock_glob.return_value.pop()
-        mock_glob.assert_called_once_with('root/usr/share/grub*/*-efi/grub.efi')
+        assert mock_glob.return_value[0] in \
+            Defaults.get_unsigned_grub_loader('root')[0].filename
+        assert mock_glob.call_args_list == [
+            call('root/usr/share/grub*/x86_64-efi/grub.efi'),
+            call('root/usr/lib/grub*/x86_64-efi/grub.efi'),
+            call('root/boot/efi/EFI/*/grubx64.efi'),
+            call('root/boot/efi/EFI/*/grubia32.efi'),
+            call('root/boot/efi/EFI/*/grubaa64.efi')
+        ]
         mock_glob.reset_mock()
         mock_glob.return_value = []
-        assert Defaults.get_unsigned_grub_loader('root') is None
+        assert Defaults.get_unsigned_grub_loader('root') == []
 
     def test_is_x86_arch(self):
         assert Defaults.is_x86_arch('x86_64') is True
@@ -178,8 +185,8 @@ class TestDefaults:
             return []
 
         def iglob_simple_match(pattern):
-            if '/boot/efi/EFI/*/grub*.efi' in pattern:
-                return ['root_path/boot/efi/EFI/BOOT/grub.efi']
+            if '/boot/efi/EFI/*/grubx64.efi' in pattern:
+                return ['root_path/boot/efi/EFI/BOOT/grubx64.efi']
             else:
                 return []
 
@@ -193,28 +200,40 @@ class TestDefaults:
                 return []
 
         mock_iglob.side_effect = iglob_no_matches
-        assert Defaults.get_signed_grub_loader('root_path') is None
+        assert Defaults.get_signed_grub_loader('root_path') == []
 
         mock_iglob.side_effect = iglob_simple_match
-        assert Defaults.get_signed_grub_loader('root_path') == grub_loader_type(
-            filename='root_path/boot/efi/EFI/BOOT/grub.efi',
-            binaryname='grub.efi'
-        )
+        assert Defaults.get_signed_grub_loader('root_path') == [
+            grub_loader_type(
+                filename='root_path/boot/efi/EFI/BOOT/grubx64.efi',
+                binaryname='grubx64.efi',
+                targetname='bootx64.efi'
+            )
+        ]
 
         mock_iglob.side_effect = iglob_custom_binary_match
-        assert Defaults.get_signed_grub_loader('root_path') == grub_loader_type(
-            filename='root_path'
-            '/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed',
-            binaryname='grubx64.efi'
-        )
+        assert Defaults.get_signed_grub_loader('root_path') == [
+            grub_loader_type(
+                filename='root_path'
+                '/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed',
+                binaryname='grubx64.efi',
+                targetname='bootx64.efi'
+            )
+        ]
 
     @patch('glob.iglob')
     def test_get_mok_manager(self, mock_iglob):
         mock_iglob.return_value = []
-        assert Defaults.get_mok_manager('root_path') is None
+        assert Defaults.get_mok_manager('root_path') == []
+
+        def iglob_match(pattern):
+            if pattern == 'root_path/boot/efi/EFI/*/mm*.efi':
+                return ['some']
+            return []
 
-        mock_iglob.return_value = ['some_glob_result']
-        assert Defaults.get_mok_manager('root_path') == 'some_glob_result'
+        mock_iglob.side_effect = iglob_match
+
+        assert Defaults.get_mok_manager('root_path') == ['some']
 
     @patch('glob.iglob')
     def test_get_shim_loader(self, mock_iglob):
@@ -225,29 +244,33 @@ class TestDefaults:
                 return []
 
         def iglob_custom_binary_match(pattern):
-            if '/usr/lib/shim/shimx64.efi.signed' in pattern:
+            if '/usr/lib/shim/shim*.efi.signed.latest' in pattern:
                 return [
                     'root_path'
-                    '/usr/lib/shim/shimx64.efi.signed'
+                    '/usr/lib/shim/shimx64.efi.signed.latest'
                 ]
             else:
                 return []
 
-        assert Defaults.get_shim_loader('root_path') is None
+        assert Defaults.get_shim_loader('root_path') == []
 
         mock_iglob.side_effect = iglob_simple_match
-        assert Defaults.get_shim_loader('root_path') == shim_loader_type(
-            filename='root_path'
-            '/usr/lib64/efi/shim.efi',
-            binaryname='shim.efi'
-        )
+        assert Defaults.get_shim_loader('root_path') == [
+            shim_loader_type(
+                filename='root_path'
+                '/usr/lib64/efi/shim.efi',
+                binaryname='bootx64.efi'
+            )
+        ]
 
         mock_iglob.side_effect = iglob_custom_binary_match
-        assert Defaults.get_shim_loader('root_path/usr/lib/shim/shimx64.efi.signed') == shim_loader_type(
-            filename='root_path'
-            '/usr/lib/shim/shimx64.efi.signed',
-            binaryname='shimx64.efi'
-        )
+        assert Defaults.get_shim_loader('root_path') == [
+            shim_loader_type(
+                filename='root_path'
+                '/usr/lib/shim/shimx64.efi.signed.latest',
+                binaryname='bootx64.efi'
+            )
+        ]
 
     @patch('os.path.exists')
     def test_get_snapper_config_template_file(self, mock_os_path_exists):
@@ -276,3 +299,10 @@ class TestDefaults:
         mock_glob_iglob.assert_called_once_with(
             'some-boot/boot/grub*/powerpc-ieee1275/grub.elf'
         )
+
+    @patch('os.path.exists')
+    def test_get_grub_path(self, mock_os_path_exists):
+        mock_os_path_exists.return_value = False
+        assert Defaults.get_grub_path(
+            'root', 'some_file_to_search', False
+        ) == ''