Directory

Nothing specific since it’s going to be very dependent on the system design. The existing update module could be easily updated to handle that for your specifics though.

Is there a way to force a device restart after the artifact gets installed?

Fork and make your own version of the directory Update Module, and implement the ArtifactReboot state, where you should print Automatic and exit 0. This will reboot every time the Update Module installs anything.

You can also add more advanced logic and consider printing No in some cases, if you want to make it conditional.

1 Like

@drewmoseley thanks for that. Is it possible to update multiple folders at different locations in the target device? Thanks.

Not with this update module. You can do that with a custom module.

Are you looking for something like this?

1 Like

Hi, I was wondering if there is any way to update the directory without deleting unwanted items. For instance I am updating a directory that contains all the executables along with the user data. I want to update the exes but I dont want any user data to be removed. I created a mender artifact with only exes but its deleting any user data previously on that directory as well. Would be thankful for any feed. Thanks

You may want to look at the Directory Overlay module.

1 Like

Hi @drewmoseley. I tried Mender Directory Overlay module. My Mender Client version is 2.2 and mender-artifact I am using is 3.1.1. When trying to deploy the artifact I am getting this error

" Artifact Payload type ‘dir-overlay’ is not supported by this Mender Client"

According the the example provided it is supposed to be working with these version but I am somehow failing to do so. Can you please provide some insight

PS: I am not trying to overlay rootfs. I am trying it with for a custom directory in the home folder.

Thanks

It sounds like you don’t have the update module itself installed on the client. To do that manually, run the following:

mkdir -p /usr/share/mender/modules/v3 && wget -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/dir-overlay/module/dir-overlay && chmod +x /usr/share/mender/modules/v3/dir-overlay

Thanks it worked.

Hello,

Can I use the same directory update module to create new directories in persistent data section(/data)?

Yes, the target directory is specified as a parameter and can be anywhere.

So I did create an application update using the below parameters.

ARTIFACT_NAME=“My-Test-Update-1.0”
DEVICE_TYPE=“raspberrypi-cm3”
OUTPUT_PATH=“My-Test-Update-1.0.mender”
DEST_DIR=“/data/”
FILE_TREE=“system”
./directory-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -d ${DEST_DIR} -o ${OUTPUT_PATH} ${FILE_TREE}

But the application update is stuck at 69%. Am I missing something?

Edit1: It has been stuck at 69% for about 2 hours now

1 Like

Can you provide output from journalctl -u mender-client on the device?

journalctl replied back saying no new entries. But the application update failed and the error is

2020-09-15 13:41:41 +0000 UTC error: Fetching Artifact headers failed: installer: failed to read Artifact: readHeaderV3: handleHeaderReads: Artifact Payload type 'directory' is not supported by this Mender Client

It feels like I need to add something in my local.conf

Maybe you are missing:

PACKAGECONFIG_pn-mender-client = " modules"

This could also go into a bbappend file for mender-client.

Hi all, Is there any way to execute script after uploading files to client? To clarify my question, below is the explanation with an example:
Let’s say I have three files, out of which one is script (.sh file) and other two are package files of an application and want to install that packages using that script.
Is it possible? How to create artifact for this scenario?
Please guide me on this?
May be its a silly question but I am very new to mender, and struggling with this scenario since past couple of months. Currently I am uploading file using directory module to the client first. Then executing a script using script module. For that I am creating a two different artifacts and uploading it to client through server.
But now I want this to be done with only one artifact. Please guide me on this.

Thanks!

Hi @hitesh53G,

There are different ways to achieve “installing and executing something” in one Artifact. An simple way could be to use the directory Update Module (installing the two package files) while shipping the script as an state script in the Artifact.

The state scripts are scripts that are executed as part of the update process at different stages. You can find more information in the documentation of Mender Artifacts state scripts.

Hi @lluiscampos,
Thanks for your reply. I am trying the way you have suggested. I have read the document but still not getting that how to get it done. Do you have example link on same scenario. So going through an example may be help me to understand the concept.

Thanks!