# Mender-update install 4.0.6 gives Json error because missing /var/lib/mender/mender.conf

**URL:** <https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660>\
**Category:** General Discussions\
**Tags:** mender-client\
**Created:** [March 20, 2025, 3:05pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660 "2025-03-20T15:05:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 20, 2025, 3:05pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/1 "2025-03-20T15:05:49Z")

</div>

```auto
record_id=29 severity=trace time="2025-Mar-20 15:52:49.055568" name="Global" msg="Entry name: headers/0000/meta-data" 
record_id=30 severity=trace time="2025-Mar-20 15:52:49.055782" name="Global" msg="StringToType: headers/0000/meta-data" 
record_id=31 severity=trace time="2025-Mar-20 15:52:49.056995" name="Global" msg="sub-header: looking for meta-data" 
record_id=32 severity=trace time="2025-Mar-20 15:52:49.057215" name="Global" msg="Parsing the header meta-data" 
record_id=33 severity=trace time="2025-Mar-20 15:52:49.057851" name="Global" msg="Received json load error: Failed to parse JSON from stream: [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal" 
record_id=34 severity=trace time="2025-Mar-20 15:52:49.058091" name="Global" msg="Received an empty Json body. Not treating this as an error" 
record_id=35 severity=trace time="2025-Mar-20 15:52:49.058385" name="Global" msg="sub-header: parsed the meta-data" 
Installing artifact...
record_id=36 severity=error time="2025-Mar-20 15:52:49.059771" name="Global" msg="Type error: Invalid JSON type to get children from" 

```

It says here [mender-artifact/Documentation/artifact-format-v3.md at 4.0.0 · mendersoftware/mender-artifact · GitHub](https://github.com/mendersoftware/mender-artifact/blob/4.0.0/Documentation/artifact-format-v3.md#meta-data) that:

meta-data

Format: JSON

Meta data about the image. This depends on the `type` in `header-info`. For `rootfs-image` there are no additional information needed and _the file might be empty._

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [March 20, 2025, 4:39pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/2 "2025-03-20T16:39:16Z")

</div>

Hi @ernstp-se,

Thanks for reaching out. Reading through the documentation and code, it sounds like this might be a regression from Client 3.x to 4.x/5.x, but I have to verify it. I take it that you’re using a custom-crafted mechanism to create the artifact? Did this work up to now, or is it a recent addition?

Judging from the code additionally, a very quick workaround might be to not include the `meta-data` key at all, as it is considered fully optional.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 20, 2025, 5:42pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/3 "2025-03-20T17:42:06Z")

</div>

mender-artifact 3.10.0 + mender-client 3.10.0: ok  
mender-artifact 3.10.0 + mender-client 4.0.6: fail  
mender-artifact 4.0.0 + mender-client 4.0.6: fail

Yeah right, this is a regression, mender-client 3.10.0 accepts these files.

Not using any custom mechanism to create the artifact, meta-mender with the image type mender for both kirkstone and scarthgap seems to create files like this using the mender-artifact tool.

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [March 20, 2025, 5:50pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/4 "2025-03-20T17:50:36Z")

</div>

@ernstp-se strange. Ok, I’ll look into it. Can you drop the commit revision of `meta-mender` that you’re using?

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 20, 2025, 6:58pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/5 "2025-03-20T18:58:50Z")

</div>

The .mender artifact seems to be created with empty “header-info” by both

commit df6b158fb00fb5c9d524bff277122adfc1a5e6ff (tag: kirkstone-v2023.02)

and

commit 694ac37314167a2b5445f503c1baaeb3b1b15a4e (scarthgap)

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 21, 2025, 8:08am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/6 "2025-03-21T08:08:26Z")

</div>

Hi @ernstp-se,

This indeed seems like a bad regression. I cannot understand (yet) how it went unnoticed.

Could you share the headers of the exact artifact that is triggering this issue? I crafted this command that should do the job, but check the output before pasting it here in case it has some sensitive information from your end:

```auto
tar -xf YOUR-ARTIFACT.mender header.tar.gz
tar -xf header.tar.gz
echo header-info; cat header-info; echo;
for file in $(find headers/ -type f); do echo $file; cat $file; echo; done

```

Something like that. Thank you!

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 21, 2025, 8:58am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/7 "2025-03-21T08:58:35Z")

