Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building on a raspberry 4 #38

Closed
arlotito opened this issue Apr 12, 2021 · 20 comments
Closed

building on a raspberry 4 #38

arlotito opened this issue Apr 12, 2021 · 20 comments

Comments

@arlotito
Copy link

Hi,
I'm building the agent on a raspberry pi 4 with the raspberry OS 32bit (which is based on debian 10 buster) as per the docs, i.e.:

sudo ./scripts/install-deps.sh -a
sudo ./scripts/build.sh -c -p linux --provision-with-iotedge --content-handlers microsoft/apt --build-packages
sudo cmake --build out --target install

Then I manually run the agent:

sudo AducIotAgent -l 0 -e

and I get some warnings/errors (highlighted below) as such as:

  • Failed to pass connection string to DO
  • Failed to create content handler, updateType:(null)
  • IsInstalled call failed. ExtendedResultCode: -536870781

What am I missing? Thanks!

Here's the full log:

pi@raspberrypi:~ $ sudo AducIotAgent -l 0 -e
2021-04-12T14:40:02.4598Z [I] Agent (linux; 0.6.0-public-preview) starting. [main]
2021-04-12T14:40:02.4598Z [I] Git Info: main:7a6e4c1 [main]
2021-04-12T14:40:02.4599Z [I] Agent built with handlers: microsoft/apt. [main]
2021-04-12T14:40:02.4600Z [I] Requesting connection string from the Edge Identity Service [GetConnectionInfoFromIdentityService]
2021-04-12T14:40:02.4632Z [I] Initalizing PnP components. [ADUC_PnP_Components_Create]
2021-04-12T14:40:02.4632Z [I] ADUC agent started. Using IoT Hub Client SDK 1.6.0 [AzureDeviceUpdateCoreInterface_Create]
2021-04-12T14:40:02.4633Z [I] Calling ADUC_Register [ADUC_MethodCall_Register]
2021-04-12T14:40:02.4633Z [I] IoTHub Device Twin callback registered. [ADUC_DeviceClient_Create]
2021-04-12T14:40:02.4638Z [W] Failed to pass connection string to DO, error: -1 [StartupAgent]
2021-04-12T14:40:02.4638Z [I] Agent running. [main]
-> 15:40:03 CONNECT | VER: 4 | KEEPALIVE: 240 | FLAGS: 192 | USERNAME: arturol76.azure-devices.net/home-rpi4-2/?api-version=2020-09-30&DeviceClientTy pe=iothubclient%2f1.6.0%20(native%3b%20Linux%3b%20armv7l)&model-id=dtmi%3aAzureDeviceUpdate%3b1 | PWD: XXXX | CLEAN: 0
<- 15:40:03 CONNACK | SESSION_PRESENT: true | RETURN_CODE: 0x0
2021-04-12T14:40:03.6591Z [D] IotHub connection status: 0, reason:6 [ADUC_ConnectionStatus_Callback]
-> 15:40:03 SUBSCRIBE | PACKET_ID: 2 | TOPIC_NAME: $iothub/twin/res/# | QOS: 0
<- 15:40:03 SUBACK | PACKET_ID: 2 | RETURN_CODE: 0
-> 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/GET/?$rid=3
<- 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/200/?$rid=3 | PAYLOAD_LEN: 756
2021-04-12T14:40:04.1628Z [D] ComponentName:azureDeviceUpdateAgent, propertyName:service [ADUC_PnP_ComponentClient_PropertyUpdate_Callback]
2021-04-12T14:40:04.1629Z [D] OrchestratorUpdateCallback received property JSON string ({"action":255,"updateManifest":"","updateManifestSignature":" "}), property version (3) [OrchestratorUpdateCallback]
2021-04-12T14:40:04.1630Z [I] Perform startup tasks. [ADUC_Workflow_HandleStartupWorkflowData]
2021-04-12T14:40:04.1630Z [I] Calling IsInstalledCallback to check if content is installed. [ADUC_MethodCall_IsInstalled]
2021-04-12T14:40:04.1631Z [I] IsInstalledCallback called [IsInstalledCallback]
2021-04-12T14:40:04.1631Z [I] IsInstalled called workflowId: , installed criteria: (null) [IsInstalled]
2021-04-12T14:40:04.1633Z [E] Failed to create content handler, updateType:(null) [IsInstalled]
2021-04-12T14:40:04.1634Z [W] IsInstalled call failed. ExtendedResultCode: -536870781 - setting state to Idle [ADUC_Workflow_HandleStartupWorkflowData]
2021-04-12T14:40:04.1634Z [I] Setting UpdateState to Idle [ADUC_SetUpdateStateHelper]
2021-04-12T14:40:04.1635Z [I] Reporting state: 0, Idle (0); HTTP 200; result 1, 0 [AzureDeviceUpdateCoreInterface_ReportStateAndResultAsync]
2021-04-12T14:40:04.1636Z [I] UpdateAction: Idle. WorkflowId: 210412144004 [ADUC_MethodCall_Idle]
2021-04-12T14:40:04.1637Z [I] Calling IdleCallback [ADUC_MethodCall_Idle]
2021-04-12T14:40:04.1637Z [I] Now idle. workflowId: 210412144004 [Idle]
2021-04-12T14:40:04.1638Z [I] OrchestratorPropertyUpdateCallback ended [OrchestratorUpdateCallback]
2021-04-12T14:40:04.1639Z [I] Processing existing Device Twin data after agent started. [ADUC_PnPDeviceTwin_Callback]
2021-04-12T14:40:04.1639Z [D] Notifies components that all callback are subscribed. [ADUC_PnPDeviceTwin_Callback]
2021-04-12T14:40:04.1640Z [I] DeviceInformation component is ready - reporting properties [DeviceInfoInterface_Connected]
2021-04-12T14:40:04.1642Z [I] Property manufacturer changed to Contoso [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1643Z [I] Property model changed to Virtual-Machine [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1644Z [I] Property osName changed to Linux [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1645Z [I] Property swVersion changed to 5.10.17-v7l- [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1646Z [I] Property processorArchitecture changed to armv7l [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1856Z [I] Property processorManufacturer changed to ARM [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1858Z [I] Property totalMemory changed to 3868956 [RefreshDeviceInfoInterfaceData]
2021-04-12T14:40:04.1860Z [I] Property totalStorage changed to 1856980 [RefreshDeviceInfoInterfaceData]
-> 15:40:04 SUBSCRIBE | PACKET_ID: 4 | TOPIC_NAME: $iothub/twin/PATCH/properties/desired/# | QOS: 0
<- 15:40:04 SUBACK | PACKET_ID: 4 | RETURN_CODE: 0
-> 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=5 | PAYLOAD_LE N: 99
-> 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=6 | PAYLOAD_LE N: 146
-> 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=7 | PAYLOAD_LE N: 236
-> 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE | TOPIC_NAME: $iothub/twin/PATCH/properties/reported/?$rid=8 | PAYLOAD_LE N: 202
<- 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=8&$version=98 | PAYLOAD_LEN: 0
<- 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=7&$version=97 | PAYLOAD_LEN: 0
<- 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=6&$version=96 | PAYLOAD_LEN: 0
<- 15:40:04 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: QOS_VALUE_INVALID | TOPIC_NAME: $iothub/twin/res/204/?$rid=5&$version=95 | PAYLOAD_LEN: 0
-> 15:44:04 PINGREQ
<- 15:44:04 PINGRESP
-> 15:48:04 PINGREQ
<- 15:48:04 PINGRESP
-> 15:52:04 PINGREQ
<- 15:52:04 PINGRESP
-> 15:56:04 PINGREQ
<- 15:56:04 PINGRESP
-> 16:00:04 PINGREQ
<- 16:00:04 PINGRESP

@Voxel07
Copy link

Voxel07 commented Apr 14, 2021

Maybe I am wrong, but you didn't provide a connection string like it´s mentioned here

AducIotAgent 'IoT device connection string' [options...]

don't forget the ' ' before and after your string.

Edit: I just noticed that git doesn't show the text when it's enclosed in <> so maybe that's why there is no string display in your command.

@arlotito
Copy link
Author

thanks @Voxel07.

Actually I built the agent with the "--provision-with-iotedge" flag, which allows the agent for automatically getting the conn string from the edge identity service (i have an iot edge 1.2 already provisioned and running), without the need for passing it as a parameter.
That's confirmed by the log:
2021-04-12T14:40:02.4600Z [I] Requesting connection string from the Edge Identity Service [GetConnectionInfoFromIdentityService]

I'm sure that the agent got a proper conn string and connected to the iot hub, as the device twin is properly updated with the reported properties.

Then, looking at the warning:
2021-04-12T14:40:02.4638Z [W] Failed to pass connection string to DO, error: -1 [StartupAgent]
...my guess is that there are issues with the Delivery Optimization (DO) agent, and not with the conn string itself.

Does it make sense?

@Voxel07
Copy link

Voxel07 commented Apr 14, 2021

I'm quite new to this whole thing and I have to port everything to Fedora before testing something. At the moment I'm not able to add to compile the DO Agent, and I'm not able to pares additional arguments to the Adu Agent. I filed an issue here, maybe @arlotito you can help me over there.
After reading the log, I came to the same conclusion as you, but unfortunately I'm not able to test this at the moment.

@ValOlson
Copy link
Contributor

@arlotito thank you for your question.

Responding to the questions on the original thread first to see if it unblocks you and @Voxel07:

  1. Failed to pass connection string to DO
  • This warning can be ignored. It is only relevant if you are testing devices in a disconnected environment using Microsoft Connected Cache.
  1. Failed to create content handler, updateType:(null)
  • This warning can be ignored as well.
  1. IsInstalled call failed. ExtendedResultCode: -536870781
  • Details about this error can be found here.
  • If you’re running the AducIotAgent at any point, please note that the agent must be run as ‘adu’ user. Otherwise, you’ll run into permission-related issue.

@arlotito
Copy link
Author

Thanks @ValOlson.

regarding the error: from here I understand that -536870781 is Error Code = 0x83.

But then where to get info around such error code 0x83?
Maybe this table? But it's missing the dec/hex error code column besides the string literal...

or maybe I should look at the link below, which seems to be broken?
image

Thanks!

@Jerry-GeGarcia
Copy link

Jerry-GeGarcia commented Apr 14, 2021

Hi @arlotito,

-536870781 in HEX is: E0000083, where the facility code of that ExtendedResultCode maps to a standard errno (defined in errno.h and errno-base.h).

Thanks for pointing out the broken link, we'll take care of that and expand on details like the above in our documentation.

@Voxel07
Copy link

Voxel07 commented Apr 19, 2021

I switched form fedora to Ubuntu to minimize the possible errors. I have successfully built and installed the agent. But when running it I get the same error msg as @arlotito.

I think my problem is related to the failed test im getting when running the do-agent tests mentioned in this issue.

@ValOlson mentioned running the agent as the 'adu' user. Can you link the Documentation, where this is mentioned and how this user has to be set up.

@ValOlson
Copy link
Contributor

ValOlson commented Apr 24, 2021

Hello @arlotito and @Voxel07,

We will be adding the below to our documentation 'How to run the Device Update Agent', in the meanwhile let us know if the below steps worked for you:

  1. Create 'adu' group and 'adu' user by follow these steps:

(Add 'adu' group):
sudo addgroup --system "adu"
(Add 'adu' user (with no shell, and no login)):
sudo adduser --system "adu" --ingroup "adu" --no-create-home --shell /bin/false
(Add 'adu' user to the 'syslog' group to allow the Agent to write to /var/log folder):
sudo usermod -aG "syslog" "adu"
(Add 'adu' user to the 'do' group to allow access to delivery optimization resources):
sudo usermod -aG "do" "adu"

  1. Set adu-shell file permissions to perform download and install tasks with "root" privilege

(Note: Install adu-shell to /usr/lib/adu/ directory before running following commands):
sudo chown "root:adu" "/usr/lib/adu/adu-shell"
sudo chmod u=rxs "/usr/lib/adu/adu-shell"
(Optional: If 'setfacl' command is available):
sudo setfacl -m "group::---" "/usr/lib/adu/adu-shell"
sudo setfacl -m "user::r--" "/usr/lib/adu/adu-shell"
sudo setfacl -m "user:adu:r-x" "/usr/lib/adu/adu-shell"

@Voxel07
Copy link

Voxel07 commented Apr 26, 2021

@ValOlson That's roughly what I have done, except the Optional part, but I deleted everything and set it up exactly the same way.

User and Groups

matthias@matthias-VirtualBox:/var/cache$ cat etc/passwd
do:x:129:adu
adu:x:998:
matthias@matthias-VirtualBox:/var/cache$ cat /etc/passwd
do:x:122:129::/home/do:/bin/false
adu:x:123:998::/home/adu:/bin/false

Permissions

matthias@matthias-VirtualBox:~/Desktop/azure$ sudo ls -ld /var/log/adu 
drwxr-x--- 2 adu adu 4096 Apr 26 09:48 /var/log/adu
matthias@matthias-VirtualBox:/tmp$ ls -ld aduc-dl-210426074003/
drwxrwx--- 2 adu adu 4096 Apr 26 09:40 aduc-dl-210426074003/
matthias@matthias-VirtualBox:/tmp$ sudo ls -la aduc-dl-210426095427/
total 8
drwxrwx---  2 adu  adu  4096 Apr 26 11:54 .
drwxrwxrwt 17 root root 4096 Apr 26 11:55 ..
matthias@matthias-VirtualBox:/usr/lib/adu$ ll -a
total 1084
drwxr-xr-x    2 root root    4096 Apr 22 11:58 ./
drwxr-xr-x  126 root root    4096 Apr 23 14:11 ../
-r-Sr-x---+   1 root adu  1094928 Apr 26 08:19 adu-shell*
-rwxr-xr-x    1 root root    3911 Apr 26 08:19 adu-swupdate.sh*
matthias@matthias-VirtualBox:/usr/lib/adu$ ll -a
total 1084
drwxr-xr-x    2 root root    4096 Apr 22 11:58 ./
drwxr-xr-x  126 root root    4096 Apr 23 14:11 ../
-r-Sr-x---+   1 root adu  1094928 Apr 26 08:19 adu-shell*
-rwxr-xr-x    1 root root    3911 Apr 26 08:19 adu-swupdate.sh*

For some reason again in

matthias@matthias-VirtualBox:/usr/local/lib/adu$ ll -a
total 1084
drwxr-xr-x    2 root root    4096 Apr 22 11:58 ./
drwxr-xr-x  126 root root    4096 Apr 23 14:11 ../
-r-Sr-x---+   1 root root    1094928 Apr 26 08:19 adu-shell*
-rwxr-xr-x    1 root root    3911 Apr 26 08:19 adu-swupdate.sh*
matthias@matthias-VirtualBox:/var/cache$ ll -ld deliveryoptimization-agent/
drwxrwxr-x 3 do do 4096 Apr 22 09:13 deliveryoptimization-agent//

When running the agent with:

matthias@matthias-VirtualBox:~/Desktop/azure/do-client$ sudo -H -u adu bash -c AducIotAgent

I'm still getting the same error as in my other issue

I'm not sure how to validate if do is running as do user. But that might be the issue, because after setting the rights up this way no error log is being created by do. I had this happen in the past, and I'm not sure why.

But the Do user is allowed to write to tmp/aduc-..

matthias@matthias-VirtualBox:/tmp$ sudo -H -u adu bash -c 'mkdir aduc-dl-210426124154/test'
matthias@matthias-VirtualBox:/tmp$ sudo -H -u do bash -c 'mkdir aduc-dl-210426124154/test2'
matthias@matthias-VirtualBox:/tmp$ sudo ls -la aduc-dl-210426124154
total 16
drwxrwx--- 4 adu adu 4096 Apr 26 16:06 .
drwxrwxrwt 20 root root 4096 Apr 26 16:04 ..
drwxr-xr-x 2 adu adu 4096 Apr 26 16:06 test
drwxr-xr-x 2 do do 4096 Apr 26 16:06 test2

@Nox-MSFT
Copy link
Contributor

@arlotito, you've mentioned that the Agent successfully reported its properties to the Device Twin. Could you please share what what the Agent reported please (resultCode, extendedResultCode, state, etc.)

@ValOlson
Copy link
Contributor

Just some additional details, here are the updated instructions on how to create 'adu' user and group that includes the DO agent.

@Voxel07
Copy link

Voxel07 commented Apr 28, 2021

  • If I am looking at this correctly then this is (at least in my case) is not a permission problem. I get this error when a previous update failed and there is no active deployment for this device, and when starting up the agent. The call is successful after the agent entered the Idle mode once.

Please correct me if this is wrong. Thanks.

  • If I followed the steps taken by the agent correctly then the missing value in updateType should be stored in the device twin. When the previous update failed this part is removed from the device twin, so this info will always be null.

I'm not sure why the agent is looking for this when there is no deployment ready, but maybe @ValOlson can clarify this.

@Nox-MSFT
Copy link
Contributor

@Voxel07 ,

If you're referring to this error:

2021-04-12T14:40:04.1629Z [D] OrchestratorUpdateCallback received property JSON string ({"action":255,"updateManifest":"","updateManifestSignature":" "}), property version (3) [OrchestratorUpdateCallback]
2021-04-12T14:40:04.1630Z [I] Perform startup tasks. [ADUC_Workflow_HandleStartupWorkflowData]
2021-04-12T14:40:04.1630Z [I] Calling IsInstalledCallback to check if content is installed. [ADUC_MethodCall_IsInstalled]
2021-04-12T14:40:04.1631Z [I] IsInstalledCallback called [IsInstalledCallback]
2021-04-12T14:40:04.1631Z [I] IsInstalled called workflowId: , installed criteria: (null) [IsInstalled]
2021-04-12T14:40:04.1633Z [E] Failed to create content handler, updateType:(null) [IsInstalled]
2021-04-12T14:40:04.1634Z [W] IsInstalled call failed. ExtendedResultCode: -536870781 - setting state to Idle [ADUC_Workflow_HandleStartupWorkflowData]

This is expected because the current action is "255" which is "Cancel". This action doesn't contains any update data.
We can change our workflow code to skip 'isInstalled' check to avoid this confusion in the future.

@Voxel07
Copy link

Voxel07 commented Apr 28, 2021

@jimson-msft I was referring to this error. Thanks for clarifying. A change would be appreciated, especially because the [E] error was confusing at first.

@SaraOlsson
Copy link

Hi, I would be very thankful if someone would like to list the commands needed to set up the adu-agent for APT updates on Raspberry PI 4. I've tried several times flashing a new SD-card, installing IoT Edge 1.2 (following this guide) and building the adu-agent.

The agent keeps restarting and I get error as: Could not create directory /var/lib/adu
I've tried to follow the added guide about adding "adu" as an user, add to group etc. However, I get stuck on steps like I have "no group named syslog" or "do" and "Failed to restart deliveryoptimization-agent.service: Unit deliveryoptimization-agent.service not found" (shouldn't it be installed along with install-deps.sh -a ?). I've tried to add permissions and groups manually etc but it still does not work and I it does not feel good to deviate from the intended installation process.

What I do:

  1. flash sd card with Raspberry OS arm32
  2. install IoT Edge 1.2 with this guide (provision with symmetric keys)
  3. clone this repo to Documents folder on Raspberry.
  4. from here, I've both tried
    • same steps as @arlotito
    • enable and start the adu-agent service with systemctl, and enter device connection string with AducIotAgent ''

Also wondering:
q1. if I install with sudo cmake --build out --target install, then I should not touch the .deb file?
q2. what is the best command to see the logs from the adu-agent? I know I can run systemctl status adu-agent but I also see logs with AducIotAgent but if I got that correct this command also restarts the AducIotAgent?

Many thanks,

@ValOlson
Copy link
Contributor

ValOlson commented May 3, 2021

Hello @SaraOlsson,

  1. Does your Raspberry Pi 4 device have an OS/architectures in this list of supported Delivery Optimization ("do") OS/architectures? Device Update and Delivery Optimization does not officially support Raspberry Pi 4 yet and all our validations were done on Raspberry Pi B3+.

  2. For errors with installation of components, as pre-requisite to run the Device Update agent please do the following

  1. For adu-agent logs please refer to this guidance. APT is used for the Device Update packaged client so you can use those commands.

Thanks!

@SaraOlsson
Copy link

Hi @ValOlson,

  1. yes the device runs Debian 10 (arm32).
  2. okay, however, my question remains: isn't the "do" installed when running install-deps.sh -a which is the first step for installing Device Update agent? I can see the do-client repo being cloned there as well, or what is the difference?
  3. ok thanks!

When I tried to install Delivery Optimization SDK:
`

cd (to working directory of your choosing)
git clone https://github.com/microsoft/do-client
cd build/bootstrap
sudo ./bootstrap-debian-10.sh -c
it runs until Build files have been written to: /tmp/cpprestsdk/build
but is then stuck at [1/29] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o

If I get the above bootstrap step to work, I would run:

python3 build/build.py --project agent --package-for deb
`

@jimson-msft
Copy link

jimson-msft commented May 4, 2021

Hi @SaraOlsson, the DO SDK is the only piece installed when running install-deps.sh -a. At runtime, the deliveryoptimization (DO) agent is also required. The plugin-apt is an additional component which will route apt's download requests through DO.

I think this is a good signal that we may want to consider adding the build and install of the deliveryoptimization agent as a part of the install-deps.sh script.

In regards to you following the instructions on the DO github page, that's pretty odd that it gets hung on that step. The cpprest build does take awhile - did you ever see it complete?

Yes, if you complete installing the DO dependencies, then you can run our python script to build a debian package, and install our agent that way. Another alternative is to do a cmake build & install, similar to what's being done by the DU install-deps.sh script.

@arlotito
Copy link
Author

Hi @ValOlson, @Nox-MSFT,
I finally managed to build and run the DO-client and ADU-agent on both RPI3B+ and RPI4, using a Raspberry OS 32bit Lite with an IoT Edge 1.2 as starting point.

DO Client

I built the debian packages as per here.
That went smoothly.

ADU Agent

As per here:

sudo ./scripts/install-deps.sh -a
sudo ./scripts/build.sh -c -p linux --provision-with-iotedge --content-handlers microsoft/apt --build-packages

...and you get the 'deviceupdate-agent-0.6.0-public-preview-Linux.deb' package.

The installation is the tricky part now.

If you install by sudo cmake --build out --target install as suggested in the docs, you have then to manually add the user, adjust the permissions (as per @ValOlson' suggestion)... and it fails anyway (at least in my case, both on rpi3 and rpi4).

The solution is installing via the debian package, and not via cmake.

But before installing the package, you have to fix a couple of issues:

  • add the 'syslog' group (because the adu client will assign the 'adu' user to such group to get r/w permissions to /var/log)

    sudo addgroup --system "syslog"
    

    WARNING: this is a quick&dirty workaround just to complete the installation. Proper solution has to be defined.
    Without doing this, you will get this error when trying to install the adu client .deb package:
    image

  • install 'acl'

    sudo apt install acl
    

    Without this, you'll get this errer when installing the adu client .deb package:
    image

Now you can install the debian package:

sudo apt-get install ./deviceupdate-agent-0.6.0-public-preview-Linux.deb

...and this is what you get:
image

As you can see, it creates all the required users.

Then you restart the agent:

sudo apt-get install ./deviceupdate-agent-0.6.0-public-preview-Linux.deb

...and if you deploy an update, it will work!
image

Summary

  • build and install DO client as per here
  • build and install ADU agent as follows:
sudo ./scripts/install-deps.sh -a
sudo ./scripts/build.sh -c -p linux --provision-with-iotedge --content-handlers microsoft/apt --build-packages
sudo addgroup --system "syslog"
sudo apt install acl
sudo apt-get install ./deviceupdate-agent-0.6.0-public-preview-Linux.deb

If you like, I can share:

  • pre-built deb packages for both do-client and adu agent
  • img.xz embedding iot edge 1.2 and do/adu, ready to be flashed on a RPI3/4

@ValOlson
Copy link
Contributor

ValOlson commented May 13, 2021

Hi @arlotito,

Thank you for sharing details of your solution, we really appreciate it. For privacy reasons we do not want you to share your binaries with us, but we encourage the community to contribute to our GitHub repo by creating a branch and a pull request with adu-client as the approver. Our engineering team will be happy to review it and we can consider adding it as part of the solution in upcoming releases as well.

shiyi-peng pushed a commit that referenced this issue May 24, 2021
* Squashed commit of the following:

commit f6026697c567ea260e296bf9260db94713e231b0
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Thu Apr 23 17:17:23 2020 -0700

    Refactor IsInstalled() logic. Make Sandbox’s permission RWX. Consume libdocsdk.so (#76)

    Fixed bug where DSMHandler::IsInstalled() throw after failed to create a plugin, due to missing DSM file in Sadbox folder.

    Refactor how we handle the case where DSM file is missing.

    Will revisit DSMHandler design after private preview.

    Also link to libdocsdk.so instead of libdocsdk.a to avoid binary mismatch issue.

    Bugs

    Bug 25997916: Deployment to ADU Client fails at IsInstalled with unhandled exception [callresultmethodandhandleexceptions]

    Bug 26013591: ADU client need to use new DO-SDK version (may also need to update build pipeline)

commit 5ee97f6e32bc5b8ed101bbc8d3c136ed386c9468
Author: Nicholas Hemstreet <62158276+nihemstr@users.noreply.github.com>
Date:   Wed Apr 22 15:29:33 2020 -0700

    ReadConnectionStrFromFile will only return buffer insufficient if the… (#77)

    * ReadConnectionStrFromFile will only return buffer insufficient if the first line cannot be entirely read from the file

    * Updated method for checking buffer overflow and changed some character lines

    * Removed needless removal of the flag

commit dbf83a9123d97e8c4d0310491070854627ec8fa3
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Tue Apr 14 22:15:05 2020 -0700

    Include libcpprest in dependencies list (#75)

commit 349c8ebfbb2834db8c200caa7b86983d9c7e3ce8
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Mon Apr 13 17:56:01 2020 -0700

    Write swupdate logs to same folder as client + image doc updates. (#73)

    * Updating adu_install.sh with log option

    * Updating adu_install with log_dir

    * Fixing shellcheck errors

    * Fixing issue with missing -l option

    * Updating docs

    * Addressing PR feedback

    Co-authored-by: Casey Irvine <casey.d.irvine@gmail.com>

commit 2fd1f7594d32388a0dfadfdccafaa64a5d0d3b6b
Author: Carmen Forsmann <cmforsmann@live.com>
Date:   Mon Apr 13 16:03:42 2020 -0700

    Update desired-state-manifest.md broken images (#74)

    * Update desired-state-manifest.md

    * Update desired-state-manifest.md

    * Update desired-state-manifest.md

    * Update desired-state-manifest.md

    * Added cumulative image for better fit

    * Update desired-state-manifest.md

    * Update desired-state-manifest.md

    * Update desired-state-manifest.md

commit 54570f90002e5126144e81f35ce51af392c81378
Author: vimeht <59975079+vimeht@users.noreply.github.com>
Date:   Mon Apr 13 13:20:46 2020 -0700

    Update desired-state-manifest.md (#68)

    * Update desired-state-manifest.md

    updating to add guidelines for creating a dsm

    * Add files via upload

    * Update desired-state-manifest.md

    * Delete cumulativeDSM1.PNG

    * Add files via upload

    * Add files via upload

    * Delete cumulativeDSM1.PNG

    * Delete cumulativeDSM2.PNG

    * Delete cumulativeDSM3.PNG

    Co-authored-by: Jerry-GeGarcia <54458572+Jerry-GeGarcia@users.noreply.github.com>

commit 6b1088279c7a29e79ffcfd18d85948b43aabadd8
Author: vimeht <59975079+vimeht@users.noreply.github.com>
Date:   Mon Apr 13 13:19:49 2020 -0700

    Update how-to-publish-quickstart.md (#69)

    * Update how-to-publish-quickstart.md

    Updating wording to include both image and DSM. Scripts still need to be updated. Will be done in another pass

    * Update docs/quickstarts/how-to-publish-quickstart.md

    Co-Authored-By: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * Update how-to-publish-quickstart.md

    * Update how-to-client-eval-sim-quickstart.md

    Co-authored-by: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
    Co-authored-by: Jerry-GeGarcia <54458572+Jerry-GeGarcia@users.noreply.github.com>

commit 4a12c08a8055103c89605cdee7e0a775079f57e0
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Fri Apr 10 12:38:47 2020 -0700

    Changed  Aduc agent (simulator) default log dir to /tmp/aduc-logs. And minor comment improvement. (#70)

    Set default log dir for "simulator" build to /tmp/aduc-logs
    Update comment for safe_json_serialize_to_file_pretty.

commit f2b67ca9672898d97e485c7e970c4d65689f636c
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Apr 10 10:10:46 2020 -0700

    Fixing typo in CMakeLists.txt (#72)

commit 3e509ccf2128867e20ec854f248268a53c041805
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Apr 10 00:34:32 2020 -0700

    Fixing package dependency on DO (#71)

    Changed dependency on do-client-lite to ms-doclient-lite
    Added ms-dopapt as a Suggested package.

commit 2da9e0929622b16116c9a0039833b64ee554b99d
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Thu Apr 9 10:24:50 2020 -0700

    Changed installedCriteria file folder and persist timestamp. Changed package version string format.   (#64)

    Saving installedCriteria data to /var/lib/adu/installedcriteria file.
    Persist timestamp as part of installedCriteria data.
    Change package version string format. (Remove '=' sign) and updated the document.
    Add more unit tests

commit 78acc5ee9aa2148415fc09f2b1c875f74641888f
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Wed Apr 8 23:51:36 2020 -0700

    Fixing issues reporting JSON in InstalledContentId (#66)

    * Fixing issues reporting JSON in InstalledContentId
    * Using Parson instead of snprintf to serialize JSON.
    * Fixing references to adu-install.sh
    * Ran sh-format.sh on adu_install.sh

commit b6d652def464cf8032c72a4ac3313eeac11f41c9
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Wed Apr 8 17:56:18 2020 -0700

    Merging latest master into dev/package-update (#65)

    * Adding documentation for Yocto and improved details about ADU reference client (#42)

    * improved client docs

    * clean-up of new file

    * Update docs/linux-reference-client/client-overview.md

    Co-Authored-By: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * address PR feedback

    * fix typo

    * update simulator documentation

    * update shell commands and markdown spacing

    Co-authored-by: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * update simulator command and typo for client overview (#45)

    * update simulator command and typo for client overview

    * remove sudo from command

    * Adding signed ADU-Management cmdlets, signed and modified ADU-Content… (#37)

    * Adding signed ADU-Management cmdlets, signed and modified ADU-Content cmdlets
    * Modifying gitignore files

    * User/chrudrap/add signed cmdlets (#52)

    Bug fix in the setup script - loading MSAL.NET to path

    * Andbrown03312020 (#55)

    * Update how-to-publish-quickstart.md

    * Update how-to-publish-quickstart.md

    * Add install-prefix option to the build.sh script. (#62)

    * Add install-prefix option to the build.sh script.

    * Apply suggestions from code review

    Co-Authored-By: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * Fix indentation

    Co-authored-by: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * Fixing deleted line in merge.

    * Apply suggestions from code review

    Co-authored-by: Carmen Forsmann <cmforsmann@live.com>
    Co-authored-by: Chinmay Rudrapatna <59946089+chrudrap@users.noreply.github.com>
    Co-authored-by: Andrew Brown <59940770+andrewbrownmsft@users.noreply.github.com>
    Co-authored-by: Emre Girgin <50592283+mrgirgin@users.noreply.github.com>

commit 25736479750063a1cb97e9a28f9cd4e8f7d9478c
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Wed Apr 8 16:14:26 2020 -0700

    Fixing debian package version. (#63)

    Replacing '-' with '~' in our semantic version
    to make it debian version schema compliant.

commit c4223196b6d7a1132eff47fc485d5450b7490dd4
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Tue Apr 7 14:40:55 2020 -0700

    Preserve existing config.yaml on update. Fail when download bogus package. IsInstalled unittest. Code clean up. (#61)

    Add a default Dpkg options to preserve exising config.yaml file when upgrading packages.

    Fix bug where Download() succeeded when specified a bogus package.

    Some code clean up.

    Refactor apt_pkg_helper to throw exception in come cases.

    Add package "update" unit test

    Add IsInstalled() unit test

commit 88c2fde33d2d6a745e2aebc4d9a4e57aab4fa862
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Tue Apr 7 10:41:06 2020 -0700

    Fixing issue with reading config file. (#57)

    * Fixing adu config file path.

commit 97898e929d8f8a2438755becc7cc932348e594bc
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Tue Apr 7 09:14:22 2020 -0700

    Making daemon run as root. (#58)

    * Making daemon run as root.

commit cc28c764d5d312cd2961153423ee0aab55ebad04
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Tue Apr 7 08:56:28 2020 -0700

    Fixing PersistInstalledCriteria return value. (#60)

    * Fixing PersistInstalledCriteria return value.

commit 42934b94ba5c9b402e88fcbb79e1a73202f09f5e
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Tue Apr 7 07:10:54 2020 -0700

    Fix DSM APT version specifier format ('=' not '==') (#59)

    * Fix dsm version specifier

    * Addressing PR feedback.

commit 1fdd33bd700b4f46900bb2c5d36b2e3cede0514d
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Apr 3 16:41:27 2020 -0700

    Merging latest master branch into dev/package-update (#56)

    * Adding documentation for Yocto and improved details about ADU reference client (#42)

    * improved client docs

    * clean-up of new file

    * Update docs/linux-reference-client/client-overview.md

    Co-Authored-By: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * address PR feedback

    * fix typo

    * update simulator documentation

    * update shell commands and markdown spacing

    Co-authored-by: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

    * update simulator command and typo for client overview (#45)

    * update simulator command and typo for client overview

    * remove sudo from command

    * Adding signed ADU-Management cmdlets, signed and modified ADU-Content… (#37)

    * Adding signed ADU-Management cmdlets, signed and modified ADU-Content cmdlets
    * Modifying gitignore files

    * User/chrudrap/add signed cmdlets (#52)

    Bug fix in the setup script - loading MSAL.NET to path

    * Andbrown03312020 (#55)

    * Update how-to-publish-quickstart.md

    * Update how-to-publish-quickstart.md

    Co-authored-by: Carmen Forsmann <cmforsmann@live.com>
    Co-authored-by: Chinmay Rudrapatna <59946089+chrudrap@users.noreply.github.com>
    Co-authored-by: Andrew Brown <59940770+andrewbrownmsft@users.noreply.github.com>

commit 4db0505c06d8be1d36ff79797d3c5a291b3b8f32
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Apr 3 16:00:55 2020 -0700

    Fixing directory permissions and setting up permissions with DO. (#48)

commit 3f143076808d62077fde735a6821a48a07414094
Author: Nox-MSFT <55153324+Nox-MSFT@users.noreply.github.com>
Date:   Fri Apr 3 10:44:44 2020 -0700

    Implemented APT DSM Handler plugin (#50)

    * Upper layer DSM Handler integration
    * DSM Handler implementation
    * DSM Parser component
    * APT DSM Handler plugin
    * Unit tests for DSMParser & APT DSM Handler plugin
    * Apt-Pkg library helper component

commit 6c1e06871fc27ec1747617a8402690b648e6c512
Author: Nicholas Hemstreet <62158276+nihemstr@users.noreply.github.com>
Date:   Thu Apr 2 16:12:13 2020 -0700

    User/nihemstr/local store eis merge branch (#51)

    * Refactor for V2 ADU Core interface. (#30)

    Added ADU Core V2 interface implementation behind ifdefs.
    Refactored platform layer and content handler code.
    Moved some common code into libraries.
    Renamed files to be consistent.

    * Finishing ADU Core V2 PnP interface implementation (#38)

    Some small refactors.
    Addressed TODOs.
    Added exceptions.
    Moved hash functions into a library.

    * Create connection utils library and included it in main

    * Moved connection_utils to utils folder, added unit tests

    * Removed extraneous dependency

    * Removed unit tests and umock implementation, will resolve later in new branch

    * Removed ADU_CAS_FILE in favour of ADU_CONF_FILE

    * Removed merge goof that had two definitions of ADUC_MethodCall_IsInstalled

    * Provided a more verbose log error so user understands where the connection method comes from

    * Fixed naming conventions, minor merge errors, and ran clang-tidy

    * Added more verbose enum names in-keeping with the current project

    * Updated code with clang format, changed file reading method to gets, and responded to other PR concerns

    * Repsonded to PR concerns, tweaked some function and variable names, and added some better Logging messages

    * Added more verbose feedback from ReadConnectionStrFromFile and improved some comments

    * Fixed issues with some of the ReadConStrErrCode values and how ADU detects an insufficient buffer in ReadConStr

    * Fixed naming errors and improperly labeled logging tools, closed a memory leak

    Co-authored-by: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>

commit 932d34f0f9cea7c92155ec3e35320f22d7e97aed
Author: vimeht <59975079+vimeht@users.noreply.github.com>
Date:   Thu Apr 2 12:37:02 2020 -0700

    Update adu-overview.md (#54)

    Edits to ADU overview for package update

commit 5d3387d4547e43eb1ef711090f6a13a1694b9643
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Tue Mar 31 16:26:31 2020 -0700

    Updating client documentation for the new package update scenario and refactoring. (#47)

    * Updating client documentation for the new package update scenario and refactoring. (#47)

    Also merging in from master:
    * Adding documentation for Yocto and improved details about ADU reference client (#42)

commit 1f1c63150f9229280013030f2a7148a9ed299177
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Mar 27 15:34:53 2020 -0700

    Adding support for logging directory in daemon (#44)

    Added support for the standard logging directory in the ADU deamon.
    Fixed issues where we are passing the wrong cmake vars to install script.
    Build the client package seperate from the standalone exe.

commit 0d7d118cba3c174cc626db30b29637fd08fa6580
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Thu Mar 26 10:40:55 2020 -0700

    Adding package generation to build. (#43)

    Generating debian package for ubuntu 18.04
    Added daemon systemd unit file.
    Added cmake options to configure daemon.
    Moved cmake options to top level cmake file.
    Added building package to the azure pipelines.

commit bd42555d0dfc0cbd3c23f4fe541d478f6ae3fdcc
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Fri Mar 20 18:20:39 2020 -0700

    Merge latest dev/adu-core-v2 into dev/package-update (#40)

    * Refactor for V2 ADU Core interface. (#30)

    Added ADU Core V2 interface implementation behind ifdefs.
    Refactored platform layer and content handler code.
    Moved some common code into libraries.
    Renamed files to be consistent.

    * Finishing ADU Core V2 PnP interface implementation (#38)

    Some small refactors.
    Addressed TODOs.
    Added exceptions.
    Moved hash functions into a library.

    * Fixing previous PR comments and adding UTs (#39)

    * Merging latest master into dev/adu-core-v2 branch. (#41)

    * Update README.md (#29)

    Added CELA disclaimer per Vincent and Karthik

    * Adding dev and feature branches to build. (#28)

    Co-authored-by: tejasp-ms <tejasp-ms@users.noreply.github.com>

    Co-authored-by: tejasp-ms <tejasp-ms@users.noreply.github.com>

commit d5d5b0870bc31fa6d8526571eb038bcaa26b47e7
Author: Casey Irvine <44978150+cirvine-MSFT@users.noreply.github.com>
Date:   Thu Mar 12 20:29:52 2020 -0700

    Refactor for V2 ADU Core interface. (#30) (#35)

    Added ADU Core V2 interface implementation behind ifdefs.
    Refactored platform layer and content handler code.
    Moved some common code into libraries.
    Renamed files to be consistent.

* Update version number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants