# Mender-artifact hangs

**URL:** <https://hub.mender.io/t/mender-artifact-hangs/752>\
**Category:** General Discussions\
**Tags:** mender-artifact\
**Created:** [June 25, 2019, 5:41pm UTC](https://hub.mender.io/t/mender-artifact-hangs/752 "2019-06-25T17:41:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ster](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ster/32/282_2.png) [@ster](https://hub.mender.io/u/ster)\
**Post date:** [June 25, 2019, 5:41pm UTC](https://hub.mender.io/t/mender-artifact-hangs/752/1 "2019-06-25T17:41:46Z")

</div>

I’m trying to use `mender-artifact` to modify files inside a mender artifact built with mender-convert ~~without success~~ (see update below).

I [downloaded precompiled binary](https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/3.0.1/mender-artifact) and placed it inside `mender-convert/output/`

Checking version and obtaining help works fine:

```
$ ./mender-artifact -v
mender-artifact version 3.0.1

```

But as soon as I invoke any command on a mender artifact (I tried `cat`, `cp`, `validate`), it just hangs forever, loading one CPU core to 100%.

```
./mender-artifact cat raspberry_hub_raspbian04.2019_Scanner5.1.0_mender.mender:/etc/hosts

```

As I said, .mender artifact is the output of the latest mender-convert. I can open it as a tarball, contents seem to be correct.

**UPDATE**  
I downloaded the [demo artifact](https://d1b0l86ne08fsf.cloudfront.net/1.5.1/raspberrypi3/raspberrypi3_release_1_1.5.1.mender) and tried to use `mender-artifact` with it and it worked, but `cat` command took couple of seconds. So considering that my artifact is ~10x bigger than the demo one, I waited a bit more and bingo it actually worked. But it took ~3 minutes.

The `cp` command took twice as long:

```
~/mender-convert/output $ date +%R && ./mender-artifact cp mender.conf raspberry_hub_raspbian04.2019_Scanner5.1.0m_mender.mender:/etc/mender/mender.conf && date +%R
19:26
19:33

```

I understand that limitation probably comes from the fact that the artifact should be uncompressed and compressed back every time.  
But considering that I have a dozen of files (config, identity, inventory and some state-scripts) to copy into the artifact generated by mender-convert, is there a more efficient workflow to do so?  
Maybe mounting .ext4 and use mender-artifact to generate the artifact is a viable idea? If yes, can I somehow ask mender-convert to not generate the .mender file?

In any case, I think a note about performance limitations of `mender-artifact` should be placed in the docs. Or the program itself should output the info to console that it may take a while.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 26, 2019, 7:00am UTC](https://hub.mender.io/t/mender-artifact-hangs/752/2 "2019-06-26T07:00:27Z")

</div>

> [@ster](#):
>
> Maybe mounting .ext4 and use mender-artifact to generate the artifact is a viable idea? If yes, can I somehow ask mender-convert to not generate the .mender file?

I think you have figured out the most optimal approach. Unfortunately mender-convert is not very extend currently but this is something that we are looking at to make it easier to make custom modifications during a conversion process, e.g inserting configuration files, application files etc.

> If yes, can I somehow ask mender-convert to not generate the .mender file?

No this is currently not optional.

> In any case, I think a note about performance limitations of `mender-artifact` should be placed in the docs. Or the program itself should output the info to console that it may take a while.

Good points, and makes sense to add more information. Probably the tool it self should be aware of time necessary and print something.

I have created a task for it, so it is not forgotten,

[https://tracker.mender.io/browse/MEN-2609](https://tracker.mender.io/browse/MEN-2609)

Also pull-requests are welcome 😃

---

<div class="post-metadata">

**Author:** ![eystein](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@eystein](https://hub.mender.io/u/eystein)\
**Post date:** [June 26, 2019, 10:18pm UTC](https://hub.mender.io/t/mender-artifact-hangs/752/3 "2019-06-26T22:18:15Z")

</div>

@ster good points, and indeed these slow operations can be annoying.

As you mention, decompression/compression is one thing, but there are also checksums (verified and generated) to ensure that the artifact is not corrupted before you cat/modify and to ensure integrity can be checked after modification as well.

As one idea, would it help your workflow if cp / install took several files that could be copied in one operation? Or are there many other operations you need to do in the same go (e.g. cat)?

Regardless I think mender-artifact should inform about these slow operations, and also support some kind of progress indicator. We can follow up with more in-depth discussions on that in the ticket @mirzak created ([https://tracker.mender.io/browse/MEN-2609](https://tracker.mender.io/browse/MEN-2609)).

---

<div class="post-metadata">

**Author:** ![ster](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ster/32/282_2.png) [@ster](https://hub.mender.io/u/ster)\
**Post date:** [June 27, 2019, 9:49am UTC](https://hub.mender.io/t/mender-artifact-hangs/752/4 "2019-06-27T09:49:45Z")

</div>

> As one idea, would it help your workflow if cp / install took several files that could be copied in one operation?

Yes It would help a bit, but according to `mender-artifact cp --help`, it doesn’t seem to support copying multiple files in one run. Please correct me if I’m wrong.

Anyway, as I also need to add Artifact state scripts to already created mender artifacts and `mender-artifact` doesn’t support this, I ended up with the following workflow as the most time efficient:

1. run mender-convert and kill it as soon as it starts creating .mender file
2. mount .sdimg and copy all files inside (mender.config, identity, inventiry, client state-scripts)
3. mount .ext4 and perform the same copying
4. create mender artifact from .ext4, adding artifact state scripts using `mender-artifact write rootfs-image .... --script <artifactScript>`

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [December 10, 2019, 9:35am UTC](https://hub.mender.io/t/mender-artifact-hangs/752/5 "2019-12-10T09:35:41Z")

</div>

Hello,  
I am interested in this issue as well, and noticed the latest version of mender-artifact is 3.2.1  
Where could I find the release information or if this is a planned feature to take a look at?

Regards

---

<div class="post-metadata">

**Author:** ![mvargasevans](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mvargasevans/32/402_2.png) [@mvargasevans](https://hub.mender.io/u/mvargasevans)\
**Post date:** [December 10, 2019, 9:39am UTC](https://hub.mender.io/t/mender-artifact-hangs/752/6 "2019-12-10T09:39:47Z")

</div>

Never mind.  
[https://docs.mender.io/2.2/release-information/release-notes-changelog#mender-221](https://docs.mender.io/2.2/release-information/release-notes-changelog#mender-221)