</div>

@ernstp-se Can you also share with us the output of `mender-update show-provides` from the device?

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 21, 2025, 9:26am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/8 "2025-03-21T09:26:59Z")

</div>

```auto
# tar -xf tmp/deploy/images/esmi-fdp/esmi-image-master-esmi-fdp.mender
# tar -xf header.tar.gz
# echo header-info; cat header-info; echo;
header-info
{"payloads":[{"type":"rootfs-image"}],"artifact_provides":{"artifact_name":"localbuild-20250320114522"},"artifact_depends":{"device_type":["esmi-fdp"]}}
# for file in $(find headers/ -type f); do echo $file; cat $file; echo; done
headers/0000/meta-data

headers/0000/type-info
{"type":"","artifact_provides":{"rootfs-image.update-module.deb.mender_update_module":"deb","rootfs-image.update-module.deb.version":"localbuild-20250320114522","rootfs-image.update-module.directory.mender_update_module":"directory","rootfs-image.update-module.directory.version":"localbuild-20250320114522","rootfs-image.update-module.docker.mender_update_module":"docker","rootfs-image.update-module.docker.version":"localbuild-20250320114522","rootfs-image.update-module.rpm.mender_update_module":"rpm","rootfs-image.update-module.rpm.version":"localbuild-20250320114522","rootfs-image.update-module.script.mender_update_module":"script","rootfs-image.update-module.script.version":"localbuild-20250320114522","rootfs-image.update-module.single-file.mender_update_module":"single-file","rootfs-image.update-module.single-file.version":"localbuild-20250320114522","rootfs-image.version":"24.12.9999"},"clears_artifact_provides":["artifact_group","rootfs_image_checksum","rootfs-image.*"]}

```

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 21, 2025, 11:35am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/9 "2025-03-21T11:35:44Z")

</div>

Thank you @ernstp-se

The header is just fine. You can see that the meta-data is a purely empty file, which is allowed, and also from your logs you can see a trace one saying: “Received an empty Json body. Not treating this as an error”

So the parsing of the Artifact header succeeds, and indeed the Client starts the installation.

Then, the error triggers.

It is a big mystery for me right now. The only relevant place in the code that GetChildren() is used is [here](https://github.com/mendersoftware/mender/blob/819acd636a4974774d136e7753a508d9eb02bee2/src/mender-update/context/context.cpp#L175), but that should be called _before_ we do “Installing Artifact…” (and it is also called even before when performing the API call to the server).

I need to experiment a bit more to find out the root cause.

Can you provide the output of `mender-update show-provides` ?

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 21, 2025, 1:12pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/10 "2025-03-21T13:12:53Z")

</div>

Oh I see, I was focused on that error but it does actually continue a little bit.

```auto
mender-update -l trace show-provides
record_id=1 severity=debug time="2025-Mar-21 14:09:03.382745" name="Global" msg="Failed to load config from '/var/lib/mender/mender.conf': Failed to open '/var/lib/mender/mender.conf': No such file or directory"
Could not fulfill request: Type error: Invalid JSON type to get children from

```

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 21, 2025, 1:16pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/11 "2025-03-21T13:16:46Z")

</div>

We have been using /etc/mender/mender.conf but that is no longer used… ?

```auto
mender-update -c /etc/mender/mender.conf -l trace show-provides
record_id=1 severity=debug time="2025-Mar-21 14:14:27.017670" name="Global" msg="Failed to load config from '/var/lib/mender/mender.conf': Failed to open '/var/lib/mender/mender.conf': No such file or directory"
Could not fulfill request: Type error: Invalid JSON type to get children from

```

env | grep MENDER is empty.

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 21, 2025, 2:35pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/12 "2025-03-21T14:35:04Z")

</div>

@ernstp-se Bingo! That must be the real problem.

First, please note that the error message there is just a debug entry - it warns that it did correctly parsed `/etc/mender/mender.conf `but failed on the extra one in the persistent partition `/var/lib/...`. It might be that you are just not using it on your deployment. But **this is not an issue**.

The issues is in parsing the provides from the database, as I suspected. Although it is still a mystery why the client can do the API call for asking for deployments if it cannot even read the stored provides (unless it is defaulting to the v1 deployments/next 🤔 )

