Dual-boot convenience script and setup.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HJ 6ce989381d Update 'README.md' 5 years ago
sudoers.d some renames 5 years ago
Boot To Windows.desktop an .desktop example for script 5 years ago
LICENSE Initial commit 5 years ago
README.md Update 'README.md' 5 years ago
win win script 5 years ago
winboot Update 'winboot' 5 years ago


Quick Dualboot setup

So, you use linux daily, but some games require you to dualboot into windows because publishers haven't heard of linux. Rebooting PC while holding F8 or other hotkey to bring boot menu can be a hassle, and require you to sit through entire process. I bring you the solution that would make dualboot as painless as possible - only launch an app and your PC will begin the dualboot process, through the power of EFI (or grub2, but unfortunantely i lost the files for that way of dualbooting) and scripting.

The concept:

  • Use efibootmgr to get the list of boot options. Find ID of Windows Boot Manager and set BootNext to it.
  • BootNext is a EFI variable that makes is so that next boot target will be the one you've set it to, and it will be reset afterwards.
  • Instruct the DE or whatever you use to reboot or just sudo reboot but that would usually forces things to close without asking for confirmation.
  • Reboot the PC
  • When you've done doing whatever you've been doing on Windows, just reboot again and you'll be back on GNU/Linux (assuming it's your default boot target).

The files

The main, DE-agnostic file is winboot which does efi lookup and sets the BootNext. The script requires root priviliges because efibootmgr does so. For conveninece's sake you can make it so that it doesn't require password - there's an example sudoers.d/winboot you can (edit to match your path of winboot script and) put into /etc/sudoers.d/. Just make sure only root can edit that script, or else it could become a securty issue.

Another file is win which calls winboot via kdesudo (it's KDE for now because i use it, feel free to contribute so it uses policy-kit or something), shows a notification about reboot and prompts graceful reboot via DBus to ksmserver (again, KDE only, feel free to contribute to make it compatible with other DEs). There's an example of .desktop file you can tweak and add to ~/.local/share/applications and probably use it in panel or launch menu or desktop icon.

Feel free to place your files anywhere you want, just make sure you enter correct paths to them. The win name comes from an old DOS-era command that used to start Windows 95 from DOS prompt.

The issues

There's know issue where it would start everything appear working ok, however upon reboot you boot into Linux no matter what. This is most likely because winboot failed. Usually the problem lies because efivars partition running out of free space. For me it's usually some dumps that take the majority of space that could be safely deleted: sudo rm /sys/firmware/efi/efivars/dump-*.

The alternatives

If your GRUB 2 can boot windows, you can use grub-reboot instead of efibootmgr, however it would be some seconds slower because you'll be adding GRUB into boot time.

The speedups

The scripts themselves only offer conveninence and speedup from not having to sit through reboot and bring up menu/select windows in GRUB, or not having to enter password every time you want to reboot, i strongly suggest getting some SSDs for both Linux and Windows boot partitions to drastically shorten the boot time. Another thing you could do to speed it up is to tweak BIOS/EFI settings for faster boot times.