Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Fedora 18 and Windows 7 on my laptop.

I had grub2 bootloader and the default is been set to windows 7.

After I turn on my laptop it just automatically boots into windows 7.

Now I want to set the default to Fedora 18 again, can you help?

share|improve this question
up vote 1 down vote accepted

what do you mean by saying "default is been set to windows 7 " ?

if you still have GRUB bootloader on your MBR:

you should change the default OS on your system's GRUB configuraton file which is in this path : /boot/grub2/grub.cfg

in this line :

set default="num"

you can change the num to an integer which shows the menu-entry of Fedora on your Bootloader menu. (the nums begins from zero)

but, as mentioned in "grub.cfg" file:


because any incorrect change will cause your system not boot at the next system startup.

so, the better way is to know the Menu-entry of your Fedora at the bootloader and using this command to change the default OS to Fedora :

grub2-set-default MENU_ENTRY

for example if Fedora is the first Menu-entry at your bootloader, the command will be :

grub2-set-default 0


if you had installed windows bootloader :

insert Fedora DVD and choose "troubleshooting".

then go to "Rescue a fedora system" ,then follow these steps :

  1. choose "Continue" from these choices:[continue / read only / skip]
  2. click on "Ok" button.
  3. Click on "OK" button again.
  4. choose "Shell Start shell" andclick on "OK" button.

then when you accessed the shell, type this command :

chroot /mnt/sysimage

then try this command :

grub2-install /dev/sda

by this command, grub2 will be written on the MBR of your first Hard Drive( not first partition) , it is not neccessary to determine the partition because each Hard drive has one unique MBR.

for example if you had two hard drives and you wanted to insert grub2 at the MBR of your second Hard drive, the command would be : grub2-install /dev/sdb

*it is finished and now you can restart the system to see the changes


If this answers your question, please mark this as answered by clicking the gray check icon to the left - it will change to a green icon, thanks.

share|improve this answer
The reason for "DO NOT EDIT THIS FILE" is mainly because it is auto generated and will be overwritten on next change, upgrade of kernel etc. – and yes one can do something bad as well. The file to edit is: /etc/default/grub and or add to /etc/grub.d - docs.fedoraproject.org/en-US/Fedora/16/html/Installation_Guide/… ,, Main doc – Runium Apr 1 '13 at 14:59
thanks for your answer, I installed grub2 again and now the default is Fedora18 :) – fatehi Apr 1 '13 at 15:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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