Support defaults in mender.conf by merging from several locations

Description

At the moment mender.conf is always bundled with the root file system, so it is contained in all Mender Artifacts created as well.

However, there are several cases where it is not desirable to make all settings in mender.conf Artifact-dependent. For example:

  • The partition layout (in particular which partitions the root file systems reside) may be different on different devices, so not a uniform setting during build time

  • TenantToken is different for different Hosted Mender customers, so demo Artifacts should not contain them (or they would need to be built for every customer)

  • The polling interval may depend on the device network interface (e.g. 3g, ethernet), which is not uniformly the same for each build across devices

The proposal:

Merge mender.conf from several locations, with lowering priority, in this order:

  • /etc/mender/mender.conf

    • Settings that need to be overridden in an update. In many cases this might be entirely empty, but could be used for updating the server URL, for example.

  • /var/lib/mender/mender.conf (/data)

    • Settings that are permanent for the system, such as RootfsA and RootfsB locations

Examples:

  • If TenantToken is specified in both /var/lib/mender/mender.conf and /etc/mender/mender.conf then the latter one will be used

  • If polling interval is only specified in /var/lib/mender/mender.conf that is the one that will be used

Acceptance criteria

  • If a setting is in /etc/mender/mender.conf, this will be used

  • If a setting is not in /etc/mender/mender.conf but is in /var/lib/mender/mender.conf, it will be used

  • If a setting is in both locations, the one in /etc/mender/mender.conf will be used

  • If /etc/mender/mender.conf does not exist, the settings in /var/lib/mender/mender.conf will be used

  • If neither /etc/mender/mender.conf nor /var/lib/mender/mender.conf exists or contain the required settings (e.g. rootfs partitions), an error is produced and Mender stops

  • The final settings are available in debug output from the Mender client

Affects versions

None

Environment

None

Checklist

Activity

Show:

Don CrossSeptember 30, 2018 at 12:04 AM

Don CrossSeptember 28, 2018 at 11:30 AM

@Kristian Amlie, that sounds fine. I will write something for the top of the configuration file section.

Dominik AdamskiSeptember 28, 2018 at 11:03 AM

I have created task for documentation update: https://tracker.mender.io/browse/MEN-2177

Kristian AmlieSeptember 28, 2018 at 10:51 AM

: We have created separate tasks for the Yocto and image conversion documentation (acceptance criteria that are part of and ), so you can just ignore those parts. I think just mentioning the two locations and how they are loaded should be enough, at the top of the configuration file section. More information about how to put it into use will come in the other two tasks. Is that ok?

Kristian AmlieSeptember 26, 2018 at 8:14 AM

: You're right, although this section should have dedicated parts for Yocto and for our upcoming image converter.

: Can you split this section as well, so that it has a Yocto specific and image converter specific part? I wrote to you in Slack as well.

Fixed

Details

Assignee

Reporter

Priority

Fix versions

Backlog

yes

Zendesk Support

Checklist

Created August 28, 2018 at 5:58 PM
Updated June 25, 2024 at 12:02 PM
Resolved October 2, 2018 at 10:53 AM