Valid upgrade path from 2.4 to 2.5?

Folks,

I have 2.4 running on an RPi (Not Habian)
I want to move and upgrade to a different RPi an docker.

  1. I create a new container with 2.5 and start it.
  2. I can see the web UI and follow the tutorial, install the default UIs
  3. I exec into the container and run a restore from my 2.4 backup zip.
  4. I restart the container.

I get nothing. :frowning:

  • I see the runtime.cfg is not updated and shows the karaf binding is still 127.0.0.1 and commented out.
  • I see there are still references to ā€œorg.eclipse.smarthomeā€. I thought this was supposed to be removed (the eclipse part)?
  • I get the following in the log files
2019-12-16 20:30:08.856 [WARN ] [org.apache.felix.fileinstall                      ] - /usr/share/openhab2/addons does not exist, please create it.
2019-12-16 20:30:08.955 [ERROR] [org.apache.felix.fileinstall                      ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-12-16 20:30:08.956 [ERROR] [org.apache.felix.configadmin                      ] - [org.osgi.service.cm.ManagedServiceFactory, id=39, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.80a2cfbd-b3be-483c-bb41-59dbce24ca5e
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareDir(DirectoryWatcher.java:647) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareTempDir(DirectoryWatcher.java:627) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.<init>(DirectoryWatcher.java:179) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:248) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378) ~[?:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[bundleFile:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1253) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1197) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2019-12-16 20:31:43.961 [WARN ] [org.apache.felix.fileinstall                      ] - /usr/share/openhab2/addons does not exist, please create it.
2019-12-16 20:31:44.045 [ERROR] [org.apache.felix.fileinstall                      ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-12-16 20:31:44.046 [ERROR] [org.apache.felix.configadmin                      ] - [org.osgi.service.cm.ManagedServiceFactory, id=39, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.80a2cfbd-b3be-483c-bb41-59dbce24ca5e
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareDir(DirectoryWatcher.java:647) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareTempDir(DirectoryWatcher.java:627) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.<init>(DirectoryWatcher.java:179) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:248) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378) ~[?:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[bundleFile:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1253) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1197) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2019-12-16 20:34:19.444 [WARN ] [org.apache.karaf.main.Main                        ] - Lock lost. Setting startlevel to 1
2019-12-16 20:34:20.877 [WARN ] [org.apache.felix.fileinstall                      ] - /usr/share/openhab2/addons does not exist, please create it.
2019-12-16 20:34:20.878 [ERROR] [org.apache.felix.fileinstall                      ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-12-16 20:34:20.879 [ERROR] [org.apache.felix.configadmin                      ] - [org.osgi.service.cm.ManagedServiceFactory, id=68, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.80a2cfbd-b3be-483c-bb41-59dbce24ca5e
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareDir(DirectoryWatcher.java:647) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareTempDir(DirectoryWatcher.java:627) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.<init>(DirectoryWatcher.java:179) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:248) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378) ~[?:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[bundleFile:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1253) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1197) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2019-12-16 20:34:22.101 [WARN ] [org.apache.karaf.main.Main                        ] - Lock lost. Setting startlevel to 1
2019-12-16 20:34:31.271 [WARN ] [org.apache.felix.fileinstall                      ] - /usr/share/openhab2/addons does not exist, please create it.
2019-12-16 20:34:31.273 [ERROR] [org.apache.felix.fileinstall                      ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-12-16 20:34:31.273 [ERROR] [org.apache.felix.configadmin                      ] - [org.osgi.service.cm.ManagedServiceFactory, id=97, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.80a2cfbd-b3be-483c-bb41-59dbce24ca5e
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareDir(DirectoryWatcher.java:647) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareTempDir(DirectoryWatcher.java:627) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.<init>(DirectoryWatcher.java:179) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:248) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378) ~[?:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[bundleFile:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1253) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1197) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2019-12-16 20:34:46.737 [WARN ] [org.apache.felix.fileinstall                      ] - /usr/share/openhab2/addons does not exist, please create it.
2019-12-16 20:34:46.751 [ERROR] [org.apache.felix.fileinstall                      ] - Cannot create folder /var/lib/openhab2/tmp/bundles. Is the folder write-protected?
2019-12-16 20:34:46.752 [ERROR] [org.apache.felix.configadmin                      ] - [org.osgi.service.cm.ManagedServiceFactory, id=39, bundle=10/mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4]: Unexpected problem updating configuration org.apache.felix.fileinstall.80a2cfbd-b3be-483c-bb41-59dbce24ca5e
java.lang.RuntimeException: Cannot create folder: /var/lib/openhab2/tmp/bundles
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareDir(DirectoryWatcher.java:647) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.prepareTempDir(DirectoryWatcher.java:627) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.<init>(DirectoryWatcher.java:179) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:248) ~[?:?]
	at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378) ~[?:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) ~[bundleFile:?]
	at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1253) [bundleFile:?]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1197) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [bundleFile:?]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

