Fixed issue where grub wouldn't unlock the system after install

- Added /boot/efi boot directory
- Added warning about running mkinitcpio and inputing the needed
parameters
This commit is contained in:
NovaViper 2022-01-26 11:42:59 -06:00
parent 5721dbc578
commit af29cd7266
3 changed files with 35 additions and 10 deletions

View File

@ -53,10 +53,14 @@ sgdisk -Z ${DISK} # zap all on disk
sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
# create partitions # create partitions
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition) if [ -d /sys/firmware/efi ]; then
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition) sgdisk -n 1::+250M --typecode=1:8300 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (Linux System Partition)
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining sgdisk -n 2::+100M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
else
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition)
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
sgdisk -A 1:set:2 ${DISK} sgdisk -A 1:set:2 ${DISK}
fi fi
# make filesystems # make filesystems
@ -81,23 +85,32 @@ mountallsubvol () {
} }
if [[ "${DISK}" =~ "nvme" ]]; then if [[ "${DISK}" =~ "nvme" ]]; then
partition1=${DISK}p1
partition2=${DISK}p2 partition2=${DISK}p2
partition3=${DISK}p3 partition3=${DISK}p3
else else
partition1=${DISK}1
partition2=${DISK}2 partition2=${DISK}2
partition3=${DISK}3 partition3=${DISK}3
fi fi
# The filesystem type for the boot partition shouldn't really matter, however
# I didn't test such case in my installer script so I left the lines commented out
mkfs.ext2 -L "BOOT" ${partition1}
if [[ "${FS}" == "btrfs" ]]; then if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
#mkfs.btrfs -L "BOOT" ${partition1}
mkfs.btrfs -L ROOT ${partition3} -f mkfs.btrfs -L ROOT ${partition3} -f
mount -t btrfs ${partition3} /mnt mount -t btrfs ${partition3} /mnt
elif [[ "${FS}" == "ext4" ]]; then elif [[ "${FS}" == "ext4" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
#mkfs.ext4 -L "BOOT" ${partition1}
mkfs.ext4 -L ROOT ${partition3} mkfs.ext4 -L ROOT ${partition3}
mount -t ext4 ${partition3} /mnt mount -t ext4 ${partition3} /mnt
elif [[ "${FS}" == "luks" ]]; then elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
#mkfs.ext2 -L "BOOT" ${partition1}
# enter luks password to cryptsetup and format root partition # enter luks password to cryptsetup and format root partition
echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${partition3} - echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${partition3} -
# open luks container and ROOT will be place holder # open luks container and ROOT will be place holder
@ -126,10 +139,18 @@ umount /mnt
mount -t btrfs -o subvol=@ -L ROOT /mnt mount -t btrfs -o subvol=@ -L ROOT /mnt
fi fi
# mount target #for UEFI, /boot needs to be mounted to the BIOSBOOT partitio nand /boot/efi needs to be mounted
mkdir /mnt/boot #to the EFIBOOT partition; for BIOS, only /boot needs to be mounted to the EFIBOOT partition
mkdir /mnt/boot/efi if [ -d /sys/firmware/efi ]; then
mount -t vfat -L EFIBOOT /mnt/boot/ mkdir -p /mnt/boot
mount ${partition1} /mnt/boot
mkdir -p /mnt/boot/efi
mount ${partition2} /mnt/boot/efi
else
mkdir -p /mnt/boot
mount ${partition2} /mnt/boot
fi
if ! grep -qs '/mnt' /proc/mounts; then if ! grep -qs '/mnt' /proc/mounts; then
echo "Drive is not mounted can not continue" echo "Drive is not mounted can not continue"
@ -153,7 +174,7 @@ echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
if [[ ! -d "/sys/firmware/efi" ]]; then if [[ ! -d "/sys/firmware/efi" ]]; then
grub-install --boot-directory=/mnt/boot ${DISK} grub-install --boot-directory=/mnt/boot --recheck ${DISK}
fi fi
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@ GRUB EFI Bootloader Install & Check
source /root/ArchTitus/setup.conf source /root/ArchTitus/setup.conf
genfstab -U / >> /etc/fstab genfstab -U / >> /etc/fstab
if [[ -d "/sys/firmware/efi" ]]; then if [[ -d "/sys/firmware/efi" ]]; then
grub-install --efi-directory=/boot ${DISK} grub-install --target=x86_64-efi --efi-directory=/boot/efi --recheck ${DISK}
fi fi
# set kernel parameter for decrypting the drive # set kernel parameter for decrypting the drive
if [[ "${FS}" == "luks" ]]; then if [[ "${FS}" == "luks" ]]; then

View File

@ -35,4 +35,8 @@ echo -ne "
Automated Arch Linux Installer Automated Arch Linux Installer
------------------------------------------------------------------------- -------------------------------------------------------------------------
Done - Please Eject Install Media and Reboot Done - Please Eject Install Media and Reboot
Do not forgot to edit '/etc/mkinitcpio.conf' and put the correct
parameters for LUKS and btrfs (if those were selected) and run
'arch-chroot /mnt mkinitcpio -P' or your system will not boot!
" "