Application Update(.deb)

Hello,

I am trying to update *.deb package with a Raspberry Pi3(application update) using mender client. I followed steps mentioned in “How to update .deb package with a Raspberry Pi 3” but unfortunately it’s not behaving as expected and it throws an error – “No such file or directory” as mentioned below in highlighted text.


2021-02-18 11:00:41 +0000 UTC info: Running Mender client version: 2.5.0

2021-02-18 11:00:42 +0000 UTC info: State transition: update-fetch [Download_Enter] → update-store [Download_Enter]

2021-02-18 11:00:42 +0000 UTC info: No public key was provided for authenticating the artifact

2021-02-18 11:00:43 +0000 UTC info: State transition: update-store [Download_Enter] → update-after-store [Download_Leave]

2021-02-18 11:00:43 +0000 UTC info: State transition: update-after-store [Download_Leave] → update-install [ArtifactInstall]

2021-02-18 11:00:43 +0000 UTC info: Update module output: dpkg: error: unable to access the dpkg database directory /var/lib/dpkg: No such file or directory

2021-02-18 11:00:43 +0000 UTC error: Update module terminated abnormally: exit status 2

2021-02-18 11:00:43 +0000 UTC error: transient error: Update module terminated abnormally: exit status 2

2021-02-18 11:00:43 +0000 UTC info: State transition: update-install [ArtifactInstall] → update-error [ArtifactFailure]

2021-02-18 11:00:43 +0000 UTC info: State transition: update-error [ArtifactFailure] → cleanup [Error]

2021-02-18 11:00:43 +0000 UTC info: State transition: cleanup [Error] → update-status-report [none]


*application .deb update

------------------------------------

ARTIFACT_NAME=“my-rasp-update-1.0”

DEVICE_TYPE=“raspberrypi3”

OUTPUT_PATH=“my-rasp-update-1.0.mender”

PACKAGES=“weavedconnectd_1.3-07m_armhf.deb”

mender-artifact write module-image -T deb -n {ARTIFACT_NAME} -t {DEVICE_TYPE} -o {OUTPUT_PATH} -f (echo “$PACKAGES” | sed -e ‘s/ / -f /g’)

Changes in local.conf in my build folder


PACKAGE_CLASSES = “package_deb”

IMAGE_INSTALL_append += " apt dpkg "


With the local.conf changes in my build, /usr/bin had the dpkg installed, but never generated /var/lib/dpkg folder.

To overcome this error “2021-02-18 11:00:43 +0000 UTC info: Update module output: dpkg: error: unable to access the dpkg database directory /var/lib/dpkg: No such file or directory”, I copied the /var/lib/dpkg manually to my flashed mender binary. After this change when I try to do an update, previous issue is gone but I encountered different set of issues as highlighted below.


2021-02-18 17:39:33 +0000 UTC info: Running Mender client version: 2.5.0

2021-02-18 17:39:34 +0000 UTC info: State transition: update-fetch [Download_Enter] → update-store [Download_Enter]

2021-02-18 17:39:34 +0000 UTC info: No public key was provided for authenticating the artifact

2021-02-18 17:39:35 +0000 UTC info: State transition: update-store [Download_Enter] → update-after-store [Download_Leave]

2021-02-18 17:39:35 +0000 UTC info: State transition: update-after-store [Download_Leave] → update-install [ArtifactInstall]

2021-02-18 17:39:35 +0000 UTC info: Update module output: Selecting previously unselected package weavedconnectd.

2021-02-18 17:39:36 +0000 UTC info: Update module output: (Reading database … 4865 files and directories currently installed.)

2021-02-18 17:39:36 +0000 UTC info: Update module output: Preparing to unpack …/weavedconnectd_1.3-07m_armhf.deb …

2021-02-18 17:39:36 +0000 UTC info: Update module output: Unpacking weavedconnectd (1.3-07m) …

2021-02-18 17:39:36 +0000 UTC info: Update module output: dpkg: error processing archive /var/lib/mender/modules/v3/payloads/0000/tree/files/weavedconnectd_1.3-07m_armhf.deb (–install):

2021-02-18 17:39:36 +0000 UTC info: Update module output: unable to clean up mess surrounding ‘./usr/bin/weavedconnectd.pi’ before installing another version: Read-only file systemcd .

2021-02-18 17:39:36 +0000 UTC info: Update module output: dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

2021-02-18 17:39:36 +0000 UTC info: Update module output: Errors were encountered while processing:

2021-02-18 17:39:36 +0000 UTC info: Update module output: /var/lib/mender/modules/v3/payloads/0000/tree/files/weavedconnectd_1.3-07m_armhf.deb

2021-02-18 17:39:36 +0000 UTC error: Update module terminated abnormally: exit status 1

2021-02-18 17:39:36 +0000 UTC error: transient error: Update module terminated abnormally: exit status 1

2021-02-18 17:39:36 +0000 UTC info: State transition: update-install [ArtifactInstall] → update-error [ArtifactFailure]

2021-02-18 17:39:36 +0000 UTC info: State transition: update-error [ArtifactFailure] → cleanup [Error]

2021-02-18 17:39:36 +0000 UTC info: State transition: cleanup [Error] → update-status-report [none]


Just to ensure if the way of execution is correct, I tried executing the below command(dpkg -i /mnt/mender-client_2.5.0-1_armhf.deb) as seen in the attached image “deb_error.png”. I am just wondering whether I missed any steps that are required for Application update with mender client. It would be great if you could help us in resolving this issue.

For Yocto builds to include the package management database and utilities actually in your image, you need to add the following to local.conf:

EXTRA_IMAGE_FEATURES_append = " package-management "

Without that, you are using deb packages as part of the build process but are unable to manipulate them on the target.

Drew