Should this method have worked for the upgrade path?
Should I rather upgrade in-situ and then migrate to docker?

C

I think @rlkoshak is using Docker. Perhaps he has some ideas.

??? Are you not using volumes? You must use volumes and those volumes must include at least the conf and userdata folders.

If you have conf and userdata as volumes mounted into the container, than all you need to do is stop the old container and then create and start a new container with the new version. The entrypoint.sh script will see you are running a different version of OH than your userdata indicates it was under, automatically create a backup (see userdata/backup), and clear the cache before starting OH. Thatā€™s all there is to it.

So to migrate the Docker instance from one RPi to another, you really just need to copy your volumes from the one machine to the other and start up the container with those volumes mounted.

If youā€™ve ever edited this file it will not be overwritten.

Not all of the references have been removed because to do so is a breaking change. They will be removed in OH 3.

What user are you running OH as? What are the permissions on your mounted volumes?

I donā€™t even have that folder in my Docker image. Are you moving from a Docker to a Docker or from an installed OH to a Docker instance? In the Docker image that folder is located in /openhab2/userdata/tmp.

Iā€™m not sure the best way to upgrade from an installed OH to a Docker instance. It should be OK to copy the contents of /etc/openhab2 unchanged. But the contents of /var/lib/openhab2 needs some care. I would probably only restore the jsondb, and folder/file created by a binding, and the persistence folder and nothing else. If you had modifications to files in /var/lib/openhab2/etc, open those files and edit them again.

So here are the steps Iā€™d recommend:

  1. Copy your $OH_CONF (/etc/openhab2) and $OH_USERDATA (/var/lib/openhab2) folders to the new machine.

  2. Start the new container and let it boot up to completion.

  3. Stop the container.

  4. Copy the contents of your $OH_CONF folder to the volume mounted to the container to /openhab/conf. There shouldnā€™t be any file paths in there to worry about but you can run a quick grep -r userdata to see if there is.

  5. Copy the contents of jsondb, persistence, and any binding created folders or files to the volume mounted to /openhab/userdata. Do not copy the contents of etc or config folders.

  6. Restart the contianer and wait for it to complete booting. If you see errors, restart the container once OH fully comes up and see if the errors go away.

  7. Go through PaperUI and redo any configurations you made that didnā€™t get copied over.

The root of the problem is that the path to OH inside the container is not the same as the path when you install OH. Consequently if you copy over the stuff in etc and especially config without care you will have config files pointing in the wrong location.

2 Likes

Am I using volumes? I donā€™t know :blush:
Very new to docker, only just started moving things like mqtt and mariadb over to it.

I run this command to set it up

docker create \
        --name openhabtest25 \
        --net=host \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /docker/openhab25/conf:/openhab/conf \
        -v /docker/openhab25/userdata:/openhab/userdata \
        -v /docker/openhab25/addons:/openhab/addons \
        -v /dump:/dump \
        -e USER_ID=999 \
        -e GROUP_ID=994 \
        --restart=always \
        openhab/openhab:2.5.0
  • This is the one in the documentation.
  • The user, openhab, has access to the /docker/openhab files.
  • The /docker/ folder is a ssd mounted to the RPi
  • Iā€™ve removed the run and -d from itā€¦

Iā€™ll turf everything again today and start from scratch, following your steps above, and see what happens.

I suspect I copied over the whole /var/lib/openhab2 and messed it up that way.

Thanks, as always, for the help.

The -v options are mounting volumes.

I went through all this again this evening. I suspect I a) did not have enough coffee b) too much red wine c) bothā€¦

  1. I created a 2.4 container and waited for that to start up and finish everything
  2. I bashed into the container and did a cli restore from the main 2.4 Pi and waited for that to finish. (it takes a while)
  3. I stopped the container and removed it.
  4. I created a new, 2.5 container and started that.

After waiting around 5 minutes it had completed the upgrade and now everything is in order. :slight_smile:

Thanks for the help!

1 Like