Is it possible to remotely control which image to boot?
I have a tripple boot environment, which I would like to automatically boot during the night, where the systems are set up to automatically power on at a given time. The systems are (and must be) set up to show the rEFIt splash screen and wait for the user to select the OS to boot. However, at night, I would like to be able to tell rEFIt to boot to OSX, then, after that has completed any installations and has shutdown, to boot to Windows, do the same there, then finally boot to Ubuntu and do any updates/installations too. I would like to control this from a server. The server will have to know in which state the machines are: whether in an OS or in rEFIt. Even it I can just tell the systems once into which OS to boot, that too would be fine, as I can boot to OSX on the first day, Windows on the second, etc.
rEFIt can't do that. You need to write a script that changes NVRAM to boot between Mac OS X and a legacy OS (using the "bless" command). When booting a legacy OS, you need to set the boot partition flag in the MBR (using the "fdisk" command or maybe "dd").
When you're done, you'll want to restore rEFIt as the boot by using the "bless" command in the "enable-always.sh" script.
I don't know how to change NVRAM from Windows except by using the Boot Camp control panel. Maybe there's a tool that will do it. One way is to fake mouse clicks in the Boot Camp control panel: http://www.tlarkin.com/tech/managed-dual-booting-casper
Hmm, so, when rEFIt boots and displays the 3 OSes to the user for selection, rEFIt sets the boot partition flag for the OS the user clicks on? Wouldn't that mean that the system would from now on always boot to that partition if it wouldn't wait for the user's input?
What I mean is that if the user can lick on an image, some sort of routine is executed, which boots to the selected partition. Can't that be done by software - without user interaction?
The Mac's EFI looks at the NVRAM to see what should be booted. You can set the NVRAM to run an EFI boot program or to boot using BIOS.
The EFI boot program can be /efi/refit/refit.efi for rEFIt, or /System/Library/CoreServices/boot.efi for Mac OS X, or whatever.
If the Mac boots using BIOS (because the NVRAM was set to do so or because rEFIt told the Mac to boot using BIOS), then the EFI looks for a specific disk (also set in NVRAM) to be the disk that the BIOS will use as the boot disk. The BIOS will start, and run the boot code in the MBR of the boot disk.
The MBR has nothing to do with the boot process unless the Mac is using BIOS to boot. BIOS is not used to boot Mac OS X or rEFIt. rEFIt is an EFI program that can boot other EFI programs (e.g. Mac OS X) or boot using BIOS.
Software in Mac OS X can set NVRAM (e.g. the Bless command line tool or the Startup Disk preference panel).
The Boot Camp drivers include a Boot Camp Control Panel for Windows to change the Startup Disk when you're running Windows.
Instead of using a program to change the boot settings in NVRAM, you could leave NVRAM alone so it always boots rEFIt (as it does now) and just change the rEFIt configuration file at /efi/refit/refit.conf. I think the default_selection option in that file will let you set the default boot option. You could write a script for any OS to change the refit.conf file. You could have multiple .conf files and just rename the one you want to use as refit.conf.
Ok, but as I udnerstand this, this would always be a one timer. Once the system has booted to the given OS, it is up to the OS to reset the boot sequence? This is when it gets complicated, as I would have to access the MAC OS parttion from Windows and Ubuntu in order to change these settings.
The feature I'm looking for ist this:
rEFIt listens on a specific port, awaiting remote controls from a given server, then reacts when the server sends the message (e.g. boot into Windows). The command should do exactly what happens when the user clicks on an OS image to boot. Once booted, the OS will run and eventually shutdown (or be forced to do so from the server - that part already works).
Is something like that possible?
Yes, you would need startup scripts on all the OS'es that know what's happening and know how to go to the next step in your late night maintenance procedure.
You can put rEFIt by itself on a FAT partition. All OS'es can easily read and write to that file system. The partition would probably need to be in the MBR for Windows to see it. If rEFIt is not on the Mac OS X partition then you should make sure /Library/StartupItems/rEFItBlesser/rEFItBlesser knows the correct partition.
It's possible to do networking stuff in an EFI program so someone could add the features you want to rEFIt.
If you can force a shutdown from the server, then can't you force a script to run that modifies the rEFIt.conf file?