Modern GRUBing: Difference between revisions

mNo edit summary
mNo edit summary
 
Line 1: Line 1:
Notes;
Notes;


* LVM on NVMe is the issue
*LVM on NVMe is the issue




Line 31: Line 31:
*MBR Stuff if desired
*MBR Stuff if desired
*UEFI Stuff ("make" the grubx64.efi File) --- Best done from a UEFI system!
*UEFI Stuff ("make" the grubx64.efi File) --- Best done from a UEFI system!
**grub2-mkstandalone is a similar command
**Make sure UEFI Stuff is installed (if cloning from an MBR / BIOS based system);
**Make sure UEFI Stuff is installed (if cloning from an MBR / BIOS based system);
***dnf install grub2-efi-x64 grub2-tools grub2-tools-efi grub2-tools-extra grub2-efi-x64-modules efibootmgr shim-x64
***dnf install grub2-efi-x64 grub2-tools grub2-tools-efi grub2-tools-extra grub2-efi-x64-modules efibootmgr shim-x64
**<code>mkdir /mnt/efi</code>
**<code>mkdir /mnt/efi</code>
**<code>mount /dev/nvme0n1p1 /mnt/efi</code>
**<code>mount /dev/nvme0n1p1 /mnt/efi</code>
**<code>grub2-install --target=x86_64-efi --efi-directory=/mnt/efi --bootloader-id=rocky --recheck --force --verbose **--no-nvram** **--removable**</code> ( --force = Do it on a supposedly 'non-secure' system, --no-nvram = Do it even if a target drive is being prepared as a UEFI Booted system even if the current OS is an MBR / BIOS system, --removable is optional and installs the 'generic' BOOTX64.EFI File. )
**<code>grub2-install --target=x86_64-efi --efi-directory=/mnt/efi --bootloader-id=rocky --recheck --force --verbose --modules="part_gpt ext2 fat normal search search_fs_uuid search_fs_file configfile all_video gfxterm gzio" **--no-nvram** **--removable**</code>  
***--force = Do it on a supposedly 'non-secure' system
***--no-nvram = Do it even if a target drive is being prepared as a UEFI Booted system even if the current OS is an MBR / BIOS system
***--removable is optional and installs the 'generic' BOOTX64.EFI File. )
***--modules because apparently absolutely no modules are installed by default, even ext2!
****...and if you've got loads of space, then load up grubx64.efi with everything: --modules="$(ls /boot/grub2/x86_64-efi/ | sed 's/\.mod//g' | tr '\n' ' ')"
**Command to show information on how a system was booted (and can boot): <code>bootctl status</code>
**Command to show information on how a system was booted (and can boot): <code>bootctl status</code>
**Command for EFIBootMgr: <code>efibootmgr -v</code>
**Command for EFIBootMgr: <code>efibootmgr -v</code>
*GRUB Menu stuff
*GRUB Menu stuff
**Edit: /etc/default/grub
**Make the grub.cfg file: grub2-mkconfig -o /boot/grub2/grub.cfg
**Make the grub.cfg file: grub2-mkconfig -o /boot/grub2/grub.cfg
**Seemingly useless command: grub2-editenv
**Seemingly useless command (as a text editor would work, no matter the 'threats' in the file): grub2-editenv
***Wait, spoke too soon.  If this error is encountered: grub2-editenv: error: environment block too small. when using kernel-install it indicates the grubenv file isn't 1024 bytes.  Seems like the grub2-editenv tool pads the file with ###### symbols to make it exactly 1024 Bytes (and we know how important it is to have a file equal to exactly 1024 Bytes!)
**grub2-probe: General information, simple
**grub2-probe: General information, simple
*Kernel Stuff (initramfs, vmlinuz, bootloader entries, etc.): kernel-install
**to 'redo' VMLinuz Stuff: dracut
*Edit / Register the entry in the Hardwares UEFI Storage space
*Edit / Register the entry in the Hardwares UEFI Storage space
**efibootmgr --create --disk /dev/nvme0n1 --part 1 --loader '\EFI\rocky\grubx64.efi' --label "Custom GRUB" --bootorder 0001
**efibootmgr --create --disk /dev/nvme0n1 --part 1 --loader '\EFI\rocky\grubx64.efi' --label "Custom GRUB" --bootorder 0001