How to extract the mender artifact content

I have a .mender file and I want to extract the content. I tried “mender-artifact dump artifact_name.mender”, but nothing gets extracted. I also tried “mender-artifact cp” with no success. See blow some (slightly obfuscated) commands.

“mender-artifact read artifact_name.mender” will display the content, as I expected. I am running mender-artifact version 3.3.0.

$ mender-artifact read image-board-20201013213940.mender
Mender artifact:
Name: mcg-01.00.001_d
Format: mender
Version: 3
Signature: no signature
Compatible devices: ‘[board]’
Provides group:
Depends on one of artifact(s): []
Depends on one of group(s): []
State scripts:

Type: rootfs-image
Provides: Nothing
Depends: Nothing
Metadata: Nothing
name: image-board.ext4
size: 5687476224
modified: 2020-10-13 17:42:34 -0400 EDT

$ mender-artifact cp image-board-20201013213940.mender:image-board.ext4 file.ext4
The file: image-board.ext4 does not exist in the image

Thank you for your help,

1 Like

I believe the mender file is just a tar file if you just need to get at the contents

tar works!


Yeah, tar should work.

But the mender-artifact dump command can also be useful, but you need to specify what you want to extract,

Example to extract payload files:

mkdir files
mender-artifact dump --files files *.mender

Check the --help for additional arguments,

$ mender-artifact dump --help
   mender-artifact dump - Dump contents from Artifacts

   mender-artifact dump [command options] <Artifact>

   Dump various raw files from the Artifact. These can be used to create a new Artifact with the same components.

   --files value      Dump all included files in the first payload into given folder
   --meta-data value  Dump the contents of the meta-data field in the first payload into given folder
   --scripts value    Dump all included state scripts into given folder
   --print-cmdline    Print the command line that can recreate the same Artifact with the components being dumped. If all the components are being dumped, a nearly identical Artifact can be created. Note that timestamps will cause the checksum of the Artifact to be different, and signatures can not be recreated this way. The command line will only use long option names.