apertis-update-manager-rollback manual

low

Image Types:
minimal-armhf
Image Deployment:
OSTree
Type:
functional

Description

Test the automatic rollback and blacklist mechanism of apertis-update-manager. The automated version of this test: https://qa.apertis.org/aum-rollback-blacklist.html


Resources

  • A static update bundle file of the same architecture, variant and version as the testing image
  • A Fat32 USB flash drive, preloaded with the update bundle at the root of the disk
  • Downloaded update file (with '.delta' extension) should be copied to flash drive using the name 'static-update.bundle'
  • The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`
  • A PC must be connected to DUT serial port

Execution Steps

  1. Check the initial deployment
  2. $ sudo ostree admin status
  3. Prepare the copy of commit and deploy to allow the upgrade to the same version
  4. Command below shows you an initial commit ID, for instance
  5. $ export BOOTID=$(sudo ostree admin status | sed -n -e 's/^\* apertis \([0-9a-f]*\)\.[0-9]$/\1/p'); echo $BOOTID
  6. Get the Collection ID and ref
  7. $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
    $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
  8. Create the commit with changed timestamp to allow upgrade with recent update file
  9. $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
  10. Deploy the prepared commit
  11. $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
  12. Wait until the system is booted again and check the deployment
  13. $ sudo ostree admin status
  14. The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'
  15. Remove the initial deployment
  16. $ sudo ostree admin undeploy 1
  17. Reboot the system
  18. Check the current deployment
  19. $ sudo ostree admin status
  20. Start the user interface agent with mode preventing automatic system reboot after update
  21. $ sudo updatectl --register-upgrade-handler &
  22. Plug the USB flash drive into the device
  23. The update starts automatically
  24. After the update, the device does *not* reboot automatically
  25. Check that the user interface agent reports the pending update
  26. ** Message: Upgrade status: Checking

     ** Message: An upgrade is pending

  27. Remove the USB flash drive
  28. Check if there is pending deployment and reboot the DUT
  29. $ sudo ostree admin status
    $ sudo reboot
  30. In `U-Boot` console check the status of upgrade
  31. $ printenv bootcount bootlimit upgrade_available

    bootcount=1

    bootlimit=3

    upgrade_available=1

  32. Restart the device by pressing the restart button before the boot finishes.
  33. Restart the device a second time by pressing the restart button before the boot finishes.
  34. Restart the device a third time by pressing the restart button before the boot finishes.
  35. U-Boot should be able to detect the rollback mode and boot the system in rollback mode
  36. Warning: Bootlimit (3) exceeded. Using altbootcmd.

    Hit any key to stop autoboot:  0 

    switch to partitions #0, OK

    mmc0 is current device

    Scanning mmc 0:1...

    Found /extlinux/extlinux-rollback.conf

    Retrieving file: /extlinux/extlinux-rollback.conf

  37. Wait for system boot
  38. Check the update has been rolled back and that the initial deployment is still the active deployment
  39. $ sudo ostree admin status
  40. Start the user interface agent
  41. $ sudo updatectl &
  42. Plug the USB flash drive with the same update file into the device
  43. Check that the user interface agent reports the system is up to update
  44. ** Message: Upgrade status: Checking

    ** Message: System is up to date

  45. Check the journal log should mention that the update ID has been blacklisted
  46. $ sudo journalctl -ef --unit apertis-update-manager

    Dec 19 20:54:34 apertis apertis-update-[330]: Ostree static delta starting

    Dec 19 20:54:34 apertis apertis-update-[330]: Revision '9804c4f6e952f0ba61659f55262b9cdd8879cb480084e7f24d9167c2b35f7f28' is marked as blacklisted; skipping

    Dec 19 20:54:34 apertis apertis-update-[330]: Ostree already up to date


Expected

U-Boot is able to detect rollback situation

U-Boot is able to use rollback configuration for bootloader

The "failed" update is rolled back

"Failed" update is marked as blacklisted

Apertis-update-manager is able to detect blacklisted update and refuse to update the system with it