0

I have a dual boot setup on my desktop machine, and currently Linux is the default OS, so unless I intervene during boot, it'll boot to Linux. I have a small script to reboot to windows if I'm logged in on Linux, by running sudo grub-reboot 2 && reboot, and I'm wondering if I can do something similar from Windows. This will allow me to make Windows my default OS, without sacrificing the ability to easily switch to the secondary OS with a simple script.

I realise this may be impossible or inadvisable, as I know Windows has a habit of not cooperating in multi-boot situations, so feel free to point me at something that says it can't be done, or can't be done yet.

Summary: is there a script I can run from Windows, similar to grub reboot 2 on linux, that will change the boot priority for the next reboot only, to enable a quick switch to my secondary OS?


Addendum: use cases

I hope you'll excuse the repetition, I want to be thorough. All I'm lacking is the "Reboot to Linux" script.

Current situation

Linux is the default OS, and I have a script to swap to Windows.

  • I am using Linux currently and want to switch to Windows. I run the script on my desktop labelled "Reboot to Windows". My computer restarts and Windows is selected. I do not intervene. It loads into Windows. Next time I reboot after this, Linux is still the default selection.
  • I want to run Windows. I turn my computer on, and Linux is selected on the boot screen. I do not intervene in time, and it loads Linux. I run the script on my desktop labelled "Reboot to Windows". My computer restarts and Windows is selected. I do not intervene. It loads into Windows. Next time I reboot after this, Linux is still the default selection.
  • I am using Windows currently and want to switch to Linux. I reboot my computer. My computer restarts and Linux is selected. I don't intervene. It loads into Linux.
  • I want to run Linux. I turn my computer on, and Linux is selected on the boot screen. I don't intervene. It loads into Linux.
  • I want to run Windows. I turn my computer on, and Linux is selected on the boot screen. I intervene and select Windows. It loads into Windows.

Preferred situation

Windows is the default OS, and I have a script to swap to Linux.

  • I am using Windows currently and want to switch to Linux. I run the script on my desktop labelled "Reboot to Linux". My computer restarts and Linux is selected. I do not intervene. It loads into Linux. Next time I reboot after this, Windows is still the default selection.
  • I want to run Linux. I turn my computer on, and Windows is selected on the boot screen. I do not intervene in time, and it loads Windows. I run the script on my desktop labelled "Reboot to Linux". My computer restarts and Linux is selected. I do not intervene. It loads into Linux. Next time I reboot after this, Windows is still the default selection.
  • I am using Linux currently and want to switch to Windows. I reboot my computer. My computer restarts and Windows is selected. I don't intervene. It loads into Windows.
  • I want to run Windows. I turn my computer on, and Windows is selected on the boot screen. I don't intervene. It loads into Windows.
  • I want to run Linux. I turn my computer on, and Windows is selected on the boot screen. I intervene and select Linux. It loads into Linux.
  • Not exactly what you're asking for, but grub can be configured to boot by default to the latest entry chosen. – To Do Sep 22 '20 at 14:34
  • I'm effectively asking for a "reboot into Linux" script to run on windows. I don't want to change any defaults, only to change OS for the next reboot. I'll add a use case to my question – Zoey Hewll Sep 24 '20 at 1:43
1

This is exactly the problem we have been facing for a long time in a CIP with dual-boot computers administered remotely.

Unfortunately, I can't come up with a complete solution, just another idea that might help to find a solution: Grub could get either the complete configuration or at least the configuration for "next boot" or/and "default boot" from a server in the LAN (via whichever protocol).

This would have the additional advantage of clarity and easier administration for larger pools...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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