Directory

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!

If you are trying to figure out how to build 1 artifact that includes your package install script and the 2 packages see this post Mender-convert - Include state scripts in the artifact

You can put everything into the artifact using the directory module and mender-artifact cmd. Mender-client runs scripts if they match certain names @lluiscampos mentioned in the link https://docs.mender.io/artifact-creation/state-scripts#transitions-and-ordering e.g. ArtifactInstall_Leave_01_install_hitesh53G_pkg

I want to test out the artifact fail scenario to make sure my system can handle error recovery from a bad update.

What is the simplest way to create an artifact that will always fail for the Directory module?

  1. Create ArtifactInstall_Leave script that returns 1
  2. create artifact that copies to dest directory that does not exist

Thanks!

I think I’d do 1), except I’d fail in the Enter state :slight_smile:

But both solutions work just fine.

1 Like

@hitesh53G And for anyone else that isn’t sure how to add scripts to an artifact using the Directory module. I guess it would work for any update module. One variable per script, add as many as you need

SCRIPT1="<path to script>/ArtifactInstall_Enter_01_do_something" 

SCRIPT2="<path to script>/ArtifactInstall_Leave_01_do_something_else" 

./directory-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -d ${DEST_DIR} -o ${OUTPUT_PATH} ${FILE_TREE} -- --script ${SCRIPT1} --script ${SCRIPT2}

@oleorhagen Thanks for the suggestion!

1 Like

Hi all !
I’m writing to you because we are trying to use the Directory Update Module to update our configuration files but we are encountering some error:

INFO[0000] Loaded configuration file: /var/lib/mender/mender.conf
INFO[0000] Loaded configuration file: /etc/mender/mender.conf
INFO[0000] Mender running on partition: /dev/mmcblk0p1
ERRO[0000] Failed to Load the Server certificate. Err SSL errors:
WARN[0000] Failed to load the server TLS certificate settings: SSL errors:
INFO[0000] Start updating from local image file: [conf-v25.mender]
Installing Artifact of size 8192...
INFO[0000] No public key was provided for authenticating the artifact
.....................                                          -  34 %ERRO[0000] Reading headers failed: open /etc/mender/artifact_info: no such file or directory
ERRO[0000] open /etc/mender/artifact_info: no such file or directory

We manage to sucessfully create artifacts with directory-artifact-gen but we fail to install them, either in standalone or server mode. We don’t have any problem installing rootfs Artifacts.
We are using a read-only rootfs and Mender 2.6.0 (same problem with Mender 3.0.0)

If I understand correctly, the artifact_info file is not supposed to be used anymore, so why it is still looking for it ?

Any help would be appreciated,

Thanks !

1 Like

Hey @VivFlo

While it’s true this file is in the process of being deprecated, the transition is not complete yet, so it is still required for the very first update. Afterwards it is ignored. Once this ticket is fixed, the file can be removed completely.

@lluiscampos

I tried both this and the Directory Overlay module update instructions to simply overwrite a directory with a directory, and they say “Downloading…” then “Installing…” then seem to get stuck in this state indefinitely. (On a Mender deployment of the generated artifact)

Any idea if your script is out of date?

Thanks.

Having the exact same issue

Hello @EnjoysMath ,

This is interesting. I am not aware of the module being “out of date”, in the sense that the API has not been modified and it should work.

Can you provide the logs from the device? For example logging in into the device after getting stuck, and executing:
journalctl -u mender-client | cat

LluĂ­s