Skip to content

Commit b5fc766

Browse files
committed
Fix GRUB fallback-from-removable logic introduced in c095eb5
Commit c095eb5 was supposed to introduce logic such that if the `grub-install` command failed with a `--removable` flag, then another attempt would be made with such flag removed. This was broken because the `--removable` flag was kept in both cases (likely a copy-paste mistake). This has been an issue since, in all future iterations of the code. What this commit does is fix this logic, but also invert the cases tested: first test without `--removable`, then add it should that case fail, as this is the most sensible thing to do.
1 parent 6030206 commit b5fc766

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

archinstall/lib/installer.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,11 +1321,15 @@ def _add_grub_bootloader(
13211321

13221322
try:
13231323
SysCommand(command, peek_output=True)
1324-
except SysCallError:
1325-
try:
1326-
SysCommand(command, peek_output=True)
1327-
except SysCallError as err:
1328-
raise DiskError(f'Could not install GRUB to {self.target}{efi_partition.mountpoint}: {err}')
1324+
except SysCallError as err:
1325+
if not bootloader_removable:
1326+
command.append('--removable')
1327+
try:
1328+
SysCommand(command, peek_output=True)
1329+
except SysCallError:
1330+
pass
1331+
1332+
raise DiskError(f'Could not install GRUB to {self.target}{efi_partition.mountpoint}: {err}') from err
13291333
else:
13301334
info(f'GRUB boot partition: {boot_partition.dev_path}')
13311335

0 commit comments

Comments
 (0)