Score:1

After installing any OS (bios is set to UEFI), the boot order constantly changes (windows and linux installs). How can I disable this "feature"

mx flag

Have numerous different servers (primarily Dell) that we are installing through pxeboot. After the OS is installed the first time, the UEFI boot sequence is automatically changed to allow the OS to load as the first boot option.

This works fine for regular people that want to build a single host one time, but in lab environments where things are continually rebuilt, this causes a large sore. Is there anyway to disable the OS install from changing boot order in UEFI after an install.

This article talks more regarding it https://arstechnica.com/civis/viewtopic.php?f=21&t=1474353 and it is discussed that it is potetnially the uefi specification but no affirmative answer on this.

Is there a way to not allow the UEFI Boot Sequence to be modified after installing an OS?

Score:0
in flag

The option to modify efi boot order is in the uefi specification. You could indeed create a firmware that ignores this part, or has an option to reset it. (Reach out to the manufacturer, Dell for this)

As a work around you could reset this from the OS at least in linux you can use efimgr to change the order.

Another option to consider could be that many machines have the option for different boot order depending on network start or not. That is normal startup uses the normal efi order, however if the machine is "started over the network" with WOL then the "network boot order" is used instead. - This could then be used to instead of restart of the machine, shut it down and then start it remotely.

King Midas avatar
fi flag
efimgr was the solution for me
Score:0
xk flag

Made a script which will check if PXE is first boot option and set it in case it isn't:

#!/bin/bash

# Get the current boot order
boot_order="$(efibootmgr -v | grep BootOrder | cut -d' ' -f2-)"

# Get first boot option hex number
first_boot_nr_hex="$(echo "${boot_order}" | cut -c1-4)"

# Get first boot option
first_boot_option="$(efibootmgr -v | grep "Boot${first_boot_nr_hex}")"

# Check if the first boot option is PXE boot
if echo "$first_boot_option" | grep -q "PXE"; then
    echo "PXE boot is already the first option in the boot order"
else
    # Get the list of boot options, excluding PXE boot
    boot_options="$(efibootmgr -v | grep -E "^Boot[0-9]{4}" | grep -v "PXE" | cut -c5-8 | tr '\n' ',' | sed 's/.$//')"
    
    # Get PXE boot option
    pxe_boot="$(efibootmgr -v | grep -E "^Boot[0-9]{4}" | grep "PXE" | cut -c5-8)"

    # Set the boot order to PXE boot followed by the other options
    new_boot_order="$(echo "$pxe_boot"),$(echo "$boot_options")"
    efibootmgr -o "$new_boot_order"

    echo "PXE boot is now the first option in the boot order"
fi
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.