rauc / rauc-hawkbit-updater

The RAUC hawkBit updater is a simple commandline tool/daemon that runs on your target and interfaces between RAUC and hawkBit's DDI API.
https://rauc-hawkbit-updater.readthedocs.io
GNU Lesser General Public License v2.1
58 stars 36 forks source link

Invalid checksum Error - Yocto OS Update #134

Closed Sherry112 closed 2 years ago

Sherry112 commented 2 years ago

Hello!, I want to do an OS update with Yocto. I am using rauc-hawkbit-updater and rauc for the delivering the OS to the device and for installing the OS respectively. Hawkbit is in sync with AWS S3 bucket which has the OS distribution.

Rauc-Hawkbit-Updater downloads the OS file from hawkbit, however it is throwing this error Software: DeviceOS VR1.3.4. Invalid checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 expected 762186110ac2b74675eb7fdb1dfe1801191e364f

The logs are:

> Jun 28 11:18:01 device-2021400048 rauc-hawkbit-updater[4431]: No new software.
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Checking for new software...
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Response body: {
>                                                                "config" : {
>                                                                   "polling" : {
>                                                                    "sleep" : "00:05:00"
>                                                                  }
>                                                                },
>                                                                "_links" : {
>                                                                  "deploymentBase" : {
>                                                                    "href" : "http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/deploymentBase/30?c=438411779"
>                                                                  }
>                                                                }
>                                                              }
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Response body: {
>                                                                "id" : "30",
>                                                                "deployment" : {
>                                                                  "download" : "forced",
>                                                                  "update" : "forced",
>                                                                  "chunks" : [
>                                                                    {
>                                                                      "part" : "os",
>                                                                      "version" : "R1.3.4",
>                                                                      "name" : "OS",
>                                                                      "artifacts" : [
>                                                                        {
>                                                                          "filename" : "casync-bundle.raucb",
>                                                                          "hashes" : {
>                                                                            "sha1" : "762186110ac2b74675eb7fdb1dfe1801191e364f",
>                                                                            "md5" : "ad1607ba7cdcb686d0029930f474774e",
>                                                                            "sha256" : "b28c2157685459df40172f03a3cc8babbb20a5cfa402b4ab2f9d9d965924f245"
>                                                                          },
>                                                                          "size" : 1579439,
>                                                                          "_links" : {
>                                                                            "download-http" : {
>                                                                              "href" : "http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/softwaremodules/12/artifacts/casync-bundle.raucb"
>                                                                            },
>                                                                            "md5sum-http" : {
>                                                                              "href" : "http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/softwaremodules/12/artifacts/casync-bundle.raucb.MD5SUM"
>                                                                            }
>                                                                          }
>                                                                        }
>                                                                      ]
>                                                                    }
>                                                                  ]
>                                                                }
>                                                              }
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: New software ready for download. (Name: DeviceOS, Version: R1.3.4, Size: 1579439, URL: http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/softwaremodules/12/artifacts/casync-bundle.raucb)
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Start downloading: http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/softwaremodules/12/artifacts/casync-bundle.raucb
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Request body: {
>                                                                "id" : "30",
>                                                                "time" : "20220628T112303",
>                                                                "status" : {
>                                                                  "result" : {
>                                                                    "finished" : "none"
>                                                                  },
>                                                                  "execution" : "proceeding",
>                                                                  "details" : [
>                                                                    "Download complete. 0.00 MB/s"
>                                                                  ]
>                                                                }
>                                                              }
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Feedback progress status: 200, URL: http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/deploymentBase/30/feedback
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Download complete. 0.00 MB/s
> Jun 28 11:23:03 device-2021400048 rauc-hawkbit-updater[4431]: Request body: {
>                                                                "id" : "30",
>                                                                "time" : "20220628T112303",
>                                                                "status" : {
>                                                                  "result" : {
>                                                                    "finished" : "failure"
>                                                                  },
>                                                                  "execution" : "closed",
>                                                                  "details" : [
>                                                                    "Software: DeviceOS VR1.3.4. Invalid checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 expected 762186110ac2b74675eb7fdb1dfe1801191e364f"
>                                                                  ]
>                                                                }
>                                                              }
> Jun 28 11:23:04 device-2021400048 rauc-hawkbit-updater[4431]: Feedback status: 200, URL: http://hawkbitUrl:8080/DEFAULT/controller/v1/developerDevices_2021400048/deploymentBase/30/feedback
> Jun 28 11:23:04 device-2021400048 rauc-hawkbit-updater[4431]: Software: DeviceOS VR1.3.4. Invalid checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 expected 762186110ac2b74675eb7fdb1dfe1801191e364f
> Jun 28 11:28:04 device-2021400048 rauc-hawkbit-updater[4431]: Checking for new software...

Would really appreciate some insight of what I could be doing wrong on this.

ejoerns commented 2 years ago

The sha1sum announced by hawkBit for the bundle does not match the calculated sha1sum of the downloaded bundle. Thus either the sha1sum listed in the details of the artifacts is wrong or something changed the artifact during download.

DId that happen once or is this reproducible?

Is the downloaded bundle still a valid bundle and accepted by RAUC?

Sherry112 commented 2 years ago

So rauc doesn't show up any logs, as the process ends on Rauc-hawkbit-updater. Yes, the issue is reproduceable and it is happening when I try to rollback the OS version 1.3.5 -> 1.3.4 (occurs everytime). If I try to move 2 versions up, the same error shows up.

However on just updating 1 version up, the checksum is valid and the error doesn't show up. Does it have to do with the order of OS distributions on hawkbit?

Bastian-Krause commented 2 years ago

Let's find out if rauc-hawkbit-updater or hawkBit cause this:

This script does basically the same thing as rauc-hawkbit-updater. It downloads the artifact that is being deployed and checks its sha1sum. The sha1sum hawkBit calculated is also shown. So please deploy the problematic file, adjust HAWKBIT, TARGET_NAME, TARGET_TOKEN to your setup and run it (curl, jq, sha1sum required):

#!/bin/bash
set -xe -o pipefail

HAWKBIT="http://localhost:8080"
TARGET_NAME=test
TARGET_TOKEN=ieHai3du7gee7aPhojeth4ong

AUTH_HEADER="Authorization: TargetToken $TARGET_TOKEN"
BASE="$(curl --header "$AUTH_HEADER" "${HAWKBIT}/DEFAULT/controller/v1/$TARGET_NAME")"
DEPLOYMENT_BASE_URL="$(echo "$BASE" | jq -r ._links.deploymentBase.href)"
DEPLOYMENT_BASE="$(curl --header "$AUTH_HEADER" "$DEPLOYMENT_BASE_URL")"
ARTIFACT_URL="$(echo "$DEPLOYMENT_BASE" | jq -r .deployment.chunks[0].artifacts[0]._links.'"download-http"'.href)"
HAWKBIT_SHA1="$(echo "$DEPLOYMENT_BASE" | jq -r .deployment.chunks[0].artifacts[0].hashes.sha1)"

set +x
echo -n "calculated sha1: "
curl --silent --header "$AUTH_HEADER" "$ARTIFACT_URL" | sha1sum
echo "hawkbit sha1: $HAWKBIT_SHA1"
Bastian-Krause commented 2 years ago

@Sherry112 Did you find the culprit for the checksum mismatch?

Bastian-Krause commented 2 years ago

@Sherry112 I'd still like to understand what's causing the checksum mismatch. Any news regarding this?

ejoerns commented 2 years ago

I will close this due to inactivity. Feel free to reopen if the error persists or if it can be reproduced by someone else.