Mender Convert - Data Partition / Rootfs Overlay Permissions

Hi,

Following a previous discussion I’ve been looking into using mender convert rather than snapshots

And I think it’s very nearly there however I have two areas I’m not clear on:

I’m running a program which writes out to a file in the users home directory, I’d like this file to persist between rootfs updates.

I understand that the /data partition should be used for this however I don’t have write access as the partition is owned by root.

Is there a way to configure mender-convert to change the permissions on the created partitions during the conversion?

Or would it be possible to use state scripts to move files from home to /data and back again during the update process?

My other issue is using rootfs overlays, is there any information on what the permissions / owner of overlay files need to be on the host machine or how ownership is assigned during conversion?

I can’t seem to reliably recreate the issue but when using an overlay (just adding a file to home directory) the file is added correctly however the permissions of other files seemed to be randomly altered (e.g. /etc is owned by pijuice which is a user created by the UPS software similar for random files in the home directory)

Any assistance of info would be greatly appreciated

Thanks

With respects to data partition, in your golden master, setup the /data folder with a subfolder structure as per your requirements with correct permissions and it’ll get copied to the data partition during mender-convert conversion

1 Like

You also have hooks available to make changes during the mender-convert process

https://docs.mender.io/system-updates-debian-family/convert-a-mender-debian-image/customization

1 Like

Thank you for the quick reply

Just to clarify, I don’t need a separate data partition on my master image but only a folder called data placed at root /?

Yes, that’s correct. Also, regarding ownership, I think anything created in your golden master will be copied into the new image with the same ownership and permissions.

You can also add files through the mender-convert rootfs-overlay in a similar fashion.

Drew

2 Likes

Thanks for the reply

Tried this morning and no luck, do I need to alter a config / parameter somewhere?
I’m just using the base scripts/configs from mender-convert and adding a custom config just for LZMA compression

I’ve added a data folder to my golden image’s root which contains a second folder inside (backup) that is owned by the user so they have a place to backup to between rootfs updates.

However it doesn’t seem to copy over to the converted image/artifact, after uploading and deploying I see /data/mender/... but no /data/backup/... on the updated Pi

if starting with the golden master, then you need to do a full re-image of the device from the full disk image created by mender-convert, it wont be part of the mender-artifact as far as i’m aware.

1 Like

Ah of course, enrolled devices will already have a /data partition configured which isn’t being touched by a rootfs update

Flashed a full image and that Pi seems to have the correct structure with the backup folder under /data will do some testing with it tomorrow

I guess I’ll have to reflash my existing devices or remote in and manually restructure /data

Thanks again