Hello Drew ,
Greetings!
Thank you for your response.
After adding `EXTRA_IMAGE_FEATURES_append = " package-management " i was able to see the /var/lib/dpkg folder in my build. The /var/lib/deb problem got resolved, but i still cannot install my dpkg package.
When i try to deploy the .deb file from the mender hub it failed to execute. Please find the logs below.

2021-03-03 09:11:41 +0000 UTC info: Running Mender client version: 2.5.0
2021-03-03 09:11:42 +0000 UTC info: State transition: update-fetch [Download_Enter] → update-store [Download_Enter]
2021-03-03 09:11:42 +0000 UTC info: No public key was provided for authenticating the artifact
2021-03-03 09:11:43 +0000 UTC info: State transition: update-store [Download_Enter] → update-after-store [Download_Leave]
2021-03-03 09:11:43 +0000 UTC info: State transition: update-after-store [Download_Leave] → update-install [ArtifactInstall]
2021-03-03 09:11:44 +0000 UTC info: Update module output: Selecting previously unselected package weavedconnectd.
2021-03-03 09:11:45 +0000 UTC info: Update module output: (Reading database … 5125 files and directories currently installed.)
2021-03-03 09:11:45 +0000 UTC info: Update module output: Preparing to unpack …/weavedconnectd_1.3-07m_armhf.deb …
2021-03-03 09:11:45 +0000 UTC info: Update module output: Unpacking weavedconnectd (1.3-07m) …
2021-03-03 09:11:45 +0000 UTC info: Update module output: dpkg: error processing archive /var/lib/mender/modules/v3/payloads/0000/tree/files/weavedconnectd_1.3-07m_armhf.deb (–install):
2021-03-03 09:11:45 +0000 UTC info: Update module output: unable to clean up mess surrounding ‘./usr/bin/weavedconnectd.pi’ before installing another version: Read-only file system
2021-03-03 09:11:45 +0000 UTC info: Update module output: dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
2021-03-03 09:11:46 +0000 UTC info: Update module output: Errors were encountered while processing:
2021-03-03 09:11:46 +0000 UTC info: Update module output: /var/lib/mender/modules/v3/payloads/0000/tree/files/weavedconnectd_1.3-07m_armhf.deb
2021-03-03 09:11:46 +0000 UTC error: Update module terminated abnormally: exit status 1
2021-03-03 09:11:46 +0000 UTC error: transient error: Update module terminated abnormally: exit status 1
2021-03-03 09:11:46 +0000 UTC info: State transition: update-install [ArtifactInstall] → update-error [ArtifactFailure]
2021-03-03 09:11:46 +0000 UTC info: State transition: update-error [ArtifactFailure] → cleanup [Error]
2021-03-03 09:11:46 +0000 UTC info: State transition: cleanup [Error] → update-status-report [none]

File used for deployment : my-rasp-update-1.0.mender and “weavedconnectd_1.3-07m_armhf.deb” was part of the “my-rasp-update-1.0.mender”

Please help me resolving this issue.

Best Regards
Sreelatha

It seems that your root filesystem is mounted in read-only mode:

2021-03-03 09:11:45 +0000 UTC info: Update module output: unable to clean up mess surrounding ‘./usr/bin/weavedconnectd.pi’ before installing another version: Read-only file system

You can also manually copy the deb file and try to install with dpkg --install to see if there is any additional output from that.

Hello Drew,
I manually copied the “weavedconnectd_1.3-07m_armhf.deb” to the /data folder. I see the same behavior. As i understand based on the settings while creating the *.deb the installation will happen in those respective folders and if those folders are part of readonly filesystem then the same error would occur. One way as i understand is to mount these respective folders to the writable partition. Is my understanding correct or you have any better suggestion.

Best Regards
Sreelatha

Yes, if you try to install and the package has files that would go into a read-only filesystem it will fail.

You can remount the root filesystem as read/write:

sudo mount -o remount,rw /

but note that if you have it set to read-only to be able to use binary-delta updates, this workflow will break that.

Thank you for clarifying.

Best Regards
Sreelatha

Hello Drew,
As per your above comment does mender support all the update strategies (delta updates, application updates(.deb), single file updates and A/B updates) in one binary or are each targeted for different binaries?

Best Regards
Sreelatha

@Sreelatha each Mender artifact contains a specific payload type. That could be a delta update blob, a full partition image or a debian package.

Hello Drew,
Can mender client handle all the strategies( delta, application update(.deb), single file and A/B updates) at a time in one single binary?

Best Regards
Sreelatha

No. The artifact has an embedded type associated with it and each artifact binary contains a single type.

Hello Drew,

Thank you for your quick response. Let me slightly rephrase the question.

We understand that mendor supports all different strategies i.e. memory A/B, Delta Update, Application Application (*.dpkg) and file update. However, at a given point of time only one strategy can be applied as each artefacts can be mapped to embedded type associate with it. Does it mean that I can use all the strategies but one after another?

We also observed that Memory A/B and Partial Update makes rootfs to be “readonly” but how about Application Update and File Update? In case of an Application Update, new package will be installed in the current active partition so how “readonly” properties of rootfs is handled in case of Application Update and File Update.

Best Regards,
Hemal Bavishi

If your root filesystem is readonly then you will indeed be unable to do application or file updates.

I’m not sure what you mean that ‘Memory A/B and Partial Update makes rootfs to be “readonly”’. That should not be the case. Doing an A/B update should not change your rootfs to be readonly.

Now, if you are referring to robust binary delta updates, then indeed it is required that the root filesystem be readonly. This is to ensure that the contents of the filesystem have not changed. If it has changed, then you will not be able to apply the binary delta. This does imply that you cannot use application or file updates in a system that also uses binary delta updates.

Drew

1 Like