Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

grub2-install

Install the GRUB 2 boot loader to a disk (BIOS systems) — used to repair a system that does not find its boot loader.

Niveau
Dagelijks Linux
Groep
Kernel en hardware
Root nodig
Ja
Pakket
grub2-tools

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

On BIOS systems, grub2-install /dev/vda writes the GRUB boot code to the start of the disk and the modules to /boot/grub2/. On UEFI systems with Secure Boot, do not use it: reinstall the packages grub2-efi-x64 and shim-x64 instead, which put the signed files in /boot/efi/EFI/redhat/.

After installing, create the config with grub2-mkconfig -o /boot/grub2/grub.cfg.

Zo schrijf je het

grub2-install [OPTION]... DEVICE

Opties 20

Meest gebruikt

--target=TARGET
Platform: i386-pc (BIOS), x86_64-efi …
--boot-directory=DIR
Where /boot is (default /boot).
--efi-directory=DIR
The EFI system partition (UEFI).
--bootloader-id=ID
Name of the EFI folder and boot entry.
--removable
Install to the fallback path (removable media).
--recheck
Probe the devices again.
--force
Install even with warnings.
-v, --verbose
Verbose.
--modules=MODULES, --install-modules=MODULES
Modules to preload / install.
-d, --directory=DIR
Use images and modules from DIR.
--no-nvram
Do not change the UEFI boot entries.
--no-bootsector
Do not write the boot sector.
--uefi-secure-boot, --no-uefi-secure-boot
Secure Boot layout.
-s, --skip-fs-probe
Do not probe the file system.
--compress=no|xz|gz|lzo, --core-compress=xz|none|auto
Compression.
--fonts=, --locales=, --themes=, --locale-directory=DIR
Extra files.
-k, --pubkey=FILE
Check signatures with this key.
--disk-module=MODULE, --allow-floppy, --force-file-id, --no-rs-codes, --product-version=STRING, --sbat=FILE, --disable-shim-lock, --dtb=FILE, --label-*, --macppc-directory=DIR
Special settings.
-?, --help, --usage
Show help.
-V, --version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Reinstall GRUB on a BIOS disk

    grub2-install /dev/vda
    Installing for i386-pc platform.
    Installation finished. No error reported.

    The disk, not a partition.

  2. 2Then rebuild the config

    grub2-mkconfig -o /boot/grub2/grub.cfg

    Menu entries come from BLS files.

  3. 3From a rescue disk

    chroot /mnt/sysroot
    grub2-install /dev/vda

    Inside the installed system.

  4. 4Is this BIOS or UEFI?

    [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

    Decides which repair to use.

  5. 5UEFI repair (instead of grub2-install)

    dnf reinstall -y grub2-efi-x64 shim-x64

    Signed files for Secure Boot.

  6. 6UEFI boot entries

    efibootmgr -v

    Check that "Red Hat Enterprise Linux" points to shimx64.efi.

  7. 7Both disks of a software RAID1

    grub2-install /dev/vda; grub2-install /dev/vdb

    The system boots even when one disk fails.

  8. 8Verbose run

    grub2-install -v /dev/vda 2>&1 | tail

    Find the reason of an error.

  9. 9Another boot folder

    grub2-install --boot-directory=/mnt/sysroot/boot /dev/vda

    Without chroot.

  10. 10Check the boot sector

    dd if=/dev/vda bs=512 count=1 2>/dev/null | strings | grep -i grub
    GRUB

    The boot code is there.

Exitcodes

0Done.
1Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man 8 grub2-install