Skip to content

Instantly share code, notes, and snippets.

@d-kja
Created August 2, 2024 15:43
Show Gist options
  • Save d-kja/2278497343c93b68fbb4172c8a615395 to your computer and use it in GitHub Desktop.
Save d-kja/2278497343c93b68fbb4172c8a615395 to your computer and use it in GitHub Desktop.
fedora-grub-config

First add a couple options to the following file:

sudo nvim /etc/default/grub

Make sure that the configuration is as follow, specially the DEFAULT and SAVEDEFAULT for convenience's sake

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

[Optionals]

Change windows as the default boot, to do so run the following:

awk -F\' '$1=="menuentry " {print $2}' /boot/grub2/grub.cfg

it will output something along the lines of Windows Boot Manager (on /dev/[replace]). Then, you can run the following:

sudo grub2-set-default "Windows Boot Manager (on /dev/[replace])"

[Updating grub]

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

@d-kja
Copy link
Author

d-kja commented Sep 21, 2024

sudo grub2-set-default "$(sudo awk -F\' '$1=="menuentry " {print $2}' /boot/grub2/grub.cfg)" && sudo grub2-mkconfig -o /boot/grub2/grub.cfg

@d-kja
Copy link
Author

d-kja commented Sep 22, 2024

UEFI BASED: sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

@d-kja
Copy link
Author

d-kja commented Sep 29, 2024

Not using relative path: sudo grub2-mkconfig -o "$(readlink -e /etc/grub2.cfg)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment