Comment 2 for bug 1981745

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to stx-puppet (master)

Reviewed: https://review.opendev.org/c/starlingx/stx-puppet/+/850577
Committed: https://opendev.org/starlingx/stx-puppet/commit/a13ffba3b80064e61568d1a5d42e0e818b489350
Submitter: "Zuul (22348)"
Branch: master

commit a13ffba3b80064e61568d1a5d42e0e818b489350
Author: Samuel Presa Toledo <email address hidden>
Date: Wed Jul 20 14:31:08 2022 -0400

    grubenv file got corrupted after writing on it

    Every change made to kernel_params is done by updating the
    /boot/efi/EFI/BOOT/boot.env file. This modification consists of
    rewriting the file with addition/removal of some kernel_params.
    This addition/removal is done by running the
    stx-puppet/puppet-manifests/src/bin/puppet-update-grub-env.py file.
    After adding a long string of parameters and then performing a removal,
    the /boot/efi/EFI/BOOT/boot.env file becomes corrupted and cannot be
    updated. If a new update is made, the following error is encountered:

    grub-editenv: error:environment block too small.

    This affects the host when any changes made by "system host-modify-cpu"
    command are executed, causing potential reboot loop when the host is
    unlocked, and eventually it gets in degraded state.

    The fix for this bug is unset kernel_params before every writing occurs
    in grubenv file. Unset is a way to sanitize the kernel_params variable,
    which contains the parameters modified by the command
    "system host-modify-cpu", before a new writing occurs to that variable
    again.

    Test plan
      PASS: Run initial bootstrap for CentOS/Debian successfully
      PASS: Run system host-modify-cpu and unlock host successfully
      PASS: kernel_params, in grubenv file, is unset every time a writing
            occurs
      PASS: grubenv file updated with no issues even after a long string of
            parameters being added/removed

    Closes-bug: 1981745

    Signed-off-by: Samuel Presa Toledo <email address hidden>
    Change-Id: I6f6854a0273765f17954cd5cb7131a22d73c8e97