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

grubby

Show and change the boot entries of GRUB 2: kernel arguments, the default kernel, and entry details.

Niveau
RHCSA-examen
Groep
Kernel en hardware
Root nodig
Ja
Pakket
grubby

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

Wat het doet

On RHEL each kernel has a BLS entry file in /boot/loader/entries/. grubby reads and edits these entries: add or remove kernel arguments for one or all kernels, choose the default kernel, and show what each entry boots. Changes work at the next boot; no grub2-mkconfig is needed.

Zo schrijf je het

grubby [OPTION]...

Opties 25

Meest gebruikt

Show

--info=KERNEL|ALL|DEFAULT
Show entries: index, kernel, args, root, initrd, title.
--default-kernel
Show the kernel that boots by default.
--default-index
Show the index of the default entry.
--default-title
Show the title of the default entry.

Change arguments

--update-kernel=KERNEL|ALL|DEFAULT|TITLE=…
Which entry to change (with --args / --remove-args).
--args=ARGS
Add these kernel arguments.
--remove-args=ARGS
Remove these kernel arguments.

Default entry

--set-default=KERNEL
Make this kernel the default (path like /boot/vmlinuz-VERSION).
--set-default-index=N
Make entry N the default.
--make-default
With --add-kernel: make the new entry the default.

Add and remove entries

--add-kernel=KERNEL
Add an entry for this kernel.
--initrd=FILE
The initrd for --add-kernel.
--title=TITLE
The title for --add-kernel.
--copy-default
Copy the arguments of the default entry to the new one.
--remove-kernel=KERNEL|ALL|TITLE=…
Remove entries.
--add-multiboot, --mbargs, --remove-mbargs
Multiboot settings (rare).

Other

-c, --config-file=FILE
Use another config file.
-o, --output-file=FILE
Write to another file.
--bls-directory=DIR
Use another BLS folder.
--env=FILE
Use another grubenv file.
--grub2, --zipl
Choose the boot loader type.
--bootloader-probe
Show the boot loader in use.
--no-etc-grub-update
Do not also change /etc/default/grub.
--version
Show the version.
-?, --help
Show help.

Voorbeelden 10

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

  1. 1Show the default kernel

    grubby --default-kernel
    /boot/vmlinuz-6.12.0-55.9.1.el10_0.x86_64

    The newest kernel after an update.

  2. 2Show all entries

    grubby --info=ALL

    index, kernel, args, root, initrd, title per entry.

  3. 3Arguments of the default entry

    grubby --info=DEFAULT | grep ^args

    Same as /proc/cmdline after a boot.

  4. 4Remove rhgb and quiet

    grubby --update-kernel=ALL --remove-args="rhgb quiet"

    Shows the boot messages.

  5. 5Add an argument to all kernels

    grubby --update-kernel=ALL --args="console=ttyS0,115200"

    Serial console for VMs.

  6. 6Boot an older kernel by default

    grubby --set-default /boot/vmlinuz-6.12.0-55.el10.x86_64

    When the new kernel has a problem.

  7. 7Only for one kernel

    grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="systemd.unit=multi-user.target"

    Other kernels keep their arguments.

  8. 8Turn off a mitigation for a test (security trade-off)

    grubby --update-kernel=ALL --args="mitigations=off"

    Faster, but open to CPU attacks — only in a lab; remove it again.

  9. 9Enable SELinux auditing details or FIPS

    grubby --update-kernel=ALL --args="fips=1"

    FIPS mode needs more steps (fips-mode-setup / crypto policies); this is the kernel part.

  10. 10Check the result after reboot

    cat /proc/cmdline

    The live arguments.

Bestanden

/boot/loader/entries/
BLS entry files.
/boot/grub2/grubenv
Saved default entry.

Exitcodes

0 :: Done. 1 :: Error.