4

I'm trying to change the default OS in grub, but when I do

sudo gedit /boot/grub/grub.cfg and change it to option 3 instead of 0 and run update-grub, nothing changes. The default selected OS is still the first one and when I look in grub.cfg it's back to 0. What am I doing wrong?

Braiam
  • 66,947
  • 30
  • 177
  • 264
PatronBernard
  • 53
  • 1
  • 1
  • 7

3 Answers3

9

As stated on the top of /boot/grub/grub.cfg:

# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

Edit /etc/default/grub instead.

Here are details on how to configure the grub file; see the other answers there for a GUI-based method.

Chan-Ho Suh
  • 7,544
  • 4
  • 41
  • 73
2

For a small change, just save grub.cfg without update-grub afterwards.

Just realize that anything you do will revert to the information in the scripts the next time update-grub is called.

Thus the reason we don't edit grub.cfg directly.

JohnWayne
  • 29
  • 1
0

I forgot about a GRUB installation from source into the /usr/local prefix which was reading /usr/local/etc/default/grub. I removed /usr/local/sbin/grub-mkconfig and reinstalled the system packages and it works as expected, now.

Kalle Richter
  • 5,935
  • 20
  • 69
  • 101