Generate the main configuration file

Posted by:

  1. Make sure all partitions are mounted, i.e. {php}/{/php} {php}/boot{/php} {php}/boot/efi{/php}

    mount -a
    lsblk
    ----------------------------------------------------
    NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
    sda             8:0    0   477G  0 disk  
    ├─sda1          8:1    0   260M  0 part  /boot/efi
    ├─sda2          8:2    0    16M  0 part  
    ├─sda3          8:3    0 234.2G  0 part  
    ├─sda4          8:4    0    25G  0 part  
    ├─sda5          8:5    0  1000M  0 part  
    ├─sda6          8:6    0  20.2G  0 part  
    ├─sda7          8:7    0  1000M  0 part  
    ├─sda8          8:8    0   200M  0 part  /boot
    ├─sda9          8:9    0     8G  0 part  [SWAP]
    └─sda10         8:10   0 187.1G  0 part  
    └─cryptroot 254:0    0 187.1G  0 crypt /
    

    nvme0n1        259:0    0 953.9G  0 disk  
    ├─nvme0n1p1    259:1    0   260M  0 part  /boot/efi
    ├─nvme0n1p2    259:2    0    16M  0 part  
    ├─nvme0n1p3    259:3    0 234.2G  0 part  
    ├─nvme0n1p4    259:4    0    25G  0 part  
    ├─nvme0n1p5    259:5    0  1000M  0 part  
    ├─nvme0n1p6    259:6    0  20.2G  0 part  
    ├─nvme0n1p7    259:7    0  1000M  0 part  
    ├─nvme0n1p8    259:8    0   200M  0 part  /boot
    ├─nvme0n1p9    259:9    0     8G  0 part  [SWAP]
    ├─nvme0n1p10   259:10   0 187.1G  0 part  
    │ └─cryptroot  254:0    0 187.1G  0 crypt /
    └─nvme0n1p11   259:11   0   477G  0 part  
      └─home-crypt 254:1    0 476.9G  0 crypt /home
    
  2. Intial Ramdisk Environment

    mkinitcpio -p linux
    

    Note: Step 2-4 can be omitted, it does not hurt though. You can jump to step 5 configure grub.

    Add the encrypt hook to mkinitcpio.conf: link here.

    etc/mkinitcpio.conf
    HOOKS="... encrypt ... filesystems ..."
    
  3. update /etc/default/grub

    GRUB_CMDLINE_LINUX_DEFAULT="i915.preliminary_hw_support=1"
    GRUB_ENABLE_CRYPTODISK=y
    GRUB_CMDLINE_LINUX="cryptdevice=UUID=1de833a9-36b8-4bab-91d6-65360080e71c:cryptroot root=/dev$
    
  4. install os-prober, only detect the correct Windows boot after boot into Linux, not from chroot with live CD.
  5. configure grub

    The following steps install the GRUB UEFI application to $esp/EFI/grub, install its modules to /boot/grub/x86_64-efi, and place the bootable grubx64.efi stub in $esp/EFI/grub.

    First, tell GRUB to use UEFI, set the boot directory and set the bootloader ID. Mount the ESP partition to e.g. /boot or /boot/efi and in the following change $esp to that mount point (usually /boot):

    # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
    

    The –bootloader-id is what appears in the boot options to identify the GRUB EFI boot option; make sure this is something you will recognize later. The install will create a directory of the same name under $esp/EFI/ where the EFI binary bootloader will be placed.

    grub-mkconfig -o /boot/grub/grub.cfg #Generate initial grub config.
    

    Now, let’s add Windows to the GRUB menu. Edit /boot/grub/grub.cfg and add the following menuentry after the Arch Linux menuentries [Note: grub boot loader does not locate Windows OS, but this is necessary for grub to load Arch Linux in my case. After I boot into arch linux, I ran {php}sudo os-prober{/php} and update grub config.] See here for details.

    if [ "${grub_platform}" == "efi" ]; then
      menuentry "Microsoft Windows Vista/7/8/10 UEFI-GPT" {
    	  insmod part_gpt
    	  insmod fat
    	  insmod search_fs_uuid
    	  insmod chain
    	  search --fs-uuid --set=root $hints_string $fs_uuid
    	  chainloader /EFI/Microsoft/Boot/bootmgfw.efi
      }
    fi
    

    and update the string with following output:

    $hints_string with the output of $ grub-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi. $fs_uuid with the output of $ grub-probe --target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.

  6. Unmount and Reboot

exit
umount -R /mnt
reboot
  1. Reboot into Arch Linux
  2. Install os-prober. Regenerate grub configuration. Reboot.

    pacman -Syu os-prober
    sudo os-prober
    #/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
    grub-mkconfig -o /boot/grub/grub.cfg #OR following is better
    grub-customizer
    

    Done! Now you can choose between Windows and Arch Linux at the start. Yay!

0

Add a Comment