4

Just thinking out loud here and hoping for a second opinion.

I just got a RPi3 that I am loving. I was looking at using it as a remotely accessible WOL server. The PC I am trying to reach is dual-booted with Windows 10 and Ubuntu 17.10 in which I have configured VNC access to each. I got to thinking that even if I configure the WOL server and I send the magic packet, I still won't be able to choose what OS will be loaded (because AFAIK the magic packet isn't capable of relaying this sort of information).

So, Option 1) Write a python script that can change the grub configuration file to specify the preferred default boot option. Assuming the Ubuntu drive/filesystem is accessible from Windows, a python script would be written accordingly. More easily, a different python script would be made to run in Ubuntu (to make it easier than plainly editing the grub conf file).

Option 2) Not sure if this is even possible but what if I hosted a symlinked (via some intermediate cloud service) grub conf file on the RPi? This way, I wouldn't have to worry about changing the grub conf file from Windows OR Ubuntu, I could just do it on the RPi. What I'm not sure about here is when the change made on the RPi will be accessible to grub in relation to a boot sequence.

I'd appreciate any feedback regarding a more efficient way of accomplishing the above, issues/feasibility regarding the above, miscellaneous ideas, etc. Thanks!

  • 1
    If your CPU supports it, you can get VNC access to BIOS and possibly GRUB. https://blog.dachary.org/2014/03/15/bios-and-console-access-via-vnc/, https://www.howtogeek.com/56538/how-to-remotely-control-your-pc-even-when-it-crashes/ However, I haven’t tried it yet… – Melebius Apr 05 '18 at 09:11
  • Dang, I thought for sure that wouldn’t be possible (at least for me or not for awhile)... I will have to look into it some more but this would be very cool – Sterling Butters Apr 05 '18 at 19:48
  • Darn, not possible for me; surprised that i9 not supported – Sterling Butters Apr 06 '18 at 01:24
  • If UEFI, it has a one time boot option. You can use UEFI boot manager in Ubuntu and boot next option. See man efibootmgr and efibootmgr -n XXXX. Windows must have similar way to access UEFI, but do not know it. – oldfred Apr 06 '18 at 13:22

2 Answers2

1

The way I solved a similar situation was defaulting grub to boot from Ubuntu. Then add an alias at the end of the file /etc/bash.bashrc that reboots to the Windows partition (number 4 for me).

alias windows="sudo grub-reboot 4 && sudo reboot"

The problem with this is that, if you are in Windows and you want to reboot to Windows again, it will first go to Ubuntu by default and you will have to ssh/VNC and reboot to Windows manually with the windows alias. This hasn't been a problem for me so far.

To reboot from Windows to either Windows or Ubuntu, you can create a script that will modify a grub file in /boot. See Is there a way for grub to automatically reboot into Windows from Windows?

Katu
  • 3,593
  • 26
  • 42
0

I will have to look more into this but I thought it was a good find: https://github.com/Fmstrat/diy-ipmi

It is a DIY IP KVM setup: A web-accessable IPMI / IP KVM system that provides full keyboard control, monitor view, and and the ability to reboot computers with standard motherboards remotely as if you were sitting in front of them with a keyboard and monitor. 

Obvious con: Requires purchasing (claimed less than $120) and installation of extraneous equipment

Pro: It would seem that the behavior of the setup resembles a VNC server but from any point in boot sequence or thereafter. Thus, the grub menu (or any bootloader) and any OS would be accessible remotely.

  • 1
    This could be a great answer if you would be so kind as to [edit] in the details as to how you installed it and the pros and cons of this approach that you discovered. Based on your apparent willingness to improve this answer I'm currently considering it a work in progress. – Elder Geek Apr 09 '18 at 14:19
  • Well like I said above, I need to look more into it meaning, for starters, I will have to purchase the items listed on the repo. I can’t verify all the pro’s and con’s yet either because I haven’t installed it. Though, by visiting the repo it seems to me that everything is outlined very clearly and explained better there than I could do here. I posted the link so that others more technically inclined could get a jump start. – Sterling Butters Apr 09 '18 at 15:19
  • I posted what pro and con I have interpreted thus far – Sterling Butters Apr 09 '18 at 15:24
  • Hm, if you are OK with buying additional hardware, some used equipment might be cheaper than the claimed price: http://www.ebay.com/bhp/kvm-over-ip Such a box will be ready to use very quickly in comparison to a DIY solution. – Melebius Apr 10 '18 at 05:50
  • Well since I already had some of the RPi components, the DIY appealed more. Also I still don’t understand how KVMs work and I can’t find a comprehensive beginners guide online so the step-by-step of the DIY also appeals to me. But for sure that option might appeal to others^ – Sterling Butters Apr 10 '18 at 15:26