Skip to content
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

[action] [PR:17414] [installer] Create a blank grubenv if doesn't exist #17965

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

mssonicbld
Copy link
Collaborator

GRUB environment file is neither generated when SONiC is installed from ONiE nor when GRUB starts boot chain sequence

https://github.com/sonic-net/sonic-buildimage/blob/202305/installer/default_platform.conf#L506

 cat <<EOF >> $grub_cfg
if [ -s \$prefix/grubenv ]; then
 load_env
fi
if [ "\${saved_entry}" ]; then
 set default="\${saved_entry}"
fi
if [ "\${next_entry}" ]; then
 set default="\${next_entry}"
 unset next_entry
 save_env next_entry
fi
if [ "\${onie_entry}" ]; then
 set next_entry="\${default}"
 set default="\${onie_entry}"
 unset onie_entry
 save_env onie_entry next_entry
fi
EOF

The GRUB environment file is being regenerated (if not present) each time after system cold reboot, when SONiC reboot script is being called

https://github.com/sonic-net/sonic-utilities/blob/202305/scripts/reboot#L152

# Verify the next image by sonic-installer
local message=$(sonic-installer verify-next-image 2>&1)
if [ $? -ne 0 ]; then
 VERBOSE=yes debug "Failed to verify next image: ${message}"
 exit ${EXIT_SONIC_INSTALLER_VERIFY_REBOOT}
fi

In fact, GRUB environment list command is responsible for regeneration

root@r-anaconda-15:/home/admin# ls /host/grub/
fonts grub.cfg grubenv i386-pc locale
root@r-anaconda-15:/home/admin# rm -f /host/grub/grubenv
root@r-anaconda-15:/home/admin# ls /host/grub/
fonts grub.cfg i386-pc locale
root@r-anaconda-15:/home/admin# grub-editenv /host/grub/grubenv list
root@r-anaconda-15:/home/admin# ls /host/grub/
fonts grub.cfg grubenv i386-pc locale

Why I did it

  • To fix BIOS firmware update after fresh image installation from ONiE
Work item tracking
  • N/A

How I did it

  • Initialized empty GRUB environment file after ONiE installation

How to verify it

  1. Install image from ONiE
  2. Run BIOS firmware upgrade

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

  • N/A

Link to config_db schema for YANG module changes

  • N/A

A picture of a cute animal (not mandatory but encouraged)

 .---. .-----------
 / \ __ / ------
 / / \( )/ -----
 ////// ' \/ ` ---
 //// / // : : ---
 // / / /` '--
// //..\\
 ====UU====UU====
 '//||\\`
 ''``

- Why I did it
To fix BIOS firmware update after fresh image installation from ONiE

- How I did it
Initialized empty GRUB environment file after ONiE installation

- How to verify it
Install image from ONiE
Run BIOS firmware upgrade

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
@mssonicbld
Copy link
Collaborator Author

Original PR: #17414

@mssonicbld mssonicbld merged commit f419319 into sonic-net:202311 Feb 1, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants