Comments (4)
Summary
The first is trying to deep copy handlerProperties from the update manifest, which is needed by apt content handler. In fact, it needs "installedCriteria" property in the handlerProperties.
Resolution
The update manifest from the logs shows there is no "handlerProperties" property for step 0:
"instructions": {
"steps": [
{
"handler": "microsoft\/apt:1",
"files": [
"fb42001e3d0d13a3b"
]
}
]
}
Instead, the import manifest should have something like:
"instructions": {
"steps": [
{
"handler": "microsoft\/apt:1",
"handlerProperties": {
"installedCriteria": "1.0"
},
"files": [
"fb42001e3d0d13a3b"
]
}
]
}
Explanation
It uses "installedCriteria" to determine if the update needs to be installed or not. Ideally, the APT content handler should query APT/dpkg to determine if the packages in the apt manifest are installed or not, but since it can be set of package adds and deletions (by prefixing -
to the package name), opted for the existing "installedCriteria" concept, which is an abstract version that is not related to the packages or individual package versions.
When apt packages are installed (or removed if -
prefix is used in apt manifest), then it appends a file at /var/lib/adu/installedcriteria with the latest installed installedCriteria. To determine if IsInstalled is true, it will look to see if the current installedCriteria exists in this file.
Possibly Confusing Documentation
https://learn.microsoft.com/en-us/azure/iot-hub-device-update/import-schema#inlinestep-object that shows handlerProperties is not required which is true in general for a custom content handler, but for APT and other 1st party content handlers, they require at least this:
"handlerProperties": {
"installedCriteria": "1.0"
},
We're looking into how to make this less confusing.
Detailed Analysis
-2143289331 is hex ffff ffff 8040 000d
which from https://github.com/Azure/iot-hub-device-update/blob/main/src/inc/aduc/result.h#L1321 is:
/**
- @brief ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED, ERC Value: 2151677965 (0x8040000d)
*/
#define ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED MAKE_ADUC_EXTENDEDRESULTCODE_FOR_COMPONENT_ADUC_COMPONENT_WORKFLOW_UTIL(13)
From steps-handler.20221103-155849.log:
2022-11-03T15:58:49.3607Z 713[713] [E] Cannot copy 'handlerProperties'. [workflow_create_from_inline_step]
2022-11-03T15:58:49.3607Z 713[713] [E] ERROR: failed to create workflow for level:0 step#0. [PrepareStepsWorkflowDataObject]
This corresponds to code in
where it is trying to copy "handlerProperties" property.
from iot-hub-device-update.
Summary
The first is trying to deep copy handlerProperties from the update manifest, which is needed by apt content handler. In fact, it needs "installedCriteria" property in the handlerProperties.
Resolution
The update manifest from the logs shows there is no "handlerProperties" property for step 0:
"instructions": { "steps": [ { "handler": "microsoft\/apt:1", "files": [ "fb42001e3d0d13a3b" ] } ] }Instead, the import manifest should have something like:
"instructions": { "steps": [ { "handler": "microsoft\/apt:1", "handlerProperties": { "installedCriteria": "1.0" }, "files": [ "fb42001e3d0d13a3b" ] } ] }Explanation
It uses "installedCriteria" to determine if the update needs to be installed or not. Ideally, the APT content handler should query APT/dpkg to determine if the packages in the apt manifest are installed or not, but since it can be set of package adds and deletions (by prefixing
-
to the package name), opted for the existing "installedCriteria" concept, which is an abstract version that is not related to the packages or individual package versions.When apt packages are installed (or removed if
-
prefix is used in apt manifest), then it appends a file at /var/lib/adu/installedcriteria with the latest installed installedCriteria. To determine if IsInstalled is true, it will look to see if the current installedCriteria exists in this file.Possibly Confusing Documentation
https://learn.microsoft.com/en-us/azure/iot-hub-device-update/import-schema#inlinestep-object that shows handlerProperties is not required which is true in general for a custom content handler, but for APT and other 1st party content handlers, they require at least this:
"handlerProperties": { "installedCriteria": "1.0" },We're looking into how to make this less confusing.
Detailed Analysis
-2143289331 is hex ffff ffff 8040 000d
which from https://github.com/Azure/iot-hub-device-update/blob/main/src/inc/aduc/result.h#L1321 is: /**
- @brief ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED, ERC Value: 2151677965 (0x8040000d)
*/
#define ADUC_ERC_UTILITIES_WORKFLOW_UTIL_COPY_UPDATE_ACTION_COPY_HANDLER_PROPERTIES_FAILED MAKE_ADUC_EXTENDEDRESULTCODE_FOR_COMPONENT_ADUC_COMPONENT_WORKFLOW_UTIL(13)From steps-handler.20221103-155849.log:
2022-11-03T15:58:49.3607Z 713[713] [E] Cannot copy 'handlerProperties'. [workflow_create_from_inline_step] 2022-11-03T15:58:49.3607Z 713[713] [E] ERROR: failed to create workflow for level:0 step#0. [PrepareStepsWorkflowDataObject]
This corresponds to code in
where it is trying to copy "handlerProperties" property.
Thank you very much for the detailed response. I used the az cli to create the update manifest, perhaps additional logic is needed there to properly create the manifest file with all required properties. I also noticed due to fat fingering that you can set an invalid update handler via the CLI.
I'll try this and let you know results.
from iot-hub-device-update.
It's working as expected - Thank you
from iot-hub-device-update.
Glad it's working. Cheers!
from iot-hub-device-update.
Related Issues (20)
- Replacement workflow not working HOT 8
- JSON parser error with colon symbol HOT 7
- ScriptHandler crashs ADU HOT 3
- Question: How to make custom DTMI model private for ADU HOT 2
- Please provide `.deb` packages for Debian 11/12 armhf & arm64 HOT 6
- Device Update Agent attempting MQTT connection over TLSv1 HOT 2
- Device Update Free Edition HOT 1
- Device Update not applying due to lower case conversion of compat property HOT 7
- Device update group not created based on tags in DeviceTwin HOT 13
- Device not added in Azure Device Update Groups in IoT Hub HOT 5
- Cannot Install device update agent 1.0.3 beta version for Debian11 Arm64 on Debian 11.8 running on Raspberry Pi 4 HOT 1
- Configuration file deviceupdate-agent.service is marked executable HOT 7
- Yocto Rpi3 Device is restarting again and again in a loop HOT 2
- Failed parse of JSON file in Rpi4 device HOT 6
- /usr/bin/adu-swupdate.sh never runs (swupdate:2 never used even when registered?) HOT 7
- The packages deployed through device update are not reflecting in the device hosted on ubuntu 22.04 HOT 2
- Ignore duplicate deployment workflow not working as expected HOT 4
- Device reporting new Contract Name & ContractId after device update and stays inProgress in ADU HOT 9
- A/B Update Erases ADU Configuration on Yocto Kirkstone Raspberry Pi 4 - 64 bit Example
- A/B Update Fails on Yocto Kirkstone Raspberry Pi 4 - 64 bit Example do to invalid update image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot-hub-device-update.