# Settings file not found / balena.cfg

**URL:** <https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309>\
**Category:** Product support\
**Created:** [November 2, 2018, 6:24pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309 "2018-11-02T18:24:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bix](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bix](https://forums.balena.io/u/bix)\
**Post date:** [November 2, 2018, 6:24pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/1 "2018-11-02T18:24:03Z")

</div>

Hello, this is my first post here 😃

How do I resolve this error?  
Settings file not found or not in proper format. Rewriting default settings to: /root/.balena/balena.cfg

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [November 6, 2018, 10:05am UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/4 "2018-11-06T10:05:42Z")

</div>

Hi @bix,

Would you mind providing a little more detail on where you are seeing that error/what device type/OS version?

---

<div class="post-metadata">

**Author:** ![bix](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bix](https://forums.balena.io/u/bix)\
**Post date:** [November 6, 2018, 5:02pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/5 "2018-11-06T17:02:40Z")

</div>

Hi @xginn8,

I see that error in the Balena Logs every time my service starts.

Running on a RasPi 3 B+

balenaOS 2.24.0+rev1 (dev)

May be related to the name change as I don’t recall seeing it prior? Other thought I had was local mode messing with it - I’ve been toggling local mode off and on a bit.

---

<div class="post-metadata">

**Author:** ![pimterry](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pimterry/32/140_2.png) [@pimterry](https://forums.balena.io/u/pimterry)\
**Post date:** [November 7, 2018, 12:18pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/6 "2018-11-07T12:18:46Z")

</div>

Hi @bix, this message comes from the Python SDK. Could you tell us a little more about how you’re using the SDK in your application?

In general, this message isn’t something to be worried about. It’s just letting you know that a default settings file has been generated. If you’d like to get rid of it, the easiest option is to commit the generated config file as part of your application, so it isn’t regenerated from scratch in future.

---

<div class="post-metadata">

**Author:** ![bix](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bix](https://forums.balena.io/u/bix)\
**Post date:** [November 7, 2018, 10:38pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/7 "2018-11-07T22:38:43Z")

</div>

Hi @pimterry,

I’ve just been testing out the SDK to figure out which aspects I may use. I’ll try committing the generated file, thank you!

I’ve logged in a few different ways (user/pass, token)

I’ve created, accessed and updated environment variables. Ran into some issues here - I can’t recall what threw the error but it was likely updating or removing given this thread: [Python SDK: Creating/Updating/Removing environment variables (from device itself)](https://forums.balena.io/t/python-sdk-creating-updating-removing-environment-variables-from-device-itself/2728)

I’ve also accessed various other things - configuration, device types, tags, etc.

Couple of errors I did log (copied these commands from the SDK doc):

#AttributeError: ‘ServiceEnvVariable’ object has no attribute ‘get\_all’  
#print(balena.models.environment\_variables.service\_environment\_variable.get\_all(APPID))

#TypeError: ‘DeviceServiceEnvVariable’ object is not callable  
#print(balena.models.environment\_variables.device\_service\_environment\_variable(int(APPID)))

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [November 7, 2018, 11:35pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/8 "2018-11-07T23:35:10Z")

</div>

Hi @bix

I believe what you are looking for are the following snippets:

```
print(balena.models.environment_variables.service_environment_variable.get_all_by_application(APPID))
print(balena.models.environment_variables.device_service_environment_variable.get_all_by_application(APPID))

```

I will make sure the documentation is updated, I hope this helps!

edit: the fixup PR is here: [https://github.com/balena-io/resin-sdk-python/pull/119](https://github.com/balena-io/resin-sdk-python/pull/119)

---

<div class="post-metadata">

**Author:** ![thgreasi](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thgreasi/32/454_2.png) [@thgreasi](https://forums.balena.io/u/thgreasi)\
**Post date:** [November 9, 2018, 8:44am UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/10 "2018-11-09T08:44:19Z")

</div>

Hey @bix,

One more thing, the `Settings file not found or not in proper format. Rewriting default settings to: /root/.balena/balena.cfg` is a warning when the SDK can’t find a proper setting file (no setting file, missing mandatory keys or incorrect format…), it will try to back up your current setting and write a new default setting file so you just need to check the printed path like `/root/.balena/` in your case to see what’s wrong.

The aforementioned PR is now merged and the docs should be now mention the correct commands.  
Thanks for bringing this up.

---

<div class="post-metadata">

**Author:** ![bix](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bix](https://forums.balena.io/u/bix)\
**Post date:** [November 13, 2018, 5:25pm UTC](https://forums.balena.io/t/settings-file-not-found-balena-cfg/4309/12 "2018-11-13T17:25:14Z")

</div>

@xginn8 @thgreasi,

Thank you both for the support! I haven’t been working with the SDK the past few days so I haven’t given the fixes a shot yet but I will post if I run into anymore problems.
