State-script support in dir-overlay Update Module

Are you going to add support for module state scripts? I tried passing the -s and --script commands and it says unsupported option. Also curious about permissions. Will I need to run a state script to set the permissions on all the overlaid files? Might be handy to have the permissions and owners set from the current files permissions when the artifact is generated. The single-file generator already seems to handle the state scripts and permissions…

Are you going to add support for module state scripts? I tried passing the -s and --script commands and it says unsupported option. Also curious about permissions. Will I need to run a state script to set the permissions on all the overlaid files? Might be handy to have the permissions and owners set from the current files permissions when the artifact is generated. The single-file generator already seems to handle the state scripts and permissions…

It would make sense to make these improvements similar to what is supported by the single-file generator.

Though I have no plans on making any updates as my priorities are else where. I created this as a reference and would happily take contributions to improve it.

I modified it to work like the single-file generator to allow passing in other arguments such as state scripts. Not sure how to contribute though, I can’t upload the file. Should I just post the code?

A pull-request [here] (mender-update-modules/dir-overlay/module-artifact-gen/dir-overlay-artifact-gen at master · mendersoftware/mender-update-modules · GitHub) would be awesome.

There is some additional text on how to contribute here,

Support was added with this pull-request,

Thanks @speeltronics

Hi guys,

I tried the directory overlay update exactly similar to this. But I get these situations. It seems something related to compatibility I guess. I am using Balena Fin with the Raspberry Pi 3 Computing module.

Thanks in advance.

Saman

Your artifact is set to be compatible with ‘my-device-type’ but your actual device type is ‘raspberrypi3’. I think you missed a customization step in setting the variables for the artifact creation.

Thanks. I had forgotton to change my device_type.

Now, I am getting this error after deployment. Here is the log.

