HowTo: Manage OpenHab 2 configurations

You are right… It does NOT get removed… See an example here: KNX Binding Configuration Changes cause Exception and another here: MQTT config under OH2 - #8 by watou
I haven’t opened an issue yet… Maybe I should :slight_smile:

In theory, there are 3 ways to do the same in OH2:

  1. Start Karaf with the clean option: /usr/share/openhab2/start.sh clean (which basically executes: /usr/share/openhab2/runtime/karaf/bin/karaf clean and performs the clean option: rm -Rf "$KARAF_DATA/**")
    or
  2. Modify: /usr/share/openhab2/runtime/karaf/etc/system.properties and set: karaf.clean.all = true and/or karaf.clean.cache = true
  3. Shutdown the Karaf console with the option (system:shutdown --clean-all)

I tried all 3 methods but I couldn’t get them to work properly

Also… there is another issue here…

In OH2, the KARAF_BASE directory is set to the same as KARAF_DATA (set in /usr/share/openhab2/runtime/karaf/bin/oh2_dir_layout)
If you delete the KARAF_DATA to clean the internal stuff, you will have problems because you will delete the KARAF_BASE also. The recommendation is to have different dirs for these 2.