Modern GRUBing: Difference between revisions

mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Notes;
*LVM on NVMe is the issue
Rocky Linux 9 does not use the /etc/default/grub and /boot/grub2/grub.cfg Files any longer.  Instead the BLS (Boot Loader Specification) 'method' is used.  If one reads the documentation from RedHat, it seems like thing got really messy (and confusing).
Rocky Linux 9 does not use the /etc/default/grub and /boot/grub2/grub.cfg Files any longer.  Instead the BLS (Boot Loader Specification) 'method' is used.  If one reads the documentation from RedHat, it seems like thing got really messy (and confusing).


Line 16: Line 21:
**Linux LVM (and LVM2): $8E
**Linux LVM (and LVM2): $8E
*LVM Stuff using Commands or BLIVET (sadly only Rocky Linux 8)
*LVM Stuff using Commands or BLIVET (sadly only Rocky Linux 8)
**<code>pvcreate /dev/sdX</code>
**<code>pvcreate /dev/sdXy</code>
**<code>vgcreate VG.NVMe.ROOT /dev/sdX</code>
**<code>vgcreate VG.NVMe.ROOT /dev/sdXy</code>
***<code>vgrename WhatEverOldName WhatEverNewName</code>
***<code>vgrename WhatEverOldName WhatEverNewName</code>
**<code>lvcreate -L 64G -n LV.ROOT VG.NVMe.ROOT</code>
**<code>lvcreate -L 64G -n LV.ROOT VG.NVMe.ROOT</code>
*Format Partitions
*Format Partitions
**mkfs.vfat -F32 /dev/sdXy
**mkfs.vfat -F32 /dev/sdXy
**<code>mkfs.ext4 -v -L ROOT.EXT4 /dev/sdX ( -v = Verbose, -L = Label )</code>
**<code>mkfs.ext4 -v -L ROOT.EXT4 /dev/sdXy ( -v = Verbose, -L = Label )</code>
**<code>mkswap -L SWAP /dev/sdaX</code>
**<code>mkswap -L SWAP /dev/sdaXy</code>
*MBR Stuff if desired
*MBR Stuff if desired
*UEFI Stuff
*UEFI Stuff ("make" the grubx64.efi File) --- Best done from a UEFI system!
**Make sure UEFI Stuff is installed (if cloning from an MBR / BIOS based system): dnf install -y grub2-efi-x64 grub2-efi-x64-modules shim-x64 efibootmgr
**grub2-mkstandalone is a similar command
**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
**<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 --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 installs the 'generic' BOOTX64.EFI module so the system can boot before )
**<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
**Edit: /etc/default/grub
**Make the grub.cfg file: grub2-mkconfig -o /boot/grub2/grub.cfg
**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
*Kernel Stuff (initramfs, vmlinuz, bootloader entries, etc.): kernel-install
**to 'redo' VMLinuz Stuff: dracut
*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
*Edit the BLS (Boot Loader System) Entries, etc.
**GRUBBY
*Restore BOOT and ROOT File Systems
*Restore BOOT and ROOT File Systems
**f
**f