Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an unusual question and I think it is really hard :-)

What I want to achive is a way to be able to remotly configure which operating system is booted on a client machine.

E.g. I have Windows XP on Partition 1 and Win7 on Partition 2. I now want to switch on the computer and have it wait for a remote command to decide which partition to boot.

I first tried to do this with grub. Grub can boot and wait for commands on the serial console. On this serial console I can then send commands from a second pc to decide which partition to boot. Unfortunately this only works over traditional com ports. The USB to serial adapters do not work :-(

Therefore I thought I could boot into a mini Linux and open a TCP socket. After the arrival of a command I would like to boot (somehow chainload) one of the windows partitions. Is something like this possible?

Thanks a lot, Fabian

share|improve this question

migrated from stackoverflow.com Jun 16 '11 at 14:28

This question came from our site for professional and enthusiast programmers.

add comment

6 Answers

if you have a separate, always running linux on your network, you could configure your machine to boot over network from this linux machine. Then, on this linux machine you could serve different boot images with grub loading either OS as default option.

share|improve this answer
    
Unfortunately this is no option for me, we already have a dhcp and tftp server on the network which serves images to the ip telefones. So it would be quite risky to run another one. –  Fabian Jun 16 '11 at 15:10
add comment

An idea: Add an additional OS that's a mini Linux as you mention. It opens this TCP socket. When you get the command, modify the GRUB config file to set the default to be the correct OS and initiate the reboot. Once any of those OS starts up, they need to re-modify the GRUB config script to go back to the mini Linux.

share|improve this answer
    
This looks like the way I have to go, unfortunately I also remotely install stuff on the bootet partition so that it might even no longer boot. So it might never get to the point where it resets the grub config. Therefore I also have a third partition which when booted restores the first two partitions to a sane state. This is all for a test setup. –  Fabian Jun 16 '11 at 15:13
add comment

Don't do any of that. Instead, put Xen (HyperV, etc.) on the box and always boot that, then control VMs of Windows and Linux at will.

Got to be easier than trying to remotely rewrite Grub config files, which can potentially leave you with an unbootable device.

In my experience, VMs are great for testing anyway--if you make a mistake you can just revert to an earlier state.

share|improve this answer
add comment

Another idea: have two GRUBs stored on your "control pc". The PC that is being controlled then uses PXE to retrieve the GRUB you want. Use a TFTP server for this. Make a little script that switches out the GRUB settings in the TFTP part.

share|improve this answer
    
Kresho had the same idea, my post is useless ;D –  sinni800 Jun 16 '11 at 15:02
add comment

well.... you may get a KVM redirector over network device. Eg. AMI Mega RAC cards. They allow you to control from the boot screen.

share|improve this answer
add comment
up vote 0 down vote accepted

I am answering my own question here, since I implemented something slightly different from what was suggested.

I have configured grub with this config:

# First we load the current settings
if [ -s $prefix/grubenv ]; then  
  load_env  
fi

set default="DEFAULT ENTRY"

# Load the saved default entry
if [ ${saved_entry} ]; then
  echo Found a saved entry: ${saved_entry}
  set default="${saved_entry}"
fi

# Reset saved_entry to our boot service
set saved_entry="DEFAULT ENTRY"
save_env saved_entry

echo Selected boot entry is: ${default}

This is simmilar to Daves answer except that grub is already resetting the boot entry to a default value. Therefore the last selected os does not even has to boot.

The default entry now boots a small os with a tcp server. With the tcp server I can receive a boot command which calls grub-editenv to select a different boot entry:

grub-editenv.exe D:\boot\grub\grubenv set saved_entry=NewEntry

This should also make sure to not inadvertently corrupt the grub config.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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