Skip to content

Add efibootmgr script #3645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add efibootmgr script #3645

wants to merge 1 commit into from

Conversation

martinhoyer
Copy link
Collaborator

Requires #3396

Pull Request Checklist

  • implement the feature
  • write the documentation
  • include a release note

@martinhoyer martinhoyer added the status | blocked The merging of PR is blocked on some other issue label Apr 3, 2025
@martinhoyer martinhoyer self-assigned this Apr 3, 2025

# Configure next boot
logger -s "Setting next boot entry to $os_boot_entry"
efibootmgr -n $os_boot_entry

Check notice

Code scanning / shellcheck

Double quote to prevent globbing and word splitting. Note

Double quote to prevent globbing and word splitting.
@@ -16,6 +16,12 @@ results are represented as ``<testsuite>`` tags, each containing a
``<testcase>`` tag for the main result, along with additional
``<testcase>`` tags for any subresults.

A new ``tmt-ensure-efiboot-order`` script has been added to help manage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a bit more generic name such as tmt-boot-order or tmt-set-boot-order? Not sure if there are (or will be) more similar use cases, but the currently proposed name sounds very specific to efiboot. Perhaps, in the future, we would like to support not only preserving the current one but setting a specific one? Just brainstorming...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, @psss you are the naming expert :)

@psss psss linked an issue Apr 9, 2025 that may be closed by this pull request
fi

# Get current boot entry
os_boot_entry=$(efibootmgr | awk '/BootCurrent/ { print $2 }')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we already have a similar code in the tmt-reboot script:

if [ $efi = True ]; then
if efibootmgr &>/dev/null ; then
os_boot_entry=$(efibootmgr | awk '/BootCurrent/ { print $2 }')
# fall back to /root/EFI_BOOT_ENTRY.TXT if it exists and BootCurrent is not available
if [[ -z "$os_boot_entry" && -f /root/EFI_BOOT_ENTRY.TXT ]] ; then
os_boot_entry=$(</root/EFI_BOOT_ENTRY.TXT)
fi
if [[ -n "$os_boot_entry" ]] ; then
logger -s "efibootmgr -n $os_boot_entry"
efibootmgr -n $os_boot_entry
else
logger -s "Could not determine value for BootNext!"
fi
fi
fi

Possibly it would make sense to keep it at one place and share?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be, I just thought it would be good to have it fully independent, but no preference, especially if we'll be copying all scripts at once to guests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status | blocked The merging of PR is blocked on some other issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reboot efi systems make them unusable
2 participants