Skip to content

Commit c095eb5

Browse files
authored
Added a try-rerun-except block to grub-install (#1085)
* Added a try-rerun-except block to grub-install first with --removable and then without if it fails. I have a sneaky suspicion that it's due to USB drives being the destination medium, but I cannot confirm yet. I've also added peak_output=True and --debug to GRUB so we can catch the issues in the future. * Fixed flake8 complaint
1 parent 12b5e2e commit c095eb5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

archinstall/lib/installer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,15 @@ def add_grub_bootloader(self, boot_partition :Partition, root_partition :Partiti
832832
if has_uefi():
833833
self.pacstrap('efibootmgr') # TODO: Do we need? Yes, but remove from minimal_installation() instead?
834834
try:
835-
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable')
836-
except SysCallError as error:
837-
raise DiskError(f"Could not install GRUB to {self.target}/boot: {error}")
835+
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --debug --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable', peak_output=True)
836+
except SysCallError:
837+
try:
838+
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --debug --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable', peak_output=True)
839+
except SysCallError as error:
840+
raise DiskError(f"Could not install GRUB to {self.target}/boot: {error}")
838841
else:
839842
try:
840-
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {boot_partition.parent}')
843+
SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --debug --target=i386-pc --recheck {boot_partition.parent}', peak_output=True)
841844
except SysCallError as error:
842845
raise DiskError(f"Could not install GRUB to {boot_partition.path}: {error}")
843846

0 commit comments

Comments
 (0)