apertis-update-manager-ota-auto manual
medium
- Image Types:
- minimal-armhf
- Image Deployment:
- OSTree
- Type:
- functional
Description
Test the apertis-update-manager automatic updates over the air.
Resources
- 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
- The DUT must be connected to network
Pre Conditions
- This test requires a properly configured time source: when testing devices not carrying a battery-backed real time clock in a network which prevents connections to NTP servers (and only in that case) manually ensure that the time on the device is set appropriately and that it is propagated to the hardware clock so it is stay set on the next reboot if the power is not plugged off.
- If direct access to repository with updates for DUT is restricted and proxy server should be used, then need to add the address of this proxy for OSTree on DUT by command:
$ sudo timedatectl --adjust-system-clock set-time "2019-08-21 18:49:03"
$ sudo ostree config set 'remote "origin"'.proxy "http://10.168.128.45:3128"
Execution Steps
- Check the initial deployment
- Prepare the copy of commit and deploy to allow the upgrade to the same version
- Command below shows you an initial commit ID, for instance
- Get the Collection ID and ref
- Create the commit with changed timestamp to allow upgrade with recent update file
- Deploy the prepared commit
- Wait until the system is booted again and check the deployment
- The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'
- Remove the initial deployment
- Check the current deployment
- Enable automatic OTA updates in configuration file '/etc/apertis-update-manager.ini'
- Configuration file '/etc/apertis-update-manager.ini' must have property 'UpdatesFromNetwork' set to true
- Remove blacklist file if it exists
- Reboot the system
- Wait while the system booted successfully. Need to wait a short time (30-120 sec) depending on your network. The update must be downloaded and the system should be rebooted second time automatically. The current status of upgrade could be checked with journalctl log -- it should not contain error messages about the upgrade. The listing below is just for example:
- Check the current deployment has been updated and that the rollback entry points to the prepared deployment
- Check the journal log should mention that the system check the update availability and report it is already up to date
$ sudo ostree admin status
$ export BOOTID=$(sudo ostree admin status | sed -n -e 's/^\* apertis \([0-9a-f]*\)\.[0-9]$/\1/p'); echo $BOOTID
$ 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
$ 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"
$ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
$ sudo ostree admin status
$ sudo ostree admin undeploy 1
$ sudo ostree admin status
$ sudo sed -i -e "s/^UpdatesFromNetwork=.*/UpdatesFromNetwork=true/" /etc/apertis-update-manager.ini
$ sudo grep UpdatesFromNetwork /etc/apertis-update-manager.ini
$ sudo rm -f /var/aum_blacklist.conf
$ sudo reboot
$ sudo journalctl -ef --unit apertis-update-manager
Jun 01 11:54:26 apertis apertis-update-[355]: Ostree upgrade progress: 1 metadata, 0 content objects fetched
Jun 01 11:54:26 apertis apertis-update-[355]: Cannot check the ID in black list: No such file or directory
Jun 01 11:57:10 apertis apertis-update-managerd[355]: libostree pull from 'origin' for apertis/v2019pre/amd64-uefi/minimal complete
security: GPG: disabled http: TLS
non-delta: meta: 23 content: 39
transfer: secs: 163 size: 32.2 MB
Jun 01 11:57:10 apertis apertis-update-[355]: New upgrade downloaded! Deploying..
Jun 01 11:57:10 apertis apertis-update-managerd[355]: Copying /etc changes: 13 modified, 0 removed, 1 added
Jun 01 11:57:10 apertis apertis-update-[355]: Couldn't unlink ostree-0-1.conf
Jun 01 11:57:11 apertis apertis-update-managerd[355]: Transaction complete; bootconfig swap: yes; deployment count change: 1
Jun 01 11:57:11 apertis apertis-update-[355]: Ostree upgrade ready, system should be rebooted
Jun 01 11:57:11 apertis apertis-update-[355]: Rebooting to apply pending update
$ sudo ostree admin status
$ sudo journalctl -ef --unit apertis-update-manager
Jun 01 22:35:32 apertis apertis-update-[365]: Ostree upgrade poll starting
Jun 01 22:35:34 apertis apertis-update-[365]: Ostree upgrade progress: 1 metadata, 0 content objects fetched
Jun 01 22:35:34 apertis apertis-update-[365]: Ostree already up to date
Expected
The OTA update was properly applied