2020-11-11 16:05:29 +0000 UTC info: Running Mender client version: 2.4.0
2020-11-11 16:05:36 +0000 UTC info: State transition: update-fetch [Download_Enter] -> update-store [Download_Enter]
2020-11-11 16:05:36 +0000 UTC info: No public key was provided for authenticating the artifact
2020-11-11 16:05:36 +0000 UTC info: Update module output: + STATE=Download
2020-11-11 16:05:36 +0000 UTC info: Update module output: + 
2020-11-11 16:05:36 +0000 UTC info: Update module output: FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:36 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:36 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:36 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:36 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:36 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:36 +0000 UTC info: Update module output: + exit 0
2020-11-11 16:05:36 +0000 UTC info: Update module output: + STATE=SupportsRollback
2020-11-11 16:05:36 +0000 UTC info: Update module output: + 
2020-11-11 16:05:36 +0000 UTC info: Update module output: FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:36 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:36 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:36 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:36 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:36 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:36 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:36 +0000 UTC info: Update module output: + echo Yes
2020-11-11 16:05:36 +0000 UTC info: Update module output: + exit 0
2020-11-11 16:05:37 +0000 UTC info: State transition: update-store [Download_Enter] -> update-after-store [Download_Leave]
2020-11-11 16:05:37 +0000 UTC info: State transition: update-after-store [Download_Leave] -> update-install [ArtifactInstall]
2020-11-11 16:05:37 +0000 UTC info: Update module output: + STATE=ArtifactInstall
2020-11-11 16:05:37 +0000 UTC info: Update module output: + 
2020-11-11 16:05:37 +0000 UTC info: Update module output: FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:37 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:37 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:37 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:37 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:37 +0000 UTC info: Update module output: + [ -ne 0 ]
2020-11-11 16:05:37 +0000 UTC info: Update module output: /usr/share/mender/modules/v3/dir-overlay: 65: [: -ne: unexpected operator
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cat /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:37 +0000 UTC info: Update module output: + dest_dir=/home/pi/dir_overlay
2020-11-11 16:05:37 +0000 UTC info: Update module output: + mkdir -p /home/pi/dir_overlay /var/lib/mender/dir-overlay-install
2020-11-11 16:05:37 +0000 UTC info: Update module output: + [ -e /var/lib/mender/dir-overlay-install/manifest ]
2020-11-11 16:05:37 +0000 UTC info: Update module output: + mkdir -p /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:37 +0000 UTC info: Update module output: + stat -c %a /home/pi/dir_overlay
2020-11-11 16:05:37 +0000 UTC info: Update module output: + chmod 755 /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:37 +0000 UTC info: Update module output: + stat -c %U:%G /home/pi/dir_overlay
2020-11-11 16:05:37 +0000 UTC info: Update module output: + chown root:root /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cat /var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -cpf - /home/pi/dir_overlay/etc/app.conf
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cd /var/lib/mender/modules/v3/payloads/0000/tree/tmp/
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/etc/app.conf: Cannot stat: No such file or directory
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 16:05:37 +0000 UTC info: Update module output: + + cdtar -cpf /var/lib/mender/modules/v3/payloads/0000/tree/tmp/ -
2020-11-11 16:05:37 +0000 UTC info: Update module output:  /home/pi/dir_overlay/usr/bin/app
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/usr/bin/app: Cannot stat: No such file or directory
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -cpf - /home/pi/dir_overlay/usr/share/app/data.txt
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cd /var/lib/mender/modules/v3/payloads/0000/tree/tmp/
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/usr/share/app/data.txt: Cannot stat: No such file or directory
2020-11-11 16:05:37 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 16:05:37 +0000 UTC info: Update module output: + tar -cpf /var/lib/mender/dir-overlay-install/backup.tar -C /var/lib/mender/modules/v3/payloads/0000/tree/tmp .
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cat /var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + rm /home/pi/dir_overlay/etc/app.conf
2020-11-11 16:05:37 +0000 UTC info: Update module output: rm: cannot remove '/home/pi/dir_overlay/etc/app.conf': No such file or directory
2020-11-11 16:05:37 +0000 UTC error: Update module terminated abnormally: exit status 1
2020-11-11 16:05:37 +0000 UTC error: transient error: Update module terminated abnormally: exit status 1
2020-11-11 16:05:37 +0000 UTC info: State transition: update-install [ArtifactInstall] -> rollback [ArtifactRollback]
2020-11-11 16:05:37 +0000 UTC info: Performing rollback
2020-11-11 16:05:37 +0000 UTC info: Update module output: + STATE=ArtifactRollback
2020-11-11 16:05:37 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:37 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:37 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:37 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:37 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:37 +0000 UTC info: Update module output: + [ -ne 0 ]
2020-11-11 16:05:37 +0000 UTC info: Update module output: /usr/share/mender/modules/v3/dir-overlay: 106: [: -ne: unexpected operator
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cat /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:37 +0000 UTC info: Update module output: + dest_dir=/home/pi/dir_overlay
2020-11-11 16:05:37 +0000 UTC info: Update module output: + test -f /var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:37 +0000 UTC info: Update module output: + cp /var/lib/mender/dir-overlay-install/manifest.prev /var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:37 +0000 UTC info: Update module output: cp: cannot stat '/var/lib/mender/dir-overlay-install/manifest.prev': No such file or directory
2020-11-11 16:05:37 +0000 UTC error: Update module terminated abnormally: exit status 1
2020-11-11 16:05:37 +0000 UTC error: Rollback failed: Update module terminated abnormally: exit status 1
2020-11-11 16:05:38 +0000 UTC error: fatal error: Update module terminated abnormally: exit status 1
2020-11-11 16:05:38 +0000 UTC info: State transition: rollback [ArtifactRollback] -> update-error [ArtifactFailure]
2020-11-11 16:05:38 +0000 UTC info: Update module output: + STATE=ArtifactFailure
2020-11-11 16:05:38 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:38 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:38 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:38 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:38 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:38 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:38 +0000 UTC info: Update module output: + exit 0
2020-11-11 16:05:38 +0000 UTC info: State transition: update-error [ArtifactFailure] -> cleanup [Error]
2020-11-11 16:05:38 +0000 UTC info: Update module output: + STATE=Cleanup
2020-11-11 16:05:38 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 16:05:38 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 16:05:38 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 16:05:38 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 16:05:38 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 16:05:38 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 16:05:38 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 16:05:38 +0000 UTC info: Update module output: + exit 0
2020-11-11 16:05:38 +0000 UTC info: State transition: cleanup [Error] -> update-status-report [none]

Thanks.

Saman

@drewmoseley - edited for formatting

It seems that for some reason you do not have a UID shell variable set but I thought that was a standard shell feature.

2020-11-11 16:05:37 +0000 UTC info: Update module output: /usr/share/mender/modules/v3/dir-overlay: 65: [: -ne: unexpected operator

What distro are you running? What is your default /bin/sh?

I am using Raspbian on my device.

/bin/sh ? Can you give some more info on that ? I am quite new on using linux.

Thanks.

Saman

It looks like there is a bug in the dir-overlay script.

If you can add:

[ -n "${UID}" ] || UID=$(id -u)

into the file /usr/share/mender/modules/v3/dir-overlay just before the line that reads:

case "$STATE" in

then you will probably get past this. I’ll submit that as a proper bugfix for future releases.

Drew

Hi @drewmoseley,

I am still getting the error.

2020-11-11 20:13:17 +0000 UTC info: Running Mender client version: 2.4.0
2020-11-11 20:13:19 +0000 UTC info: State transition: update-fetch [Download_Enter] -> update-store [Download_Enter]
2020-11-11 20:13:19 +0000 UTC info: No public key was provided for authenticating the artifact
2020-11-11 20:13:19 +0000 UTC info: Update module output: + STATE=Download
2020-11-11 20:13:19 +0000 UTC info: Update module output: + 
2020-11-11 20:13:19 +0000 UTC info: Update module output: FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:19 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:19 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:19 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:19 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:19 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:19 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:19 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:19 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:19 +0000 UTC info: Update module output: + exit 0
2020-11-11 20:13:19 +0000 UTC info: Update module output: + STATE=SupportsRollback
2020-11-11 20:13:19 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:19 +0000 UTC info: Update module output: 
2020-11-11 20:13:19 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:19 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:19 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:19 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:19 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:19 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:19 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:19 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:19 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:19 +0000 UTC info: Update module output: + echo Yes
2020-11-11 20:13:19 +0000 UTC info: Update module output: + exit 0
2020-11-11 20:13:20 +0000 UTC info: State transition: update-store [Download_Enter] -> update-after-store [Download_Leave]
2020-11-11 20:13:20 +0000 UTC info: State transition: update-after-store [Download_Leave] -> update-install [ArtifactInstall]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + STATE=ArtifactInstall
2020-11-11 20:13:20 +0000 UTC info: Update module output: + 
2020-11-11 20:13:20 +0000 UTC info: Update module output: FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:20 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:20 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:20 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ 0 -ne 0 ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cat /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir=/home/pi/dir_overlay
2020-11-11 20:13:20 +0000 UTC info: Update module output: + mkdir -p /home/pi/dir_overlay /var/lib/mender/dir-overlay-install
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ -e /var/lib/mender/dir-overlay-install/manifest ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + mkdir -p /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + stat -c %a /home/pi/dir_overlay
2020-11-11 20:13:20 +0000 UTC info: Update module output: + chmod 755 /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + stat -c %U:%G /home/pi/dir_overlay
2020-11-11 20:13:20 +0000 UTC info: Update module output: + chown root:root /var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cat /var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + + cdtar -cpf /var/lib/mender/modules/v3/payloads/0000/tree/tmp/
2020-11-11 20:13:20 +0000 UTC info: Update module output:  - /home/pi/dir_overlay/etc/app.conf
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/etc/app.conf: Cannot stat: No such file or directory
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -cpf - /home/pi/dir_overlay/usr/bin/app
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cd /var/lib/mender/modules/v3/payloads/0000/tree/tmp/
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/usr/bin/app: Cannot stat: No such file or directory
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -cpf - /home/pi/dir_overlay/usr/share/app/data.txt
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cd /var/lib/mender/modules/v3/payloads/0000/tree/tmp/
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -xpf -
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Removing leading `/' from member names
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: /home/pi/dir_overlay/usr/share/app/data.txt: Cannot stat: No such file or directory
2020-11-11 20:13:20 +0000 UTC info: Update module output: tar: Exiting with failure status due to previous errors
2020-11-11 20:13:20 +0000 UTC info: Update module output: + tar -cpf /var/lib/mender/dir-overlay-install/backup.tar -C /var/lib/mender/modules/v3/payloads/0000/tree/tmp .
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cat /var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + rm /home/pi/dir_overlay/etc/app.conf
2020-11-11 20:13:20 +0000 UTC info: Update module output: rm: cannot remove '/home/pi/dir_overlay/etc/app.conf': No such file or directory
2020-11-11 20:13:20 +0000 UTC error: Update module terminated abnormally: exit status 1
2020-11-11 20:13:20 +0000 UTC error: transient error: Update module terminated abnormally: exit status 1
2020-11-11 20:13:20 +0000 UTC info: State transition: update-install [ArtifactInstall] -> rollback [ArtifactRollback]
2020-11-11 20:13:20 +0000 UTC info: Performing rollback
2020-11-11 20:13:20 +0000 UTC info: Update module output: + STATE=ArtifactRollback
2020-11-11 20:13:20 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:20 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:20 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:20 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ 0 -ne 0 ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cat /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir=/home/pi/dir_overlay
2020-11-11 20:13:20 +0000 UTC info: Update module output: + test -f /var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + cp /var/lib/mender/dir-overlay-install/manifest.prev /var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: cp: cannot stat '/var/lib/mender/dir-overlay-install/manifest.prev': No such file or directory
2020-11-11 20:13:20 +0000 UTC error: Update module terminated abnormally: exit status 1
2020-11-11 20:13:20 +0000 UTC error: Rollback failed: Update module terminated abnormally: exit status 1
2020-11-11 20:13:20 +0000 UTC error: fatal error: Update module terminated abnormally: exit status 1
2020-11-11 20:13:20 +0000 UTC info: State transition: rollback [ArtifactRollback] -> update-error [ArtifactFailure]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + STATE=ArtifactFailure
2020-11-11 20:13:20 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:20 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:20 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:20 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:20 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:20 +0000 UTC info: Update module output: + exit 0
2020-11-11 20:13:20 +0000 UTC info: State transition: update-error [ArtifactFailure] -> cleanup [Error]
2020-11-11 20:13:20 +0000 UTC info: Update module output: + STATE=Cleanup
2020-11-11 20:13:20 +0000 UTC info: Update module output: + FILES=/var/lib/mender/modules/v3/payloads/0000/tree
2020-11-11 20:13:20 +0000 UTC info: Update module output: + backup_dir=/var/lib/mender/modules/v3/payloads/0000/tree/tmp
2020-11-11 20:13:20 +0000 UTC info: Update module output: + dest_dir_file=/var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir
2020-11-11 20:13:20 +0000 UTC info: Update module output: + manifest_file_from_deployment=/var/lib/mender/modules/v3/payloads/0000/tree/files/manifest
2020-11-11 20:13:20 +0000 UTC info: Update module output: + update_files_tar=/var/lib/mender/modules/v3/payloads/0000/tree/files/update.tar
2020-11-11 20:13:21 +0000 UTC info: Update module output: + state_dir=/var/lib/mender/dir-overlay-install
2020-11-11 20:13:21 +0000 UTC info: Update module output: + manifest_file=/var/lib/mender/dir-overlay-install/manifest
2020-11-11 20:13:21 +0000 UTC info: Update module output: + manifest_file_prev=/var/lib/mender/dir-overlay-install/manifest.prev
2020-11-11 20:13:21 +0000 UTC info: Update module output: + prev_files_tar=/var/lib/mender/dir-overlay-install/backup.tar
2020-11-11 20:13:21 +0000 UTC info: Update module output: + [ -n  ]
2020-11-11 20:13:21 +0000 UTC info: Update module output: + id -u
2020-11-11 20:13:21 +0000 UTC info: Update module output: + UID=0
2020-11-11 20:13:21 +0000 UTC info: Update module output: + exit 0
2020-11-11 20:13:21 +0000 UTC info: State transition: cleanup [Error] -> update-status-report [none] 

Saman

@drewmoseley - edited for formatting

How are you generating the artifact you are installing? Can you include a complete shell log showing the commands you enter and the output they generate?

saman@saman-VirtualBox:~/Downloads/Yatri$ ARTIFACT_NAME=“my-update-1.5”
saman@saman-VirtualBox:~/Downloads/Yatri$ DEVICE_TYPE=“raspberrypi3”
saman@saman-VirtualBox:~/Downloads/Yatri$ OUTPUT_PATH=“my-update-1.5.mender”
saman@saman-VirtualBox:~/Downloads/Yatri$ DEST_DIR="/home/pi/dir_overlay"
saman@saman-VirtualBox:~/Downloads/Yatri$ OVERLAY_TREE=“rootfs_overlay”
saman@saman-VirtualBox:~/Downloads/Yatri$ ./dir-overlay-artifact-gen -n {ARTIFACT_NAME} -t {DEVICE_TYPE} -d {DEST_DIR} -o {OUTPUT_PATH} ${OVERLAY_TREE}
Artifact my-update-1.5.mender generated successfully:
Mender artifact:
Name: my-update-1.5
Format: mender
Version: 3
Signature: no signature
Compatible devices: ‘[raspberrypi3]’
Provides group:
Depends on one of artifact(s): []
Depends on one of group(s): []
State scripts:

Updates:
0:
Type: dir-overlay
Provides: Nothing
Depends: Nothing
Metadata: Nothing
Files:
name: update.tar
size: 10240
modified: 2020-11-12 02:53:30 +0545 +0545
checksum: 44118099007e657c54cc86add38d3a7d167a14d52456be79c4fe9a5afdd3516f
Files:
name: dest_dir
size: 21
modified: 2020-11-12 02:53:30 +0545 +0545
checksum: 3b73f45ef3bb0148064a24f4af80f1213cfda08e0960f82a4ae1f96bee9ee710
Files:
name: manifest
size: 48
modified: 2020-11-12 02:53:30 +0545 +0545
checksum: 8ffe642007fbdcfdb2617e709c6091d84bf510e2235c584134240ed922dd4185

When I set my DEST_DIR to “/”, the deployment succeeds. I am not sure why I fail on /home/pi/dir_overlay even though I have set the permission to 755 on both locations.

After the deployment succeeds, I am confused about what sort of output I should expect. After having used directory update and single-file update, I was expecting the overlaying directory to be located on the DEST_DIR, with its subdirectories. I can’t find rootfs_overlay directory anywhere on my device. Instead, I see backup.tar, manifest, and manifest.prev files at location /var/lib/mender/dir-overlay-install. When I extract the tar file, I could find the overlaying directories. Is it the way how dir-overlay works or am I missing out something?

Regards,
Saman

The files in /var/lib/mender/dir-overlay-install are state files and backups which is how the update module is able to handle rollback.

I don’t believe you will see a directory named rootfs_overlay/ but the contents from that directory should appear directly in your DEST_DIR.

Drew

1 Like

Thanks @drewmoseley