I unfortunately don’t have more time today to help out but the next step is to dump the database and see what are the contents of the artifact\_provides key. I can help on that next week, of mabye @TheYoctoJester can give you the recipe.

Also please let’s look at the logs of the API calls when the client checks for deployments, I bet there is an error there and it is just silently doing a fallback to the v1 deployments/next API call.

Have a good weekend,  
Lluis

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 24, 2025, 9:50am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/13 "2025-03-24T09:50:06Z")

</div>

What is the best way to dump the database?

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 24, 2025, 12:09pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/14 "2025-03-24T12:09:18Z")

</div>

After running `rm /var/lib/mender/mender-store*` I could run mender-update install. Just trying to understand the problem, not suggesting this is a solution…

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [March 25, 2025, 7:50am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/15 "2025-03-25T07:50:14Z")

</div>

@ernstp-se I’ve been offline few days, just today catching up and wanted to provide you the recipe to do the backup + dump the database… I see it is too late now 🫠

> What is the best way to dump the database?

With [`lmdb_dump`](http://www.lmdb.tech/doc/man1/mdb_dump_1.html).

> After running `rm /var/lib/mender/mender-store*` I could run mender-update install

There was something corrupted in the database, hence the error from `show-provides` but I wanted to find out how you ended up in that situation. Did you take a backup of the database? 🙏 Otherwise we cannot investigate further.

Please report back if you get back to this state.

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [March 26, 2025, 3:06pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/16 "2025-03-26T15:06:54Z")

</div>

I did make a copy of the database. And now I actually reproduce the issue. Not sure how yet though!

Where can I find lmdb\_dump?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 2, 2025, 1:16pm UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/17 "2025-04-02T13:16:17Z")

</div>

Hi @ernstp-se,

The binary name is `mdb_dump`, sorry. On Yocto it is installed by default along the Mender Client, on Debianoids it is in the `lmdb-utils` package.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![ernstp-se](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ernstp-se/32/2464_2.png) [@ernstp-se](https://hub.mender.io/u/ernstp-se)\
**Post date:** [April 4, 2025, 11:03am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/18 "2025-04-04T11:03:11Z")

</div>

mdb\_dump -V  
LMDB 0.9.31: (July 10, 2023)

mdb\_dump -n mender-store  
mdb\_env\_open failed, error -30793 MDB\_INVALID: File is not an LMDB file

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [April 7, 2025, 9:31am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/19 "2025-04-07T09:31:39Z")

</div>

@ernstp-se Can you share with me the file?

---

<div class="post-metadata">

**Author:** ![lukip](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@lukip](https://hub.mender.io/u/lukip)\
**Post date:** [May 15, 2026, 9:52am UTC](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660/20 "2026-05-15T09:52:42Z")

</div>

I see this thread is older than one year, but since I stumbled across the (presumambly) same issue, I want to share my findings.

In my case I wanted to update rather old devices running mender 2.2 (Yocto thud) to 5.1.0 (Yocto scarthgap).

However when trying to update, I get OP’s error as well:  
`Could not fulfill request: Type error: Invalid JSON type to get children from`

I dumped the mender-store database, whose data part converted from HEX to ASCII is this:  
`artifact-group`

`artifact-name`  
`1.3.12`  
`artifact-provides`  
`null`

Not sure how the database ended up in this state. I could not reproduce it on a freshly installed device.

Anyway I checked the mender source code and think mender 5.1.0 does not handle the value string `null` very well in `src/mender-update/context/context.cpp:177-185`. For me, this simple patch did the trick:

```auto
diff --git a/src/mender-update/context/context.cpp b/src/mender-update/context/context.cpp
index b32e4bf7..4533373e 100644
--- a/src/mender-update/context/context.cpp
+++ b/src/mender-update/context/context.cpp
@@ -174,7 +174,7 @@ ExpectedProvidesData MenderContext::LoadProvides(kv_db::Transaction &txn) {
    if (artifact_group != "") {
        ret["artifact_group"] = artifact_group;
    }
- if (artifact_provides_str == "") {
+ if (artifact_provides_str == "" || artifact_provides_str == "null") {
        // nothing more to do
        return ret;
    }

```

[Next page](https://hub.mender.io/t/mender-update-install-4-0-6-gives-json-error-because-missing-var-lib-mender-mender-conf/7660.md?page=2)
