# Working with Golden Img and Symlink

**URL:** <https://hub.mender.io/t/working-with-golden-img-and-symlink/2035>\
**Category:** General Discussions\
**Tags:** raspberry-pi-3\
**Created:** [June 10, 2020, 8:13pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035 "2020-06-10T20:13:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fisicator](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fisicator/32/639_2.png) [@fisicator](https://hub.mender.io/u/fisicator)\
**Post date:** [June 10, 2020, 8:13pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/1 "2020-06-10T20:13:13Z")

</div>

Hi,

OS: Raspibian

I have a golden image that I use to create artifacts with mender-convert.  
So this golden image know nothing about mender and has no partitions nor mender client.

My doubt:

1. Where do I keep in my golden image files that must be kept between upgrades? AKA the files that should be in /data/ in field boards. Or my golden image should be already converted and using all the partitions structure of mender?
2. System files, for exemple, known networks, shall be treated the same way by symlinks?
3. What is the usual approach a bash command to call thoses symlinks in the system boot? Mender has some tools to organize and automate?

Thanks!  
Nilton

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 10, 2020, 9:33pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/2 "2020-06-10T21:33:56Z")

</div>

Hi @fisicator,

Normally the files that end up in /data will not be in your Golden Master image although that does present a bootstrapping issue.

@mirzak have we thought about processing files from the Golden Master that are already in a /data directory and making sure they are in the data partition after running mender-convert?

We don’t really have any tool to automate moving things and creating symlinks as that is going to vary widely depending on your distro and what specifically you want to maintain across OTA updates. Using a custom platform\_modify() function in mender-convert is likely the best approach here.

Drew

---

<div class="post-metadata">

**Author:** ![fisicator](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fisicator/32/639_2.png) [@fisicator](https://hub.mender.io/u/fisicator)\
**Post date:** [June 10, 2020, 11:28pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/3 "2020-06-10T23:28:01Z")

</div>

Dear @drewmoseley,

Thanks for your quickly reply.  
If the Golden Master does not have the files that end up in /data so it makes necessary remove them after final test/approval and then proceed with mender-convert?

And If my app uses a database file, golden database will be in one location, but field devices the same database file will be in /data partition, so again after golden master is tested and approved we need to modify the app code to point to a different location before running mender-convert?

Is it the way these issues should be dealed? Or am I going to the wrong way?

Again, /etc/wpa\_supplicant/wpa\_supplicant.conf where raspibian saves wi-fi networks.  
What is the best approach to deal with system files like these that must remain after OTA updates?

I am sorry if are too many questions, but all of this are very new for us.

Thanks!  
Nilton

---

<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 11, 2020, 7:37am UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/4 "2020-06-11T07:37:02Z")

</div>

> [@drewmoseley](#):
>
> @mirzak have we thought about processing files from the Golden Master that are already in a /data directory and making sure they are in the data partition after running mender-convert?

This should already be taken care of in the mender-convert tool. It does treat the `/data` directory in a “special” way and all of it contents in the Golden image, will be moved to the data partition during conversion.

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 11, 2020, 5:34pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/5 "2020-06-11T17:34:11Z")

</div>

@mirzak thanks for confirming. I was unaware it did that but glad to hear that it does.

@fisicator it looks like you can just put the files in /data in your golden image and mender-convert will move them into the newly created data partition. Just be aware that when that happens, any further changes you make to them in the golden image will no be in the OTA artifacts since the /data partition is explicitly excluded from OTA.

I do recommend you limit your testing on the golden master to just enough to determine that it is sane and then do the bulk of your testing on the converted image since that is the version that will be running on your target devices.

Replacing /etc/wpa\_supplicant/wpa\_supplicant.conf with a symlink to something in /data may work. You will need to test it to make sure though because not all network managers behave the same way. The alternative would be to change the invocation of wpa\_supplicant to actually look for the file in /data since I think it takes the filename as a command line parameter.

Drew

---

<div class="post-metadata">

**Author:** ![fisicator](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fisicator/32/639_2.png) [@fisicator](https://hub.mender.io/u/fisicator)\
**Post date:** [June 21, 2020, 2:20pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/6 "2020-06-21T14:20:28Z")

</div>

Thanks guys! I am running tests and will tell you if its going well.  
Best Regards

---

<div class="post-metadata">

**Author:** ![martind](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@martind](https://hub.mender.io/u/martind)\
**Post date:** [November 23, 2020, 9:39pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/7 "2020-11-23T21:39:31Z")

</div>

Hi,

I have the same question as @fisicator and I am also working on a Raspbian based image. I am just looking for clarification here:

If I understand correctly I can make a /data partition on my golden image SD card and any files located in there will be copied to the /data partition on my mender-converted image. Is that correct?

And I won’t rely on any files in the /data partition being included in OTA artifacts 🙂

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [November 24, 2020, 2:52pm UTC](https://hub.mender.io/t/working-with-golden-img-and-symlink/2035/8 "2020-11-24T14:52:18Z")

</div>

Hi @martind that is correct. Let us know if you encounter any issues with it but that’s how it is intended to behave.

Drew
