@@ -1058,12 +1058,17 @@ def _add_systemd_bootloader(
10581058 if not SysInfo .has_uefi ():
10591059 raise HardwareIncompatibilityError
10601060
1061+ if not efi_partition :
1062+ raise ValueError ('Could not detect EFI system partition' )
1063+ elif not efi_partition .mountpoint :
1064+ raise ValueError ('EFI system partition is not mounted' )
1065+
10611066 # TODO: Ideally we would want to check if another config
10621067 # points towards the same disk and/or partition.
10631068 # And in which case we should do some clean up.
10641069 bootctl_options = []
10651070
1066- if efi_partition and boot_partition != efi_partition :
1071+ if boot_partition != efi_partition :
10671072 bootctl_options .append (f'--esp-path={ efi_partition .mountpoint } ' )
10681073 bootctl_options .append (f'--boot-path={ boot_partition .mountpoint } ' )
10691074
@@ -1074,14 +1079,11 @@ def _add_systemd_bootloader(
10741079 # Fallback, try creating the boot loader without touching the EFI variables
10751080 SysCommand (f"arch-chroot { self .target } bootctl --no-variables { ' ' .join (bootctl_options )} install" )
10761081
1077- # Ensure that the $BOOT/loader/ directory exists before we try to create files in it.
1078- #
1079- # As mentioned in https://github.com/archlinux/archinstall/pull/1859 - we store the
1080- # loader entries in $BOOT/loader/ rather than $ESP/loader/
1081- # The current reasoning being that $BOOT works in both use cases as well
1082- # as being tied to the current installation. This may change.
1083- loader_dir = self .target / 'boot/loader'
1084- loader_dir .mkdir (parents = True , exist_ok = True )
1082+ # Loader configuration is stored in ESP/loader:
1083+ # https://man.archlinux.org/man/loader.conf.5
1084+ loader_conf = self .target / efi_partition .relative_mountpoint / 'loader/loader.conf'
1085+ # Ensure that the ESP/loader/ directory exists before trying to create a file in it
1086+ loader_conf .parent .mkdir (parents = True , exist_ok = True )
10851087
10861088 default_kernel = self .kernels [0 ]
10871089 if uki_enabled :
@@ -1093,8 +1095,6 @@ def _add_systemd_bootloader(
10931095 default = f'default { default_entry } '
10941096
10951097 # Modify or create a loader.conf
1096- loader_conf = loader_dir / 'loader.conf'
1097-
10981098 try :
10991099 loader_data = loader_conf .read_text ().splitlines ()
11001100 except FileNotFoundError :
@@ -1115,8 +1115,10 @@ def _add_systemd_bootloader(
11151115 if uki_enabled :
11161116 return
11171117
1118- # Ensure that the $BOOT/loader/entries/ directory exists before we try to create files in it
1119- entries_dir = loader_dir / 'entries'
1118+ # Loader entries are stored in $BOOT/loader:
1119+ # https://uapi-group.org/specifications/specs/boot_loader_specification/#mount-points
1120+ entries_dir = self .target / boot_partition .relative_mountpoint / 'loader/entries'
1121+ # Ensure that the $BOOT/loader/entries/ directory exists before trying to create files in it
11201122 entries_dir .mkdir (parents = True , exist_ok = True )
11211123
11221124 comments = (
0 commit comments