How to setup a headless dual boot system

User avatar
scole of TSBT
Boinc Major General
Boinc Major General
Posts: 5529
Joined: Mon Feb 03, 2014 2:38 pm
Location: Goldsboro, (Eastern) North Carolina, USA
Has thanked: 13 times
Been thanked: 20 times

#1 How to setup a headless dual boot system

Post by scole of TSBT »

I have several dedicated crunching systems which are headless, meaning they have no monitor, keyboard or mouse connected to them. I installed Windows 7 on them but wanted the option to boot and run them under linux should the need arise. Setting up a dual boot system is the obvious answer, except how do you choose which OS to boot when your system doesn't have a monitor or keyboard? Turns out it's fairly easy to set up.

First, Windows should be installed. Next install Ubuntu server. There's plenty if info on the web about how to install Ubuntu after Windows to create a dual boot system. Just follow those. If anyone has questions, just ask though. If you don't want to install a seperate disk for linux and have enough free space on your current Windows partition, you can shrink the Windows partition to create free space to install Ubuntu. If windows is installed after linux, just run...
sudo update-grub
After you have a dual boot system working, you need to tweak the grub boot configuration.  Edit the file /etc/default/grub and change the line that looks like this...
To this...

Save the file and run...
sudo update-grub

The default OS is linux. If you reboot, it will default to linux. But there is a way to make it boot to Windows on just the next re-boot, then revert back to linux as the default. You need to verify which boot option Windows is listed under. On my installs its 4, but to be sure reboot and pay attention to which position Windows is listed in. They're not numbered on the screen though. Just a list. Windows is always the last option and if there are 3 choices, then Windows will be option 2. If there are 4 choices, WIndows will be option 3.

Now if you are running linux and want to boot to Windows run...
grub-reboot 2 (or whatever option number Windows was in on the Grub boot options)

You can make a script file to run the reboot commands with a single command. Put this in a file and save it as boot-win...
/etc/init.d/boinc-client stop
grub-reboot 2
shutdown -r now

Be sure to change the permissions of the file boot-win by running...sudo chmod 777 /boot-win

To run it and reboot to windows run...
sudo /boot-win

-Any time windows restarts, it will always boot to linux.
-If you plan to install Windows on the same disk as linux, be sure to give Windows enough disk space. I would go no less than 100GB and even then it will limit how to can bunker, software installs, etc.
-If you install Windows after linux, you will need to re-install grub. See this... ... -windows-7
These users thanked the author scole of TSBT for the post:
Rating: 11.11%
General Bitchin'
General Bitchin'
Posts: 6023
Joined: Wed Aug 15, 2018 1:15 pm
Location: Huntly, Scotland
Has thanked: 72 times
Been thanked: 67 times

#2 Re: How to setup a headless dual boot system

Post by davidbam »

Thank you kindly. I need to try this on a couple of machines after I fit them with some kind of old GPU card which I assume is needed for Windows
I think this is fool-proof but could you just try it for me please? • There are 10 types of people in the world; those who understand binary, and those who don’t
User avatar
[ TSBT's Pirate ]
[ TSBT's Pirate ]
Posts: 10238
Joined: Thu Oct 04, 2012 1:22 pm
Location: roaming the planet
Has thanked: 21 times
Been thanked: 57 times

#3 Re: How to setup a headless dual boot system

Post by Alez »

If there's a card fitted, doze will use it. If not it will use the default display of the Mobo , exactly the same as nix does. There's more in common than you think. Networking on doze is actually lifted straight from nix for example.
The best form of help from above is a sniper on the rooftop....
Post Reply Previous topicNext topic

Return to “Linux”