What do you do when you need to choose an OS at boot but aren’t physically near your machine? [Dakhnod]’s inventive solution is a mix of GRUB, Wake-on-LAN (WOL), and a lightweight ESP8266 running a simple HTTP server. In the past, [dakhnod] already enlightened us with another smart ESP hack. This one’s a clever combination of network booting and remote control that opens up possibilities beyond the usual dual-boot selector.
At its core, the hack modifies GRUB to fetch its boot configuration over HTTP. The ESP8266 (or any low-power device) serves up a config file defining which OS should launch. The trick lies in adding a custom script that tells GRUB to source an external config:
#!/usr/bin/env cat net_dhcp source (http,destination_ip_or_host:destination_port)/grub/config
Since GRUB itself makes the HTTP request, the system needs a running web server. That could be a Raspberry Pi, another machine, or the ESP itself. From there, a WOL-enabled ESP button can wake the PC and set the boot parameters remotely.
Is it secure? Well, that depends on your network. An open, unauthenticated web server dishing out GRUB configs is risky, but within a controlled LAN or a VLAN-segmented environment, it’s an intriguing option. Automation possibilities are everywhere — imagine remotely booting test rigs, toggling between OS environments for debugging, or even setting up kiosk machines that reconfigure themselves based on external triggers.
For those looking to take it further, using configfile
instead of source
allows for more dynamic menu entries, although it won’t persist environment variables. You could even combine it with this RasPi hack to control the uptime of the HTTP server. The balance between convenience and security is yours to strike.
If you’ve got your own wild GRUB customisation, let’s hear it!
You could also configure Grub to output on a serial port, and connect that serial port to an ESP866/ESP32 with esplink firmware, and its web interface:
http://www.zoobab.com/esp8266-serial2wifi-bridge
The ESP32 could also have a big SD card with live boot images served via HTTP, with iPXE entry in Grub.
Maybe it would be possible to serve as a boot image just the boot manager, altered on the basis of what OS is supposed to be booted. That wouldn’t require much storage, since the actual OS would still be on the machine.
Isn’t a tiny HTTP server better? It would have to serve just one line…
There is also the option to connect some hardware (µC with device USB) as USB device and have it present config or boot files as file system, or maybe just an (file system) identifier that GRUB can query. I got that interesting idea from this article: https://danb.me/blog/grub-usb/
Kinda neat. Years ago (pre ESP!) we solved this with writing the config to a shared partition which grub read. Typically it rebooted into an automated DD script to re-image the machine, then again into the newly imaged OS. Worked fine unless a guest OS crashed so badly we had to physically reboot it.
Nowadays there is grub-reboot, which writes a one-time boot-default to the grub partition
haha this hack makes me angry, just because it reminds me of the frustration of working with headless or remote machines. which luckily, i don’t have to be reminded of because (a) i’m not in system administration anymore, and (b) the tools for dealing with that nightmare have evolved tremendously in the last 20+ years.
but anyways imo the hack for this is called netboot. it’s 2025 and every motherboard supports PXE. you don’t have to go buy an EEPROM with a bootloader flashed on it and hope you have one of the network cards that accepts it. it’s built in to your BIOS now.
it’s kind of neat that grub has every feature under the sun but in practice if you actually want to decide what to boot up over the network then PXE is designed just for that
Even better than PXE/WoL – just about any Intel vPro-branded PC made in the last 15 years will support hardware-level KVM for full video redirection from initial POST onwards. Enabling & configuring it used to be an exercise in frustration but it’s now straightforward.
I may be betraying ignorance here, but who still dual-boots? I thought all the cool kids were now using Proxmox or equivalent.
Addendum (I’m the author of the “David” comment above) – I see there’s already another commenter here who beat me to the use of the handle “David”. I have no desire to confuse or impersonate, so will use “David H’ moving forward. Apologies if that, in itself, has caused confusion :)
Time and a place for both, but on the whole I agree with you the hardware you get now is so potent, virtualisation tech fairly seamless from baremetal so its rarely really worth the effort to dual boot.
That said I do still dual boot myself – when you want to experiment with something lower power or that just doesn’t have huge disk capacity spare inbuilt, or want to be really really darn sure your ‘secure’ banking install isn’t open to a security vulnerability in the virtualisation layers…
Neat very minimal setup but if you want to be more flexible I recommend:
1. booting via PXE
2. chainloading iPXE https://ipxe.org/
3. then pxelinux https://wiki.syslinux.org/wiki/index.php?title=PXELINUX
And you can basically boot whatever from wherever (over any protocol) even on a completely wiped computer (no local grub config).
Like eg. Debian NetBoot image, anything over iSCSI, https (with certificate checking) …
Lots of esp8266 web server arduino sketches on the Web, usually for displaying sensor reading, or screen button relay control. Customize to push grub info when labeled screen button pushed?
I feel like you could get a remote console directly from uefi if you were willing to bad things…
I ssh in (usually via OpenVNC), then:
$ sudo grub-reboot ‘1>1’ # or whatever sequence number I want to boot.
$ sudo reboot
Simple as that. :)