LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Editing Default GRUB2 Boot Entry from Windows (http://www.linuxquestions.org/questions/linux-software-2/editing-default-grub2-boot-entry-from-windows-937470/)

newmanium2001 03-31-2012 06:38 PM

Editing Default GRUB2 Boot Entry from Windows
 
So, like many users I'm sure, I still have to dual boot Windows 7 for some must-have applications that aren't available on Linux. I'm running Fedora 16 for my Linux distro and it's recently been changed to GRUB2 (GRUB 1.99 to be exact).

What I used to be able do in my dual boot setup was to edit the grub.conf in the /boot file system that I mounted from Windows. More specifically, I had my /boot file system formatted ext2 so I could mount it in Windows, then edit the default= entry from a Windows RDP session and boot back up into Fedora when I was done with Windows.

Now, with GRUB2, the only way I see to edit the default boot entry is to use grub2-set-default. Obviously, this command isn't available from Windows. I also can't seem to make sense of the grub2.cfg file. I don't see any sort of "default" entry that I would be used to in the old grub.conf. I also know you're not "supposed" to edit that file directly, but I'd be willing to edit it and lose my changes just for that one time I needed to boot back up into Windows.

Any ideas on how I could manually edit a file in the /boot file system in order to change my default menuentry?

Thanks!

yancek 03-31-2012 08:11 PM

If all you want to do is to change the default boot entry in Grub2, you just need to edit the /etc/default/grub file. The beginning of that file is shown below:

Quote:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
There are also files in /etc/grub.d where you can make changes. I have Ubuntu 10.10 installed and at the top of the /boot/grub/grub.cf file is this line:

Quote:

set default="0"
That boots the first menuentry so you could count down to whichever entry to put the number you want, counting from zero. My experience with editing grub.cfg is that if I run update-grub after editing it and don't have the changes in one of the other grub files in /etc, the changes disappear.

I'm not really clear on your situation. If you have windows and Fedora, why don't you just boot Fedora and make the changes? Are you not able to boot Fedora?

newmanium2001 04-01-2012 11:25 AM

So to clarify the situation:

If I'm booted to Windows and my default menuentry is Windows, there's no way for me to boot up to Fedora when I'm remote. I would have to be physically present in front of the machine to stop GRUB and boot to Fedora. The other option is to edit some file from my /boot file system to make it boot up to Fedora automatically after I issue the reboot.

The reason it has to be in /boot is because, as far as I know, there's still no way to mount ext4 in Windows. My / file system and everything else is ext4, but /boot is ext2 so I can access it in Windows (I use Ext2Fsd btw).

Given this situation, your suggestion of editing the file in /etc/default is probably off the table.

I did come up with a solution I think. The "set default" line in /boot/grub2/grub.cfg was looking so foreign to me because it was set to this:

set default="${saved_entry}"

Which was because my /etc/default/grub was set to "saved" instead of a # for a menuentry. I can set default to 0 or 2 from Windows to boot back up into Fedora. I guess I was looking for /boot/grub2/grub.cfg the whole time, but that line being set to a var kind of threw me off.

Thanks for the suggestions. Problem solved!


All times are GMT -5. The time now is 05:29 PM.