Running My OSMC partially clears /boot/config.txt

I’m currently mucking with a bunch of sensors connected to my Raspberry Pi 2, some of which require changes in /boot/config.txt. For one I also needed to turn on I2C and according to the raspi-config dummy executable I should be able to find everything I need under My OSMC. So I went to check there and while I2C wasn’t in there (SPI is, though), it also deleted many/most of my custom directives from /boot/config.txt. Not commented out, deleted. My own comments around those lines were still there and fortunately I do keep proper backups so it was fairly easy to restore the file to working order. I then edited config.txt through SSH to finally add the I2C flags.

It’s very bad that it deletes things instead of just commenting them out – and even so, why would it negate the options anyways?

I’m running the April 2018 update by the way. I haven’t tried the steps again, but if it isn’t reproducible on another system then it might’ve been a one-off thing anyways.

My OSMC can be considered authoritative of config.txt

What options did you set that were deleted?
You can set all options via My OSMC if you’d like them to be preserved when it touches the file.

Agree. We will fix this.

Sam

@Hammen, could you share what your config.txt looks like? I’ll see if I can fix this for you.

dtoverlay/dtparam stuff mostly. I also have overclock-related options but starting My OSMC also cleared those, even though those settings were initially made through My OSMC.

Well, I couldn’t find something to set dtparam=i2c1=on in the first 3 config tabs. I could probably set it through the 4th (Config Editor) but if I’d have to do that I might as well just use SSH since it’s much faster. And, if I add something through SSH and only then open My OSMC, shouldn’t it keep my changes anyways? I can understand it’s considered authoritative but since they’re already there shouldn’t it simply use that for the “base”? Unless OSMC keeps track of what options it added in the past?

I tried uploading it as an attachment but apparently I can’t upload non-images, so I guess I’ll just have to use a pre block. Also, I added a few comments here and there to indicate what was removed and what wasn’t.

# For more options and information see
# https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
# Some settings may impact device functionality. See link above for details

### Overclocking
### Hammen: ALL of these (except my comments) were removed when opening My OSMC, although I initially set them through there
# Disable turbo mode altogether
initial_turbo=0
force_turbo=0

# Safe voltage adjustment
over_voltage=2

# Don't overclock RAM
over_voltage_sdram=0

# Lil CPU overclock
arm_freq=1000
core_freq=500


### HDMI
### Hammen: All of these were kept, also added through My OSMC using the Display tab
# No overscan
disable_overscan=1

# Use EDID file instead of reading from monitor
hdmi_edid_file=1

# Disable rainbow splash screen
disable_splash=1

# Start X on boot
start_x=1

# Aspect ratio for SDTV
sdtv_aspect=1

# Always pretend there's an HDMI signal
hdmi_force_hotplug=1

# Ignore CEC init (like turn on your TV on rPI reboot)
hdmi_ignore_cec_init=1

# DVI or HDMI mode (only affects audio etc)
hdmi_drive=2


### Various GPU memory sizes for different Raspberry models
### Hammen: Same as HDMI, except used GPU Mem & Codec tab to add them
gpu_mem_256=112
gpu_mem_512=144
gpu_mem_1024=256


### Some device trees
### Hammen: All gone too, set these through SSH > vim /boot/config.txt
# Temp sensor uses w1 and GPIO 4
dtoverlay=w1-gpio,gpiopin=4

# BMP280 pls
dtparam=i2c1=on
dtparam=i2c_arm=on

You can run paste-log /boot/config.txt and post the URL.

Yeah, I suppose pastebin or something similar would’ve worked too, but it’s not a lot of text and it’s already in my previous post anyways. =]

Of course. Just so you’re aware of the available options.

I’ve been looking at this, but haven’t been able to completely reproduce it. Could you share what the config.txt looks like after MyOSMC has changed it?

I’ve been trying it too, but I’m unable to reproduce exactly what happened as well. I can make it do parts of it if I go into My OSMC > Overclock and hit Apply without changing anything at all. In this case, it removes only dtoverlay=w1-gpio,gpiopin=4 and keeps everything else intact (including the BMP280 stuff). But still it actually removes something instead of commenting out what it doesn’t deem compatible.

I may have gone into Overclock the first time as well, but I don’t remember for sure nor do I know for certain if I hit Apply then too, or simply did a right-mouse click.

That’s all I’ve been able to reproduce also. I’ll work on a fix to at least comment the line. Preferably I’ll add that as a valid config.

I may have an idea what caused it to clear much more of the config the first time around. I had recently updated from the December 2017 update to April, maybe OSMC needed to reinitialise the variables it knows about?