I have a dual boot system with CentOS 7 and Win10. My install was totally vanilla (CentOS then Win10) and went fine. Everything is great except that grub does not appear to save my "last" choice from the boot load menu.

I dug through all the grub configuration files (e.g. /boot/efi/EFI/centos/grub.cfg) and all the code seems there for recording the last choice.

My /etc/default/grub shows:


Is there anything obvious I am missing or need to do to enable this?

My /etc/efi/EFI/centos/grubenv never apperas to record the latest selection. It always has:

saved_entry=CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
##########[...snip...padding to 1k]

I can't see this file from a Windows boot, but I did test via the "rescue Centos entry".

I manually set the value in grubenv to Windows Boot Manager (on /dev/sda2) (the Windows entry) and this works out okay. However, booting back into CentOS fails to change it.

It just seems I am missing something to enable this "save the last choice" behavior. Any ideas?

  • 1
    have you ran sudo update-grub after editing these files? Apr 21, 2016 at 18:47
  • I never modified anything. This was all created by the install process? (Or part of the installed image?)
    – Tim
    Apr 22, 2016 at 8:50

5 Answers 5


Alternatively, you can simply specify the number for GRUB_DEFAULT for the OS you want to set as default. Go the grub configuration file located at /boot/grub2/grub.cfg and search for the keyword menuentry. This will have the OS listing that will appear on the boot screen.

Assuming CentOS entry is first and then Windows entry, if you want the default OS to boot as CentOS, simply edit the value for GRUB_DEFAULT in /etc/default/grub as follows


If you want Windows 10 to be booted as default, then set


Save and reboot. You should be getting your selected OS as default.


The /etc/default/grub file is used to generate the final grub.cfg file that actually governs the behavior of grub. After editing the grub file you have to run

sudo update-grub

to generate a new /boot/grub/grub.cfg (usual location).


Realizing this question is almost a year old, I can confirm the following works:

$ su
# vim /boot/grub/grub.conf

Within the file, I have the following:

title CentOS (2.6.32-642.13.1.el6.x86_64)
    root ...
    initrd ...
title CentOS (<old kernel>...)
title Windows (10)

I think you might be missing the savedefault keyword(?) in each boot entry - although it also looks like you might be on CentOS 7, and I'm on CentOS 6. IIRC, CentOS 6 uses GRUB (GRUB v1.97), while CentOS 7 uses GRUB2 (GRUB 2.01).

I'm sure future users/searchers will appreciate any who can confirm/deny that this addresses their problem.


I can confirm that savedefault option is necessary in Centos 7.

What I did was create my custom entries in /etc/grub.d/40_custom making sure that savedefault was present.

And then updating the menu:

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

That's it!


According to This bug the issue lies with the link to grubenv pointing to /boot/grub2/grubenv, but /boot isn't mounted in the grub menu environment. The bug above is from fedora but I assume the same goes for centos. I'm having this issue running CentOS 7 and grub2.

System boots up just fine but only after pressing a key, dismissing the message that grubenv doesn't exist. The bug above includes a fix as well. Symlinking

/boot/grub2/grubenv -> ../efi/EFI/centos/grubenv

Should fix this issue.

  • Edit * Confirmed this solves the issue on CentOS 7.1 running linux kernel .

How to?

sudo rm /boot/grub2/grubenv
sudo ln -s ../efi/EFI/centos/grubenv /boot/grub2/grubenv

Make sure you remove grub2-efi as well if you don't need it, as it seems to cause this issue.

sudo yum remove grub2-efi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.