apertis-update-manager-powercut manual

low

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

Description

Ensure that failures due to power losses during updates have no effect on the system The automated version of this test: https://qa.apertis.org/aum-power-cut.html


Resources

  • A static encrypted update bundle file of the same architecture, variant and version as the testing image
  • A Fat32 USB flash drive, preloaded with the encrypted update bundle at the root of the disk
  • The latest static encrypted update file can be downloaded at the same location than the target image. It has the same basename, and a '.delta.enc' extension
  • The static encrypted update file should be copied to the flash drive using the name 'static-update.bundle.enc'.
  • 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 list of files to skip and enshure there are some files in these directories
  9. $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
    $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
  10. Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file
  11. $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
  12. Deploy the prepared commit
  13. $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
  14. Wait until the system is booted again and check the deployment
  15. $ sudo ostree admin status
  16. The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'
  17. Check booted deployment have no file objects which we skip
  18. $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
  19. Remove the initial deployment
  20. $ sudo ostree admin undeploy 1
  21. Add udev rule for limiting the maximal read speed from USB drive to 1MBps.
  22. $ sudo tee /etc/udev/rules.d/99-usblimit.rules <<"EOF"

    KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", ENV{DEVTYPE}=="disk", ENV{MAJOR}=="8", RUN+="/bin/sh -c 'echo $env{MAJOR}:$env{MINOR} 1048576 > /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device'"

    EOF

  23. Reboot the system
  24. Check the current deployment
  25. $ sudo ostree admin status
  26. Need to monitor the journal log to catch events in time
  27. $ sudo journalctl -ef --unit apertis-update-manager &
  28. Plug the USB flash drive into the device
  29. The update starts automatically
  30. Wait while the upgrade starts
  31. Dec 19 22:31:46 apertis apertis-update-[390]: mount added : /media/test

    Dec 19 22:31:46 apertis apertis-update-[390]: Ostree static delta starting

    Dec 19 22:31:46 apertis apertis-update-[390]: Cannot check the ID in black list: No such file or directory

  32. Wait for message similar to below in log and immediately unplug the power
  33. Dec 19 22:46:59 apertis apertis-update-managerd[887]: Copying /etc changes: 5 modified, 0 removed, 16 added

  34. Plug the power back and let the device boot
  35. Check the current deployment is the same that at the beginning of the test
  36. $ sudo ostree admin status

Expected

The update wasn't applied

System boots using the initial deployment

Possible corruption of root file system which should not affect to boot into initial OSTree deployment