Command to reboot headless Ubuntu Server 20.04 and boot from pxe or USB once?

Is it possible to issue a reboot command in Ubuntu Server that triggers boot from USB or PXE after reboot? Basically it’s a headless system and I would like to run a backup tool without having to hookup a screen/keyboard to it. When the backup tool loaded I can SSH into it and run the backup remotely, then reboot and boot Ubuntu again.

Since Mac and Windows allows to choose the boot medium from within the OS, I guess this is also possible on Ubuntu somehow? The Bios is an UEFI Bios.

Thanks

Answer

In theory, yes you can modify the EFI settings to change boot order. (in practice expect bugs and gotchas)

Most common Linux tool is efibootmgr.

Unfortunately I do not have exact details for you, since it was a very long time since I used it.
Some related data. https://superuser.com/questions/1451233/change-the-boot-order-with-no-option-in-uefi-settings

In case of legacy pcbios mode, this is much harder and involves changing the correct parts of the nvram to change settings, and that is different between models, and in some times even different between bios versions.

Attribution
Source : Link , Question Author : Daniel Klose , Answer Author : NiKiZe

Leave a Comment