I tried to update a file by using mender-artifact (single-file-artifact-gen works fine)
but I got a error message bellow
info: Running Mender client 4.0.3
info: Deployment with ID 3f5c7979-1a4b-4a47-887f-4f5c7d0a0a0d started.
info: Sending status update to server
info: Installing artifact…
info: Sending status update to server
info: Update Module output (stderr): cat: {…}
info: Update Module output (stderr): /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir{…}
info: Update Module output (stderr): : No such file or directory{…}
info: Update Module output (stderr):
error: Process returned non-zero exit status: ArtifactInstall: Process exited with status 1
info: Update Module output (stderr): cat: {…}
info: Update Module output (stderr): /var/lib/mender/modules/v3/payloads/0000/tree/files/filename{…}
info: Update Module output (stderr): : No such file or directory{…}
info: Update Module output (stderr):
error: Process returned non-zero exit status: ArtifactRollback: Process exited with status 1
info: Sending status update to server
I’m using command bellow, any suggestions would be greatly appreciated
mender-artifact write module-image
-n myservice-update-1
-t ubuntu
-T single-file
-f my_file.txt
-o myservice-update-1.mender
Hi @samfrliu,
Your invocation of mender-artifact
does create an artifact which has the single-file
type, but misses a number of the things that single-file-artifact-gen
does. If you look at mender/support/modules-artifact-gen/single-file-artifact-gen at 793909fbcde154c93509060058b55e3d1b4cb31f · mendersoftware/mender · GitHub and the following lines, it is not just the payload file that you need to transport, but also additional files that hold the metadata(permissions, paths, and so on). Hence it is advisable to either use the provided script which handles all of it as required, or make sure that you actually replicate all necessary parts.
Greets,
Josef
Thanks for the reply, but I don’t really understand…
I want update “/home/ubuntu/my_file.txt” on my ubuntu
Could you please give me a sample for my purpose?
@samfrliu the easiest way is to just use the web UI:
If you upload the file there, then you can provide the path, for example
/home/ubuntu/my_file.txt
, and the matching artifact will be automatically generated.
For doing it on the command line, please use the single-file-artifact-gen
script. Example:
single-file-artifact-gen my_file.txt \
--dest-dir "/home/ubuntu" \
--artifact-name my-file-1.0 \
--output-path my-file-1.0.mender \
--device-type $WHATEVERYOURDEVICETYPEIS
Greets,
Josef
Thanks for the reply, I know “single-file-artifact-gen” can work fine, but if I want add a script & signature, it must be “mender-artifact”, right?
Or mender-artifact can not be used on single-file?
@samfrliu no, single-file-artifact-gen
ist just a script that calls mender-artifact
internally too. If you want to add special parameters like for signing, you can pass them after --
, like
single-file-artifact-gen my_file.txt \
--dest-dir "/home/ubuntu" \
--artifact-name my-file-1.0 \
--output-path my-file-1.0.mender \
--device-type $WHATEVERYOURDEVICETYPEIS
-- \
-k $YOURKEYFILE
I strongly suggest to look at the single-file-artifact-gen
script, it has a long help and explanation section right at the top.
Greets,
Josef
I figure out how to set parameter
thanks for your great help