Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
Never edit grub.cfg by hand. Change /etc/default/grub, then run grub2-mkconfig -o /boot/grub2/grub.cfg (the same path on BIOS and UEFI on current RHEL). On RHEL with BLS, kernel arguments live in the entry files; add --update-bls-cmdline when you changed GRUB_CMDLINE_LINUX so the entries get the new arguments.
Zo schrijf je het
grub2-mkconfig [-o FILE] [--update-bls-cmdline]Belangrijkste delen
GRUB_TIMEOUT- Seconds the menu waits.
GRUB_DEFAULT- Default entry (
saved= use grubenv). GRUB_CMDLINE_LINUX- Kernel arguments for all kernels.
GRUB_TERMINAL_OUTPUT- console, serial, gfxterm.
GRUB_DISABLE_RECOVERY- No rescue entries.
GRUB_ENABLE_BLSCFG- Use BLS entries (true on RHEL).
Opties 4
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Regenerate after a change
grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... doneAfter every edit of /etc/default/grub.
2Change the timeout
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=10/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfgMenu waits 10 seconds.
3Change kernel arguments for all kernels
vim /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdlineWithout the option the existing entries keep their old arguments.
4Preview without writing
grub2-mkconfig | lessCheck before you overwrite.
5Back up the old config
cp -a /boot/grub2/grub.cfg /root/grub.cfg.bakEasy way back.
6Show the menu on a serial console
grep -E 'GRUB_TERMINAL|GRUB_SERIAL' /etc/default/grubFor VMs without a screen.
7Password for the GRUB menu (security)
grub2-setpasswordNobody can edit boot entries at the console without it (stops rd.break tricks).
8Where is the config on UEFI?
cat /boot/efi/EFI/redhat/grub.cfgA small stub that loads /boot/grub2/grub.cfg.
9Boot an entry once
grub2-reboot 1; rebootOnly the next boot uses entry 1.
10Check the BLS entries afterwards
grep options /boot/loader/entries/*.confThe kernel arguments per entry.
Niets past bij dit filter.
Bestanden
/etc/default/grub- Your settings.
/etc/grub.d/- Scripts that build the config.
/boot/grub2/grub.cfg- Generated config.
/boot/loader/entries/- BLS entries.
Exitcodes
0 :: Done. 1 :: Error.