I have a dual boot Linux/windows system set up, and frequently switch from one to the other. I was thinking if I could add a menu item in one of the menus to reboot directly into windows, without stopping at the GRUB prompt.
I saw this question on a forum, that's exactly what I want but it's dealing with lilo, which is not my case.
I thought of a solution that would modify the default entry in the GRUB menu and then reboot, but there are some drawbacks, and I was wondering if there was a cleaner alternative.
(Also, I would be interested in a solution to boot from Windows directly into Linux, but that might be harder, and does not belong here. Anyway, as long as I have it in one way, the other way could be set up as the default.
UPDATE It seems someone asked a similar question, and if those are the suggested answers, I might as well edit /boot/grub/grubenv
as grub-reboot
and grub-set-default
and grub-editenv
do.
)
Thanks in advance for any tips.
UPDATE:
This is my GRUB version: (GRUB) 1.99-12ubuntu5-1linuxmint1
I tried running grubonce
, the command is not found. And searching for it in the repositories gives me nothing. I'm on Linux Mint, so that might be it...
Seeing man grub-reboot
, it seems like it does what I want, as grubonce
does. It is also available everywhere (at least it is for me, I think it is part of the grub package). I saw two related commands: grub-editenv
and grub-set-default
.
I found out that after running sudo grub-set-default 4
, when running grub-editenv list
you get something similar to:
saved_entry=4
And when running grub-reboot 4
, you get something like:
prev_saved_entry=0
saved_entry=4
Which means both do the same thing (one is temporary one is not).
Surprisingly, when I tried:
sudo grub-reboot 4
sudo reboot now
It did not work, as if I hadn't done anything, it just showed me the menu as usual, and selected the first entry, saying it will boot this entry in 10s.
I tried it again, I thought I might have written the wrong entry (it is zero-based, right?). That time, it just hanged at the menu screen, and I had to hard-reset the PC to be able to boot.
If anyone can try this out, just to see if it's just me, I'd appreciate it. (mint has been giving me a hard time, and that would be a good occasion to change :P).
Reading the code in /boot/grub/grub.cfg
, seems like this is the way to go, but from my observations, it's just ignoring these settings...