sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
733 stars 1.4k forks source link

`fwutil update all` cannot be run consecutively #8928

Open alexrallen opened 3 years ago

alexrallen commented 3 years ago

Description

When fwutil update all fw --boot=none it creates a /var/platform/fw_au_status which remains even after the firmware is installed. On each subsequent execution of fwutil update all it detects the existence of this file and bails out.

This also occurs on all unsuccessful firmware installs, the fw_au_status file must be deleted manually to proceed.

Steps to reproduce the issue:

  1. Setup platform_components.json
{
    "chassis": {
        "MSN2410": {
            "component": {
                "ONIE": {
                        "firmware": "/lib/firmware/onie-updater-2021.05-5.3.0006-115200",
                        "version": "2020.11-5.3.0005"
                },
                "SSD": {
                },
                "BIOS": { },
                "CPLD1": { },
                "CPLD2": { },
                "CPLD3": { }
            }
        }
    }
}
  1. Run fwutil update all fw --boot=none
  2. Run fwutil update all fw --boot=warm

Describe the results you received:

root@r-qa-sw-eth-21101:/home/admin# fwutil update all fw --boot=none
Firmware auto-update for boot_type none is allowed
MSN2410/ONIE firmware auto-update starting: /lib/firmware/onie-updater-newer with boot_type none
MSN2410/ONIE firmware auto-update status return_code: -1
Warning: All firmware auto-update has been performed.
All firmware auto-update has been performed
root@r-qa-sw-eth-21101:/home/admin# 
root@r-qa-sw-eth-21101:/home/admin# fwutil update all fw --boot=warm
/var/platform/fw_au_status firmware auto-update is already performed, warm firmware auto update is not allowed any more
root@r-qa-sw-eth-21101:/home/admin# cat /var/platform/fw_au_status 
{
   "none":[
      {
         "comp":"MSN2410/ONIE",
         "status":true,
         "info":"err_boot_type"
      }
   ]
}

Describe the results you expected:

We expect not to have to manually delete fw_au_status or at least to have clear instructions to do so in the event a stale file is left over.

dgsudharsan commented 3 years ago

@sujinmkang FYI

sujinmkang commented 2 years ago

@alexrallen originally it is designed to prevent from another fwutil all if there is already 'fwutil all' ran for a different reboot type. But I agree to allow another 'fwutil all' for different reboot type if the first fwutil all call is for none.

alexrallen commented 2 years ago

@sujinmkang During testing we discovered that this issue has not been completely resolved (my fault for not catching this during the PR review).

https://github.com/Azure/sonic-utilities/pull/2040 only fixed the case of using --boot none we also see this issue anytime a firmware install fails.

i.e. If you attempt to install firmwares that can only be installed by a cold reboot but you pass the --boot warm flag then the install will (correctly) fail and create a fw_au_status file. Any subsequent installation attempts will fail due to the presence of that file. This is not desired behavior as there should not be any user intervention necessary to re-attempt the install with the correct boot type.

Perhaps augment the logic you have added here in the above PR https://github.com/Azure/sonic-utilities/pull/2040/files#diff-241959edd76c39dcd4dfc3a6f07416039c62cc17b9ab1c255e87cd301073e12eR909

zhangyanzhao commented 2 years ago

@sujinmkang can you please help to provide an update on this issue? Thanks.