Skip to content

Commit 42a4ee8

Browse files
authored
Make removable location the default for bootloader installation (#4030)
Also update the option's description to make it clear that it being enabled is the sane default.
1 parent 6968a33 commit 42a4ee8

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

archinstall/lib/args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def from_config(cls, args_config: dict[str, Any], args: Arguments) -> 'ArchConfi
185185
uki = args_config.get('uki', False)
186186
if uki and not bootloader.has_uki_support():
187187
uki = False
188-
arch_config.bootloader_config = BootloaderConfiguration(bootloader=bootloader, uki=uki, removable=False)
188+
arch_config.bootloader_config = BootloaderConfiguration(bootloader=bootloader, uki=uki, removable=True)
189189

190190
# deprecated: backwards compatibility
191191
audio_config_args = args_config.get('audio_config', None)

archinstall/lib/bootloader/bootloader_menu.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def _prev_uki(self, item: MenuItem) -> str | None:
8383

8484
def _prev_removable(self, item: MenuItem) -> str | None:
8585
if item.value:
86-
return tr('Will install to /EFI/BOOT/ (removable location)')
87-
return tr('Will install to standard location with NVRAM entry')
86+
return tr('Will install to /EFI/BOOT/ (removable location, safe default)')
87+
return tr('Will install to custom location with NVRAM entry')
8888

8989
@override
9090
def run(
@@ -114,6 +114,9 @@ def _select_bootloader(self, preset: Bootloader | None) -> Bootloader | None:
114114
removable_item.value = False
115115
self._bootloader_conf.removable = False
116116
else:
117+
if not removable_item.enabled:
118+
removable_item.value = True
119+
self._bootloader_conf.removable = True
117120
removable_item.enabled = True
118121

119122
return bootloader
@@ -147,18 +150,26 @@ def _select_removable(self, preset: bool) -> bool:
147150
+ '\n\n'
148151
+ tr('This installs the bootloader to /EFI/BOOT/BOOTX64.EFI (or similar) which is useful for:')
149152
+ '\n\n • '
153+
+ tr('Firmware that does not properly support NVRAM boot entries like most MSI motherboards,')
154+
+ '\n '
155+
+ tr('most Apple Macs, many laptops...')
156+
+ '\n • '
150157
+ tr('USB drives or other portable external media.')
151158
+ '\n • '
152159
+ tr('Systems where you want the disk to be bootable on any computer.')
153-
+ '\n • '
154-
+ tr('Firmware that does not properly support NVRAM boot entries.')
155160
+ '\n\n'
156161
+ tr(
157162
textwrap.dedent(
158163
"""\
159-
This is NOT recommended if none of the above apply, as it makes installing multiple
160-
EFI bootloaders on the same disk more challenging, and it overwrites whatever bootloader
161-
was previously installed on the default removable media search location, if any.
164+
If you do not know what this means, LEAVE THIS OPTION ENABLED, as it is the safe default.
165+
166+
It is suggested to disable this if none of the above apply, as it makes installing multiple
167+
EFI bootloaders on the same disk easier, and it will not overwrite whatever bootloader
168+
was previously installed at the default removable media search location, if any.
169+
170+
It may also make the installation more resilient in case of dual-booting with Windows,
171+
as Windows is known to sometimes erase or replace the bootloader installed at the removable
172+
location.
162173
"""
163174
)
164175
)

archinstall/lib/models/bootloader.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def from_arg(cls, bootloader: str, skip_boot: bool) -> Bootloader:
6565
class BootloaderConfiguration:
6666
bootloader: Bootloader
6767
uki: bool = False
68-
removable: bool = False
68+
removable: bool = True
6969

7070
def json(self) -> dict[str, Any]:
7171
return {'bootloader': self.bootloader.json(), 'uki': self.uki, 'removable': self.removable}
@@ -74,12 +74,14 @@ def json(self) -> dict[str, Any]:
7474
def parse_arg(cls, config: dict[str, Any], skip_boot: bool) -> BootloaderConfiguration:
7575
bootloader = Bootloader.from_arg(config.get('bootloader', ''), skip_boot)
7676
uki = config.get('uki', False)
77-
removable = config.get('removable', False)
77+
removable = config.get('removable', True)
7878
return cls(bootloader=bootloader, uki=uki, removable=removable)
7979

8080
@classmethod
8181
def get_default(cls) -> BootloaderConfiguration:
82-
return cls(bootloader=Bootloader.get_default(), uki=False, removable=False)
82+
bootloader = Bootloader.get_default()
83+
removable = SysInfo.has_uefi() and bootloader.has_removable_support()
84+
return cls(bootloader=bootloader, uki=False, removable=removable)
8385

8486
def preview(self) -> str:
8587
text = f'{tr("Bootloader")}: {self.bootloader.value}'

0 commit comments

Comments
 (0)