Skip to content

Commit 6fc0bc3

Browse files
authored
Fix GRUB fallback-from-removable logic introduced in c095eb5 (#3950)
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 7732d50 commit 6fc0bc3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

archinstall/lib/installer.py

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

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

0 commit comments

Comments
 (0)