Giter VIP home page Giter VIP logo

Comments (7)

KunYi avatar KunYi commented on September 24, 2024 1

@Voxel07 yes, but I work on an yocto recipes

if you use default build script to intall ADU agent,
the script will add group adu

install_adu_components() {
adu_lib_dir=/usr/lib/adu
adu_data_dir=/var/lib/adu
# Install adu components on this local development machine.
header "Installing ADU components..."
bullet "Create 'adu' user and 'adu' group..."
groupadd --system adu
useradd --system -p '' -g adu --no-create-home --shell /sbin/false adu
bullet "Add current user ('$USER') to 'adu' group, to allow launching adu-agent (for testing purposes only)"
usermod -a -G adu "$USER"
bullet "Current user info:"
id
copyfile_exit_if_failed "$output_directory/bin/AducIotAgent" /usr/bin
mkdir -p $adu_lib_dir
copyfile_exit_if_failed "$output_directory/bin/adu-shell" $adu_lib_dir
copyfile_exit_if_failed "$root_dir/src/adu-shell/scripts/adu-swupdate.sh" "$adu_lib_dir"
# Setup directories owner and/or permissions
# Logs directory
mkdir -p "$adu_log_dir"
chown adu:adu "$adu_log_dir"
chmod u=rwx,g=rx "$adu_log_dir"
# Data directory
mkdir -p "$adu_data_dir"
chown adu:adu "$adu_data_dir"
chmod u=rwx,g=rx "$adu_data_dir"
# Set the file permissions
chown root:adu "$adu_lib_dir/adu-shell"
chmod u=rwxs,g=rx,o= "$adu_lib_dir/adu-shell"
chmod u=rwx,g=rx,o=rx "$adu_lib_dir/adu-swupdate.sh"

and if to use .deb to install ADU agent
the package still add group adu by preinst(

add_adu_user_and_group() {
echo "Create the 'adu' group."
if ! getent group "$adu_group" > /dev/null; then
addgroup --system "$adu_group"
else
# For security purposes, it's extremely important that there's no existing 'adu' user and 'adu' group.
# This ensures the account and group are setup by our package installation process only,
# and no other actor can pre-create the user/group with nefarious intentions.
echo "Error: 'adu' group already exists." >&2
exit 1
fi
echo "Create the 'adu' user." # With no shell and no login, in 'adu' group.
if ! getent passwd "$adu_user" > /dev/null; then
adduser --system "$adu_user" --ingroup "$adu_group" --no-create-home --shell /bin/false
else
# For security purposes, it's extremely important that there's no existing 'adu' user and 'adu' group.
# This to ensures the account and group are setup by our package installation process only,
# and no other actor can pre-create the user/group with nefarious intentions.
echo "Error: 'adu' user already exists." >&2
exit 2
fi
echo "Add the 'adu' user to the 'syslog' group." # To allow ADU to write to /var/log folder
usermod -aG "syslog" "$adu_user"
}

from iot-hub-device-update.

KunYi avatar KunYi commented on September 24, 2024

update something log

when to update importManifest.json, adu-agent will start a job but still failed on download step with do-agent

adu-agent service

Mar 22 09:48:43 raspberrypi3 systemd[1]: Started Azure Device Update Agent daemon..
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3587Z [E] Failed to create content handler, updateType:(null) [IsInstalled]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3884Z [I] Agent (linux; 0.6.0-public-preview) starting. [main]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3884Z [I] Git Info: main:367b880 [main]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3885Z [I] Agent built with handlers: microsoft/swupdate. [main]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3886Z [W] Failed to set '/etc' folder permissions (expected:504, actual: 493) [ADUC_SystemUtils_MkDirRecursive]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3889Z [I] Initalizing PnP components. [ADUC_PnP_Components_Create]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3890Z [I] ADUC agent started. Using IoT Hub Client SDK 1.6.0 [AzureDeviceUpdateCoreInterface_Create]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3890Z [I] Calling ADUC_Register [ADUC_MethodCall_Register]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3890Z [I] IoTHub Device Twin callback registered. [ADUC_DeviceClient_Create]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3894Z [W] Failed to pass connection string to DO, error: -1 [StartupAgent]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:43.3894Z [I] Agent running. [main]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: -> 09:48:44 CONNECT | VER: 4 | KEEPALIVE: 240 | FLAGS: 192 | USERNAME: AduTestHub.azure-devices.net/RPI3B_ADU_TEST/?api-version=2020-09-30&DeviceClientTyp0
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: <- 09:48:44 CONNACK | SESSION_PRESENT: true | RETURN_CODE: 0x0
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:44.5557Z [D] IotHub connection status: 0, reason:6 [ADUC_ConnectionStatus_Callback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: -> 09:48:44 SUBSCRIBE | PACKET_ID: 2 | TOPIC_NAME: $iothub/twin/res/# | QOS: 0
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: <- 09:48:44 SUBACK | PACKET_ID: 2 | RETURN_CODE: 0
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: -> 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/GET/?$rid=3
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: <- 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/200/?$rid=3 | PAYLOAD_LEN: 790
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3584Z [D] ComponentName:azureDeviceUpdateAgent, propertyName:service [ADUC_PnP_ComponentClient_PropertyUpdate_Callback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3585Z [D] OrchestratorUpdateCallback received property JSON string ({"action":255,"updateManifest":"","updateManifestSignature":""}), ]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3585Z [I] Perform startup tasks. [ADUC_Workflow_HandleStartupWorkflowData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3586Z [I] Calling IsInstalledCallback to check if content is installed. [ADUC_MethodCall_IsInstalled]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3586Z [I] IsInstalledCallback called [IsInstalledCallback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3586Z [I] IsInstalled called workflowId: , installed criteria: (null) [IsInstalled]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3588Z [W] IsInstalled call failed. ExtendedResultCode: -536870781 - setting state to Idle [ADUC_Workflow_HandleStartupWorkflowData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3589Z [I] Setting UpdateState to Idle [ADUC_SetUpdateStateHelper]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3589Z [I] Reporting state: 0, Idle (0); HTTP 200; result 1, 0 [AzureDeviceUpdateCoreInterface_ReportStateAndResultAsync]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3590Z [I] UpdateAction: Idle. WorkflowId: 210322094845 [ADUC_MethodCall_Idle]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3591Z [I] Calling IdleCallback [ADUC_MethodCall_Idle]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3591Z [I] Now idle. workflowId: 210322094845 [Idle]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3592Z [I] OrchestratorPropertyUpdateCallback ended [OrchestratorUpdateCallback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3592Z [I] Processing existing Device Twin data after agent started. [ADUC_PnPDeviceTwin_Callback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3593Z [D] Notifies components that all callback are subscribed. [ADUC_PnPDeviceTwin_Callback]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3593Z [I] DeviceInformation component is ready - reporting properties [DeviceInfoInterface_Connected]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3595Z [I] Property manufacturer changed to UWINGS [RefreshDeviceInfoInterfaceData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3596Z [I] Property model changed to raspberrypi3 [RefreshDeviceInfoInterfaceData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3596Z [I] Property osName changed to Linux [RefreshDeviceInfoInterfaceData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3597Z [I] Property swVersion changed to 5.4.72-v7 [RefreshDeviceInfoInterfaceData]
Mar 22 09:48:45 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3597Z [I] Property processorArchitecture changed to armv7l [RefreshDeviceInfoInterfaceData]
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3748Z [I] Property processorManufacturer changed to ARM [RefreshDeviceInfoInterfaceData]
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3750Z [I] Property totalMemory changed to 946596 [RefreshDeviceInfoInterfaceData]
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: 2021-03-22T09:48:45.3751Z [I] Property totalStorage changed to 990784 [RefreshDeviceInfoInterfaceData]
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:48:45 SUBSCRIBE | PACKET_ID: 4 | TOPIC_NAME: $iothub/twin/PATCH/properties/desired/# | QOS: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=5 | PAYLOAD_LEN: 99
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=6 | PAYLOAD_LEN: 146
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=7 | PAYLOAD_LEN: 227
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:48:45 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=8 | PAYLOAD_LEN: 246
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:48:45 SUBACK | PACKET_ID: 4 | RETURN_CODE: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:48:46 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=5&$version=85 | PAYLOAD_LEN: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:48:46 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=6&$version=86 | PAYLOAD_LEN: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:48:46 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=8&$version=88 | PAYLOAD_LEN: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:48:46 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=7&$version=87 | PAYLOAD_LEN: 0
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:52:45 PINGREQ
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:52:46 PINGRESP
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 09:56:45 PINGREQ
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 09:56:46 PINGRESP
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: -> 10:00:45 PINGREQ
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 10:00:46 PINGRESP
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: <- 10:01:50 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/PATCH/properties/desired/?$version=4 | PAYLOAD_LEN: 319
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6579Z [D] ComponentName:azureDeviceUpdateAgent, propertyName:service [ADUC_PnP_ComponentClient_PropertyUpdate_Callback]
Mar 22 10:01:50 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6583Z [D] OrchestratorUpdateCallback received property JSON string ({"action":0,"updateManifest":"{\"manifestVersion\":\"2.0\",\"updat]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: ZEVvZnlZSGlWVlJoU0pwajBPUTE4ZWN1NERQWFYxVGN0MXkzazdMTGlvN244aXpLdXEybTNUeEY5dlBkcWI5TlA2U2M5LW15YXB0cGJGcEhlRmtVTC1GNXl0bF9VQkZLcHdOOUNMNHdwNnlaLWpkWE5hZ3]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6635Z [I] Processing 'Download' action [ADUC_Workflow_HandleUpdateAction]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6635Z [I] UpdateAction: Prepare - calling PrepareCallback [ADUC_MethodCall_Prepare]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6636Z [I] {210322094845} Received Metadata, UpdateType: microsoft/swupdate:1, UpdateTypeName: microsoft/swupdate, UpdateTypeVersion: 1]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6637Z [I] microsoft_swupdate_CreateFunc called. [microsoft_swupdate_CreateFunc]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6637Z [I] Prepare succeeded. [Prepare]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6638Z [I] UpdateAction: Download [ADUC_MethodCall_Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6638Z [I] Calling SandboxCreateCallback [ADUC_MethodCall_Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6640Z [I] Setting sandbox /tmp/aduc-dl-210322094845 [SandboxCreate]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6640Z [I] Using sandbox /tmp/aduc-dl-210322094845 [ADUC_MethodCall_Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6640Z [I] Setting UpdateState to DownloadStarted [ADUC_SetUpdateStateHelper]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6641Z [I] Calling DownloadCallback [ADUC_MethodCall_Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6641Z [I] Download thread started [DownloadCallback]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6644Z [D] Downloading 1 files to /tmp/aduc-dl-210322094845 [Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6646Z [I] OrchestratorPropertyUpdateCallback ended [OrchestratorUpdateCallback]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.6646Z [I] Downloading File 'adu-update-image-raspberrypi3.swu' from 'http://rpi3btest--adutest.b.nlu.dl.adu.microsoft.com/westus2/RPI3]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: -> 10:01:50 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=9 | PAYLOAD_LEN: 318
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9372Z [I] Caught DO exception, msg: unrecognized error, code: -2147024809 [Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9373Z [I] ProgressCallback: workflowId: 210322094845; Id 00000; State: Error; Bytes: 0/0 [DownloadProgressCallback]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9374Z [I] Download resultCode: 0, extendedCode: -804847529 [Download]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9375Z [I] Action 'Download' complete. Result: 0, -804847529 [ADUC_Workflow_WorkCompletionCallback]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9376Z [I] Setting UpdateState to Failed [ADUC_SetUpdateStateHelper]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: 2021-03-22T10:01:50.9376Z [I] Reporting state: 255, Failed (255); HTTP 500; result 0, -804847529 [AzureDeviceUpdateCoreInterface_ReportStateAndResultAsync]
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: -> 10:01:51 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=10 | PAYLOAD_LEN: 10
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: <- 10:01:51 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=9&$version=89 | PAYLOAD_LEN: 0
Mar 22 10:01:53 raspberrypi3 AducIotAgent[472]: <- 10:01:51 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=10&$version=90 | PAYLOAD_LEN: 0

Device Optimization log

root@raspberrypi3:/var/cache/deliveryoptimization-agent/log# cat do-agent.20200920_104411.log 
2020-09-20T10:44:11.7272841Z 270   270   info     {Run} Started, DU;deliveryoptimization-agent/v0.4.0+20210316.230533.713fe55 (main)
2021-03-22T10:01:50.9308269Z 270   275   info     {_TryRefresh} Read json config file /etc/deliveryoptimization-agent/admin-config.json
2021-03-22T10:01:50.9313631Z 270   275   info     {Download} 279b6452-b74d-7948-8b59-529a7954e19e, new download, url: http://rpi3btest--adutest.b.nlu.dl.adu.microsoft.com/westus2/RPI3BTest--adutest/5ddba84d6fc940878bd8f49fcecbf34b/adu-update-image-raspberrypi3.swu, dest: /tmp/aduc-dl-210322094845/adu-update-image-raspberrypi3.swu
2021-03-22T10:01:50.9314330Z 270   275   info     {GetProperty} 279b6452-b74d-7948-8b59-529a7954e19e, key: 0
2021-03-22T10:01:50.9344872Z 270   312   info     {ParseAndProcess} Download state change: 2
2021-03-22T10:01:50.9347259Z 270   273   trace    {_PerformStateChange} 279b6452-b74d-7948-8b59-529a7954e19e, state change request 0 --> 1
2021-03-22T10:01:50.9350182Z 270   273   error    {_Start} (hr:80070057) Error: 1, basic_ios::clear: iostream error, file: /tmp/aduc-dl-210322094845/adu-update-image-raspberrypi3.swu [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/download/download.cpp, 265]
2021-03-22T10:01:50.9352075Z 270   273   error    {operator()} (hr:80070057) DO failure: Error: 1, basic_ios::clear: iostream error, file: /tmp/aduc-dl-210322094845/adu-update-image-raspberrypi3.swu (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/download/download.cpp, 265], {E_INVALIDARG} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/threading/task_thread.cpp, 80]
2021-03-22T10:01:50.9353236Z 270   312   error    {SchedBlock} (hr:80070057) hr [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/threading/task_thread.cpp, 96]
2021-03-22T10:01:50.9354853Z 270   312   error    {Process} (hr:80070057) DO failure: (null) (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/threading/task_thread.cpp, 96], {hr} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/ipc/rest_api_request.cpp, 83]
2021-03-22T10:01:50.9355540Z 270   312   error    {operator()} (hr:80070057) apiRequest->Process(*_downloadManager, response) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 63]
2021-03-22T10:01:50.9358237Z 270   312   error    {operator()} (hr:80070057) DO failure: (null) (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 63], {apiRequest->Process(*_downloadManager, response)} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+713fe558a8-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 76]

from iot-hub-device-update.

jimson-msft avatar jimson-msft commented on September 24, 2024

Hi Kunyi, thanks for filing this feedback. In terms of download failure - it looks that path is invalid (though I'm not too sure why). I see that adu agent properly creates the download sandbox.

A couple diagnostic questions:
Is this a custom build of ADU/DO?
Are you running the processes as a daemon or as an executable? If you are running as an executable, what permission levels are you running each client as? (Sudo or user?)
If you can capture the file permissions of the download sandbox: /tmp/aduc-dl-210322094845/ by running command ls -l, we can verify what permissions that folder was created with.

I suspect that DO does not have permissions to write to that sandbox

from iot-hub-device-update.

KunYi avatar KunYi commented on September 24, 2024

Dear @jimson-msft

Thank your for your reply.
Yes. I try porting ADU/DO to my raspberry pi/yocto project

and from code and MSFT announce
I knew ADU run with user 'adu', group 'adu', do-client will start with root and drop permission change to user 'do', group 'do'
today I got the below information for your tips,
then to run 'usermod -aG adu do' for add user 'do' into adu group
and re-run all steps but sitll got same result

permission of tmp/aduc-dl-210323035041

root@raspberrypi3:/tmp# ls -l
total 0
drwxrwx--- 2 adu  adu  40 Mar 23 03:53 aduc-dl-210323035041
drwxr-xr-x 2 root root 40 Sep 20  2020 datadst
drwxr-xr-x 2 root root 40 Sep 20  2020 scripts
srw-rw-rw- 1 root root  0 Sep 20  2020 sockinstctrl
drwx------ 2 root root 60 Mar 23 03:49 ssh-3aUDMiRYP3
drwx------ 2 root root 60 Mar 23 03:49 ssh-98K1dcMqxj
srw-rw-rw- 1 root root  0 Sep 20  2020 swupdateprog
drwx------ 3 root root 60 Sep 20  2020 systemd-private-a90078568d954c17841d8849e5171884-ninfod.service-rMcW3i
drwx------ 3 root root 60 Sep 20  2020 systemd-private-a90078568d954c17841d8849e5171884-rdisc.service-48gsah
drwx------ 3 root root 60 Sep 20  2020 systemd-private-a90078568d954c17841d8849e5171884-systemd-logind.service-ZSAo6g
drwx------ 3 root root 60 Sep 20  2020 systemd-private-a90078568d954c17841d8849e5171884-systemd-timesyncd.service-KR4Zvj
root@raspberrypi3:/tmp# ls -al aduc-dl*
total 0
drwxrwx---  2 adu  adu   40 Mar 23 04:23 .
drwxrwxrwt 11 root root 260 Mar 23 04:23 ..

DO log

2021-03-23T03:53:18.8420763Z 325   329   trace    {_PerformStateChange} d6330944-2eb1-6547-834d-52b4839189f6, state change request 0 --> 1
2021-03-23T03:53:18.8423599Z 325   329   error    {_Start} (hr:80070057) Error: 1, basic_ios::clear: iostream error, file: /tmp/aduc-dl-210323035041/adu-update-image-raspberrypi3.swu [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/download/download.cpp, 265]
2021-03-23T03:53:18.8425368Z 325   329   error    {operator()} (hr:80070057) DO failure: Error: 1, basic_ios::clear: iostream error, file: /tmp/aduc-dl-210323035041/adu-update-image-raspberrypi3.swu (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/download/download.cpp, 265], {E_INVALIDARG} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/threading/task_thread.cpp, 80]
2021-03-23T03:53:18.8426635Z 325   366   error    {SchedBlock} (hr:80070057) hr [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/threading/task_thread.cpp, 96]
2021-03-23T03:53:18.8428076Z 325   366   error    {Process} (hr:80070057) DO failure: (null) (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/threading/task_thread.cpp, 96], {hr} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/ipc/rest_api_request.cpp, 83]
2021-03-23T03:53:18.8428756Z 325   366   error    {operator()} (hr:80070057) apiRequest->Process(*_downloadManager, response) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 63]
2021-03-23T03:53:18.8430939Z 325   366   error    {operator()} (hr:80070057) DO failure: (null) (hr:0x80070057) [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 63], {apiRequest->Process(*_downloadManager, response)} [/usr/src/debug/deliveryoptimization-agent/0.6.0+gitAUTOINC+b40eeacb27-r0/git/client-lite/src/ipc/rest_http_controller.cpp, 76]

/etc/group

root@raspberrypi3:/var/cache/deliveryoptimization-agent/log# cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
input:x:19:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
kvm:x:47:
staff:x:50:
games:x:60:
shutdown:x:70:
users:x:100:
systemd-bus-proxy:x:799:
adu:x:800:do
do:x:801:
systemd-timesync:x:990:
systemd-resolve:x:991:
systemd-network:x:992:
systemd-journal:x:993:
avahi:x:994:
messagebus:x:995:
rpcuser:x:996:
sshd:x:997:
crontab:x:998:
rpc:x:999:
tracing:x:1000:
nogroup:x:65534:
wheel:x:989:
render:x:988:
nobody:x:987:

from iot-hub-device-update.

KunYi avatar KunYi commented on September 24, 2024

@jimson-msft

current we can to complete "Download" when run 'usermod -aG adu do' and reboot the system
but stop on next action "install "

we can observer pid 304 for origin ADU service and create child process(pid:422) for install
but the child process like dead
image

===

2021-03-23T04:36:24.1261Z [I] Calling DownloadCallback [ADUC_MethodCall_Download]
2021-03-23T04:36:24.1261Z [I] Download thread started [DownloadCallback]
2021-03-23T04:36:24.1264Z [D] Downloading 1 files to /tmp/aduc-dl-210323043047 [Download]
2021-03-23T04:36:24.1265Z [I] OrchestratorPropertyUpdateCallback ended [OrchestratorUpdateCallback]
2021-03-23T04:36:24.1265Z [I] Downloading File 'adu-update-image-raspberrypi3.swu' from 'http://rpi3btest--adutest.b.nlu.dl.adu.microsoft.com/westus2/RPI3BTest--adutest/5ddba84d6fc940878bd8f49fcecbf34b/a
du-update-image-raspberrypi3.swu' to '/tmp/aduc-dl-210323043047/adu-update-image-raspberrypi3.swu' [Download]
2021-03-23T04:37:12.3290Z [I] Validating file hash [Download]
2021-03-23T04:37:20.9261Z [I] microsoft_swupdate_CreateFunc called. [microsoft_swupdate_CreateFunc]
2021-03-23T04:37:20.9262Z [I] Download called - no-op for swupdate [Download]
2021-03-23T04:37:20.9262Z [I] Content Handler Download resultCode: 1, extendedCode: 0 [Download]
2021-03-23T04:37:20.9262Z [I] ProgressCallback: workflowId: 210323043047; Id 00000; State: Completed; Bytes: 98630656/98630656 [DownloadProgressCallback]
2021-03-23T04:37:20.9263Z [I] Download resultCode: 1, extendedCode: 0 [Download]
2021-03-23T04:37:20.9263Z [I] Action 'Download' complete. Result: 1, 0 [ADUC_Workflow_WorkCompletionCallback]
2021-03-23T04:37:20.9263Z [I] WorkCompletionCallback: Download succeeded. Going to state DownloadSucceeded [ADUC_Workflow_WorkCompletionCallback]
2021-03-23T04:37:20.9263Z [I] Setting UpdateState to DownloadSucceeded [ADUC_SetUpdateStateHelper]
2021-03-23T04:37:20.9264Z [I] Reporting state: DownloadSucceeded (2) [AzureDeviceUpdateCoreInterface_ReportStateAndResultAsync]
2021-03-23T04:37:23.8319Z [D] ComponentName:azureDeviceUpdateAgent, propertyName:service [ADUC_PnP_ComponentClient_PropertyUpdate_Callback]
2021-03-23T04:37:23.8322Z [D] OrchestratorUpdateCallback received property JSON string ({"action":1,"updateManifest":"{\"manifestVersion\":\"2.0\",\"updateId\":{\"provider\":\"UWINGSUpdate\",\"name\":\"r
aspberrypi3b\",\"version\":\"0.0.2\"},\"updateType\":\"microsoft\/swupdate:1\",\"installedCriteria\":\"0.0.2\",\"files\":{\"00000\":{\"fileName\":\"adu-update-image-raspberrypi3.swu\",\"sizeInBytes\":986
30656,\"hashes\":{\"sha2 [OrchestratorUpdateCallback]
2021-03-23T04:37:23.8375Z [I] Processing 'Install' action [ADUC_Workflow_HandleUpdateAction]
2021-03-23T04:37:23.8375Z [I] UpdateAction: Install [ADUC_MethodCall_Install]
2021-03-23T04:37:23.8375Z [I] Setting UpdateState to InstallStarted [ADUC_SetUpdateStateHelper]
2021-03-23T04:37:23.8375Z [I] Calling InstallCallback [ADUC_MethodCall_Install]
2021-03-23T04:37:23.8376Z [I] Install thread started [InstallCallback]
2021-03-23T04:37:23.8377Z [I] Installing from /tmp/aduc-dl-210323043047 [Install]
2021-03-23T04:37:23.8379Z [I] Installing image file: adu-update-image-raspberrypi3.swu [Install]
2021-03-23T04:37:23.8379Z [I] OrchestratorPropertyUpdateCallback ended [OrchestratorUpdateCallback]

and when run 'kill -9 422'
ADU will show the below message

Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: 2021-03-23T05:55:31.4488Z [I] Child process terminated, signal 9 [ADUC_LaunchChildProcess]
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: 2021-03-23T05:55:31.4547Z [I] Action 'Install' complete. Result: 0, 9 [ADUC_Workflow_WorkCompletionCallback]
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: 2021-03-23T05:55:31.4548Z [I] Setting UpdateState to Failed [ADUC_SetUpdateStateHelper]
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: 2021-03-23T05:55:31.4548Z [I] Reporting state: 255, Failed (255); HTTP 500; result 0, 9 [AzureDeviceUpdateCoreInterface_ReportStateAndResultAsync]
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: -> 05:55:31 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=15 | PAYLOAD_LEN: 101
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: <- 05:55:32 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=15&$version=161 | PAYLOAD_LEN: 0
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: <- 05:55:36 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/PATCH/properties/desired/?$version=31 | PAYLOAD_LEN: 126
Mar 23 05:55:36 raspberrypi3 AducIotAgent[304]: 2021-03-23T05:55:36.5620Z [D] ComponentName:azureDeviceUpdateAgent, propertyName:service [ADUC_PnP_ComponentClient_PropertyUpdate_Callback]

from iot-hub-device-update.

KunYi avatar KunYi commented on September 24, 2024

update success now

the install bug still file permission issues
when change /usr/lib/adu/adu-shell to adu group and chmod u+s
will got success result

root@raspberrypi3:/usr/lib/adu# ls -al
total 60
drwxr-xr-x  2 root root  4096 Mar  9  2018 .
drwxr-xr-x 28 root root 16384 Mar  9  2018 ..
-rwxr-x---  1 root adu  34524 Mar  9  2018 adu-shell
-rwxr-x---  1 root root  3911 Mar  9  2018 adu-swupdate.sh
root@raspberrypi3:/usr/lib/adu# chgrp adu adu-shell
root@raspberrypi3:/usr/lib/adu# chmod u+s adu-shell
root@raspberrypi3:/usr/lib/adu# ls -al
total 60
drwxr-xr-x  2 root root  4096 Mar  9  2018 .
drwxr-xr-x 28 root root 16384 Mar  9  2018 ..
-rwsr-x---  1 root adu  34524 Mar  9  2018 adu-shell
-rwxr-x---  1 root root  3911 Mar  9  2018 adu-swupdate.sh

root       440  0.0  0.1  14604  1044 ?        Sl   09:07   0:00 /usr/lib/adu/adu-shell --update-type microsoft/swupdate --update-action install --target-data /tmp/aduc-dl-210323083737/adu-update-image-r
root       442  0.0  0.1   2500  1868 ?        S    09:07   0:00 /bin/bash /usr/lib/adu/adu-swupdate.sh -l /adu/logs -i /tmp/aduc-dl-210323083737/adu-update-image-raspberrypi3.swu
root       449 93.1  0.8  49128  7912 ?        Dl   09:07   0:14 swupdate -v -i /tmp/aduc-dl-210323083737/adu-update-image-raspberrypi3.swu -k /adukey/public.pem -e stable copy2

image

from iot-hub-device-update.

Voxel07 avatar Voxel07 commented on September 24, 2024

@KunYi did you create the adu group by yourselves ? Because I don't have one. Just the do group.
When installing the DO Agent I can clearly see that the do group is being added. This log is missing when I'm installing the ADU Agent.

from iot-hub-device-update.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.