1

I want a dual boot Windows/Linux system, which will be handled by GRUB. I'm almost never in front of the PC when it's booting, so it's quite useless to leave a time-out selection screen. I also want Linux to be the default choice. The Linux distro I'm going with is quite light, so it can probably boot in just a few seconds, no problem, to it's login screen.

So, I want the choice to boot into Windows be on the login screen of Linux. How do I make this option available? I know GRUB still resides to the File System, so maybe I can customize the login screen to allow me to set the GRUB options to temporarily boot to Windows (meaning it'll go back to defaulting to Linux after trying to boot to Windows once).

Has this already been done?

4
  • Which Linux distribution/desktop environment are you using?
    – sigalor
    Commented Oct 15, 2016 at 11:15
  • Anyway, I guess it will be quite hard to accomplish this task, as the following things need to be done: 1) Add a button like "Boot to Windows" to the login screen of your desktop environment (maybe the only way is by changing its source). 2) When it gets pressed, the GRUB configuration needs to be changed to set Windows as default selection. 3) When GRUB sets in after reboot, its configuration needs to be changed to make Linux the default selection again, which has to happen before Windows boots. This makes the temporarily boot to Windows possible. Very interesting question though!
    – sigalor
    Commented Oct 15, 2016 at 11:24
  • I think modifying the login screen won't involve changing the source code. I believe it's something that can be configured with the X Windows System or the DE (maybe it's set in the via Freedesktop.org, I dunno). The issue is asking GRUB to change the boot temporarily and then revert back.
    – Derpy_Merp
    Commented Oct 15, 2016 at 16:33
  • You still havent mentioned your distro for linux. Im happy to test for the specific distro but need to know debian rhel or what? Commented Oct 16, 2016 at 20:45

1 Answer 1

0

First, you need to find out the number of the GRUB menu entry of your Linux and your Windows, counting from 0 as the entry at the top.

Then, to set the Linux as the default entry, open the file /etc/default/grub in your favorite text editor as root (e.g. sudo gedit /etc/default/grub) and change the line GRUB_DEFAULT=0 to GRUB_DEFAULT=<linux_entry_number_from_above>. Then execute sudo update-grub. This makes Linux be the default entry.

To boot to Windows temporarily, execute sudo grub-reboot <windows_entry_number> and then reboot. Windows will then be the default entry only for the next boot, after that, your Linux will be the default selection again. I tested this in VirtualBox and there it worked. I got most of the previous information from this answer.

1
  • Note for Debian its grub-reboot but for rhel its grub2-reboot. This should work in essence he wants a login option that runs a script which then executes grub reboot 4 Commented Oct 16, 2016 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .