mirror of
https://pagure.io/fedora-docs/quick-docs.git
synced 2024-11-24 21:35:17 +00:00
Small update (on reviewed grub articles) for consistency/style guidelines
This commit is contained in:
parent
0271c0015e
commit
322b9557da
5 changed files with 116 additions and 93 deletions
|
@ -19,12 +19,12 @@ Adding other records into the *GRUB2* menu only means to run `grub2-mkconfig` co
|
|||
----
|
||||
|
||||
. Install *GRUB2*.
|
||||
* On UEFI systems:
|
||||
* On UEFI systems.
|
||||
+
|
||||
----
|
||||
# dnf reinstall shim-* grub2-efi-* grub2-common
|
||||
----
|
||||
* On BIOS systems, specify the disk where the bootloader should be installed:
|
||||
* On BIOS systems, specify the disk where the bootloader should be installed.
|
||||
+
|
||||
----
|
||||
# grub2-install /dev/sda
|
||||
|
|
|
@ -9,13 +9,13 @@ if you need to boot from a configuration file on a different partition.
|
|||
|
||||
. Load the necessary modules to read your system's partitions (you will also need to load `part_msdos` or `part_gpt`, depending on your partition table).
|
||||
+
|
||||
* For BTRFS filesystems:
|
||||
* For BTRFS filesystems.
|
||||
+
|
||||
----
|
||||
grub> insmod btrfs
|
||||
----
|
||||
+
|
||||
* For LVM filesystems:
|
||||
* For LVM filesystems.
|
||||
+
|
||||
----
|
||||
grub> insmod xfs
|
||||
|
|
|
@ -7,7 +7,7 @@ This procedure shows the steps to install *GRUB2* on your _Master Boot Record_ (
|
|||
|
||||
.Before you start
|
||||
|
||||
* Make sure you have the the *GRUB2* packages and the _os-prober_ package installed in your system:
|
||||
* Make sure you have the the *GRUB2* packages and the _os-prober_ package installed in your system.
|
||||
+
|
||||
----
|
||||
$ dnf list installed | grep grub
|
||||
|
|
|
@ -33,15 +33,15 @@ bootable by *GRUB2*.
|
|||
[[btrfs-steps]]
|
||||
== BTRFS steps
|
||||
|
||||
If your `/root` partition is encrypted by LUKS, it must be decrypted:
|
||||
. If your `/root` partition is encrypted by LUKS, it must be decrypted.
|
||||
|
||||
. Make sure the crypt module is in use:
|
||||
.. Make sure the crypt module is in use.
|
||||
+
|
||||
----
|
||||
# modprobe dm-crypt
|
||||
----
|
||||
|
||||
. Decrypt the `/root` partition (e.g. `/dev/sda3`):
|
||||
.. Decrypt the `/root` partition (e.g. `/dev/sda3`).
|
||||
+
|
||||
----
|
||||
# cryptsetup luksOpen /dev/sda3 myvolume
|
||||
|
@ -49,105 +49,107 @@ If your `/root` partition is encrypted by LUKS, it must be decrypted:
|
|||
+
|
||||
The decrypted device (i.e. `myvolume`) will be accessible under `/dev/mapper/`.
|
||||
|
||||
Mount the `/root` partition:
|
||||
. Mount the `/root` partition.
|
||||
|
||||
* For LUKS:
|
||||
* For LUKS.
|
||||
+
|
||||
----
|
||||
# mount /dev/mapper/myvolume /mnt -o subvol=root
|
||||
----
|
||||
* For non-LUKS:
|
||||
* For non-LUKS.
|
||||
+
|
||||
----
|
||||
# mount /dev/sda3 /mnt -o subvol=root
|
||||
----
|
||||
+
|
||||
|
||||
Mount the `/boot` partition (e.g. `/dev/sda2)`:
|
||||
|
||||
. Mount the `/boot` partition (e.g. `/dev/sda2)`.
|
||||
+
|
||||
----
|
||||
# mount /dev/sda2 /mnt/boot
|
||||
----
|
||||
+
|
||||
|
||||
Mount system processes and devices into the `/root` filesystem:
|
||||
|
||||
. Mount system processes and devices into the `/root` filesystem.
|
||||
+
|
||||
----
|
||||
# mount -o bind /dev /mnt/dev
|
||||
# mount -o bind /proc /mnt/proc
|
||||
# mount -o bind /sys /mnt/sys
|
||||
# mount -o bind /run /mnt/run
|
||||
----
|
||||
|
||||
On UEFI systems, bind the `efivars` directory and mount the EFI system partition (e.g. `/dev/sda1`):
|
||||
|
||||
+
|
||||
. On UEFI systems, bind the `efivars` directory and mount the EFI system partition (e.g. `/dev/sda1`).
|
||||
+
|
||||
----
|
||||
# mount -o bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
|
||||
# mount /dev/sda1 /mnt/boot/efi
|
||||
----
|
||||
|
||||
Change your filesystem to the one mounted under `/mnt/`:
|
||||
|
||||
+
|
||||
. Change your filesystem to the one mounted under `/mnt/`.
|
||||
+
|
||||
----
|
||||
# chroot /mnt/
|
||||
----
|
||||
+
|
||||
. Re-install *GRUB2*.
|
||||
|
||||
Re-install GRUB:
|
||||
|
||||
* On UEFI systems, several packages are required:
|
||||
* On UEFI systems, several packages are required.
|
||||
+
|
||||
----
|
||||
/]# dnf reinstall shim-* grub2-efi-* grub2-common
|
||||
|
||||
----
|
||||
* On BIOS systems, specify the disk (e.g. `/dev/sda`) where GRUB should be installed:
|
||||
* On BIOS systems, specify the disk (e.g. `/dev/sda`) where *GRUB2* should be installed.
|
||||
+
|
||||
----
|
||||
/]# grub2-install /dev/sda
|
||||
----
|
||||
|
||||
Re-generate the GRUB configuration file:
|
||||
|
||||
+
|
||||
. Re-generate the *GRUB2* configuration file.
|
||||
+
|
||||
----
|
||||
/]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
----
|
||||
|
||||
Sync and exit the chroot:
|
||||
|
||||
+
|
||||
. Sync and exit the chroot.
|
||||
+
|
||||
----
|
||||
/]# sync && exit
|
||||
----
|
||||
|
||||
Reboot the system.
|
||||
+
|
||||
. Reboot the system.
|
||||
|
||||
[[lvm-steps]]
|
||||
== LVM steps
|
||||
|
||||
If your `/root` partition is encrypted by LUKS, it must be decrypted:
|
||||
. If your `/root` partition is encrypted by LUKS, it must be decrypted.
|
||||
|
||||
. Make sure the crypt module is in use:
|
||||
.. Make sure the crypt module is in use.
|
||||
+
|
||||
----
|
||||
# modprobe dm-crypt
|
||||
----
|
||||
|
||||
. Decrypt the `/root` partition (e.g. `/dev/sda3`):
|
||||
.. Decrypt the `/root` partition (e.g. `/dev/sda3`).
|
||||
+
|
||||
----
|
||||
# cryptsetup luksOpen /dev/sda3 myvolume
|
||||
----
|
||||
|
||||
. Scan the LVM volumes for the volume group corresponding to the `/root` partition:
|
||||
.. Scan the LVM volumes for the volume group corresponding to the `/root` partition.
|
||||
+
|
||||
----
|
||||
# vgscan
|
||||
----
|
||||
|
||||
. Activate the volume group (e.g. `fedora_localhost-live`):
|
||||
.. Activate the volume group (e.g. `fedora_localhost-live`).
|
||||
+
|
||||
----
|
||||
# vgchange -ay fedora_localhost-live
|
||||
----
|
||||
|
||||
. Find the logical volume corresponding to `/root`:
|
||||
.. Find the logical volume corresponding to `/root`.
|
||||
+
|
||||
----
|
||||
# lvs
|
||||
|
@ -155,64 +157,65 @@ If your `/root` partition is encrypted by LUKS, it must be decrypted:
|
|||
+
|
||||
The logical volume will be accessible under `/dev/mapper/`.
|
||||
|
||||
Create a `root` directory under `/mnt`:
|
||||
. Create a `root` directory under `/mnt`.
|
||||
+
|
||||
----
|
||||
# mkdir -p /mnt/root
|
||||
----
|
||||
|
||||
Mount the logical volume (e.g. `/dev/mapper/fedora_localhost--live-root`) corresponding to the `/root` partition:
|
||||
|
||||
+
|
||||
. Mount the logical volume (e.g. `/dev/mapper/fedora_localhost--live-root`) corresponding to the `/root` partition.
|
||||
+
|
||||
----
|
||||
# mount /dev/mapper/fedora_localhost--live-root /mnt/root
|
||||
----
|
||||
|
||||
Mount the `/boot` partition (e.g. `/dev/sda2`):
|
||||
|
||||
+
|
||||
. Mount the `/boot` partition (e.g. `/dev/sda2`).
|
||||
+
|
||||
----
|
||||
# mount /dev/sda2 /mnt/root/boot
|
||||
----
|
||||
|
||||
Mount system processes and devices into the `/root` filesystem:
|
||||
|
||||
+
|
||||
. Mount system processes and devices into the `/root` filesystem.
|
||||
+
|
||||
----
|
||||
# mount -o bind /dev /mnt/root/dev
|
||||
# mount -o bind /proc /mnt/root/proc
|
||||
# mount -o bind /sys /mnt/root/sys
|
||||
# mount -o bind /run /mnt/root/run
|
||||
----
|
||||
|
||||
On UEFI systems, bind the `efivars` directory and mount the EFI system partition (e.g. `/dev/sda1`):
|
||||
|
||||
+
|
||||
. On UEFI systems, bind the `efivars` directory and mount the EFI system partition (e.g. `/dev/sda1`).
|
||||
+
|
||||
----
|
||||
# mount -o bind /sys/firmware/efi/efivars /mnt/root/sys/firmware/efi/efivars
|
||||
# mount /dev/sda1 /mnt/root/boot/efi
|
||||
----
|
||||
|
||||
Change your filesystem to the one mounted under `/mnt/root`:
|
||||
|
||||
+
|
||||
. Change your filesystem to the one mounted under `/mnt/root`.
|
||||
+
|
||||
----
|
||||
# chroot /mnt/root/
|
||||
----
|
||||
+
|
||||
. Re-install *GRUB2* and re-generate the *GRUB2* configuration file.
|
||||
|
||||
Re-install GRUB and re-generate the GRUB configuration file:
|
||||
|
||||
* On UEFI systems, several packages are required:
|
||||
* On UEFI systems, several packages are required.
|
||||
+
|
||||
----
|
||||
/]# dnf reinstall shim-* grub2-efi-* grub2-common
|
||||
/]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
||||
----
|
||||
* On BIOS systems, specify the disk (e.g. `/dev/sda`) where GRUB should be installed:
|
||||
* On BIOS systems, specify the disk (e.g. `/dev/sda`) where *GRUB2* should be installed.
|
||||
+
|
||||
----
|
||||
/]# grub2-install /dev/sda
|
||||
/]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
----
|
||||
|
||||
Sync and exit the chroot:
|
||||
|
||||
+
|
||||
. Sync and exit the chroot.
|
||||
+
|
||||
----
|
||||
/]# sync && exit
|
||||
----
|
||||
|
||||
Reboot the system.
|
||||
+
|
||||
. Reboot the system.
|
|
@ -6,19 +6,34 @@ to a boot prompt. To boot into the system, follow the steps below.
|
|||
|
||||
.Procedure
|
||||
|
||||
. List the drives which *GRUB2* sees:
|
||||
. Load the necessary modules to read your system's partitions (you will also need to load `part_msdos` or `part_gpt`, depending on your partition table).
|
||||
+
|
||||
* For BTRFS filesystems (Fedora 33 or newer).
|
||||
+
|
||||
----
|
||||
grub> insmod btrfs
|
||||
----
|
||||
+
|
||||
* For LVM filesystems (older than Fedora 33).
|
||||
+
|
||||
----
|
||||
grub> insmod xfs
|
||||
grub> insmod lvm
|
||||
----
|
||||
|
||||
. List the drives which *GRUB2* sees.
|
||||
+
|
||||
----
|
||||
grub> ls
|
||||
----
|
||||
|
||||
. Examine the output to understand the partition table of the `/dev/sda` device. The following example shows a DOS partition table with three partitions:
|
||||
. Examine the output to understand the partition table of the `/dev/sda` device. The following example shows a DOS partition table with three partitions.
|
||||
+
|
||||
----
|
||||
(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
|
||||
----
|
||||
+
|
||||
A GPT partition table of the `/dev/sda` device with four partitions could look like this:
|
||||
A GPT partition table of the `/dev/sda` device with four partitions could look like this.
|
||||
+
|
||||
----
|
||||
(hd0) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
|
||||
|
@ -32,7 +47,7 @@ grub> ls (hd0,1)/
|
|||
+
|
||||
The outcome of the previous command will list the files on `/dev/sda1`. The partition that contains the `/boot` directory is the correct one. There you will search for the full names of the `vmlinuz` and `initramfs` files.
|
||||
|
||||
. Follow the <<btrfs-boot-setup, Pre-boot setup for BTRFS>> (Fedora 33 or newer) or the <<lvm-boot-setup, Pre-boot setup for LVM>> (older than Fedora 33) to recover your system.
|
||||
. Follow the <<btrfs-boot-setup, Pre-boot setup for BTRFS>> or the <<lvm-boot-setup, Pre-boot setup for LVM>> to recover your system.
|
||||
|
||||
. After the pre-boot setup, boot the system.
|
||||
+
|
||||
|
@ -40,39 +55,44 @@ The outcome of the previous command will list the files on `/dev/sda1`. The part
|
|||
grub> boot
|
||||
----
|
||||
|
||||
. To restore the bootloader's functionality, regenerate the *GRUB2* configuration file and reinstall the bootloader into the MBR, as described in xref:adding-other-operating-systems-grub2[Adding other operating systems to the *GRUB2* menu].
|
||||
. To restore the bootloader's functionality, regenerate the *GRUB2* configuration file and reinstall the bootloader, as described in xref:adding-other-operating-systems-grub2[Adding other operating systems to the *GRUB2* menu].
|
||||
|
||||
[[btrfs-boot-setup]]
|
||||
== Pre-boot setup for BTRFS filesystems.
|
||||
|
||||
* On BIOS systems:
|
||||
+
|
||||
Set *GRUB2* root to your `/boot` partition. If your `/boot` partition is `(hd0,msdos1)`, the command will be:
|
||||
* On BIOS systems.
|
||||
|
||||
. Set *GRUB2* root to your `/boot` partition. If your `/boot` partition is `(hd0,msdos1)`, the command will be.
|
||||
+
|
||||
----
|
||||
grub> set root=(hd0,msdos1)
|
||||
----
|
||||
Next, select the desired kernel. Set the `/root` partition (e.g. `/dev/sda2`):
|
||||
+
|
||||
|
||||
. Next, select the desired kernel. Set the `/root` partition (e.g. `/dev/sda2`).
|
||||
+
|
||||
----
|
||||
grub> linux /vmlinuz-5.14.10-300.fc35.x86_64 root=/dev/sda2 ro rootflags=subvol=root
|
||||
----
|
||||
+
|
||||
|
||||
* On UEFI systems:
|
||||
+
|
||||
Set *GRUB2* root to your EFI system partition. If your EFI system partition is `(hd0,gpt1)`, the command will be:
|
||||
* On UEFI systems.
|
||||
|
||||
. Set *GRUB2* root to your EFI system partition. If your EFI system partition is `(hd0,gpt1)`, use this command.
|
||||
+
|
||||
----
|
||||
grub> set root=(hd0,gpt1)
|
||||
----
|
||||
Next, select the desired kernel. Find the path to `vmlinuz` and set the `/root` partition (e.g. `/dev/sda3`):
|
||||
+
|
||||
|
||||
. Next, select the desired kernel. Find the path to `vmlinuz` and set the `/root` partition (e.g. `/dev/sda3`).
|
||||
+
|
||||
----
|
||||
grub> linux (hd0,gpt2)/vmlinuz-5.14.10-300.fc35.x86_64 root=/dev/sda3 ro rootflags=subvol=root
|
||||
----
|
||||
+
|
||||
Select the RAM filesystem that will be loaded:
|
||||
|
||||
. Select the RAM filesystem that will be loaded.
|
||||
+
|
||||
----
|
||||
grub> initrd (hd0,gpt2)/initramfs-5.14.10-300.fc35.x86_64.img
|
||||
|
@ -81,46 +101,46 @@ grub> initrd (hd0,gpt2)/initramfs-5.14.10-300.fc35.x86_64.img
|
|||
[[lvm-boot-setup]]
|
||||
== Pre-boot setup for LVM filesystems.
|
||||
|
||||
Load the `xfs` and `lvm` modules if they are not already loaded (check this with `lsmod`):
|
||||
----
|
||||
grub> insmod xfs
|
||||
grub> insmod lvm
|
||||
----
|
||||
* On BIOS systems.
|
||||
|
||||
* On BIOS systems:
|
||||
+
|
||||
Set *GRUB2* root to your `/boot` partition. If your `/boot` partition is `(hd0,msdos1)`, the command will be:
|
||||
. Set *GRUB2* root to your `/boot` partition. If your `/boot` partition is `(hd0,msdos1)`, use this command.
|
||||
+
|
||||
----
|
||||
grub> set root=(hd0,msdos1)
|
||||
----
|
||||
Next, select the desired kernel. Set `root` to the logical volume that corresponds to the `/root` directory:
|
||||
+
|
||||
|
||||
. Next, select the desired kernel. Set `root` to the logical volume that corresponds to the `/root` directory.
|
||||
+
|
||||
----
|
||||
grub> linux /vmlinuz-3.0.0-1.fc16.i686 root=/dev/mapper/fedora_localhost--live-root
|
||||
----
|
||||
+
|
||||
Select the RAM filesystem that will be loaded:
|
||||
|
||||
. Select the RAM filesystem that will be loaded.
|
||||
+
|
||||
----
|
||||
grub> initrd /initramfs-3.0.0-1.fc16.i686.img
|
||||
----
|
||||
+
|
||||
|
||||
* On UEFI systems:
|
||||
+
|
||||
Set *GRUB2* root to your EFI system partition. If your EFI system partition is `(hd0,gpt1)`, the command will be:
|
||||
* On UEFI systems.
|
||||
|
||||
. Set *GRUB2* root to your EFI system partition. If your EFI system partition is `(hd0,gpt1)`, use this command.
|
||||
+
|
||||
----
|
||||
set root=(hd0,gpt1)
|
||||
----
|
||||
Next, select the desired kernel. Find the path to `vmlinuz` and set `root` to the logical volume that corresponds to the `/root` directory:
|
||||
+
|
||||
|
||||
. Next, select the desired kernel. Find the path to `vmlinuz` and set `root` to the logical volume that corresponds to the `/root` directory.
|
||||
+
|
||||
----
|
||||
linux (hd0,gpt2)/vmlinuz-3.0.0-1.fc16.i686 root=/dev/mapper/fedora_localhost--live-root
|
||||
----
|
||||
+
|
||||
Select the RAM filesystem that will be loaded:
|
||||
|
||||
. Select the RAM filesystem that will be loaded.
|
||||
+
|
||||
----
|
||||
initrd (hd0,gpt2)/initramfs-3.0.0-1.fc16.i686.img
|
||||
|
|
Loading…
Reference in a new issue