Karaf console: bundle:uninstall and bundle:update not running as expected!

AFAIK the “Online-Repo” is here: --> last updated Apr 26, 2017

e.g. Harmonyhub Binding is there:

HarmonyHub Binding

When will there normally be the latest version?

I thought “nightly” means “once a night”??

Who knows the exact update frequency?

But this is not the origin of the problem. When I try to update e.g. build 858 (or earlier) to above shown (latest available version) I always get the same .jar as it was in build 858 (or earlier). After deleting \userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub it updates to:

211 | Active | 80 | 2.1.0.201704261428 | HarmonyHub Binding

which is exactly above mentioned version…

Snapshot distro: https://openhab.ci.cloudbees.com/job/openHAB-Distribution/
Snapshot bindings: https://openhab.ci.cloudbees.com/job/openHAB2-Bundles/lastSuccessfulBuild/

This was correct until last weekend :slight_smile:
Please see my post here about the move of this repo. Sorry for the inconveniences :innocent:

1 Like

@Kai Ok, thank you very much for this information! :slight_smile:

@sihui Yes, there are the “offline” files. For downloading manually, unzip them and install a new distro or to put them to addons folder. But if you use Paper UI to install a binding, the online-repo was until last weekend:

https://bintray.com/openhab/mvn/online-repo/2.1.nightly

and now is:

https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1

Yes, that is how I use it :slight_smile:
But once installed, you are also able to update a binding via uninstalling/installing.

I closed the github issue because now we know the reason …

@Kai @sihui

I tested the new online-repo!

Uninstalled (e.g) allplay and harmonyhub bindings.

Changed the following files with the new repo-path:

userdata/etc/version.properties
userdata/etc/org.ops4j.pax.url.mvn.cfg

deleted the following folders:

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.allplay
\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub

Installed allplay and harmonyhub again:

and now I have the newest versions:

bundle:list

238 | Active | 80 | 2.1.0.201705011011 | HarmonyHub Binding
239 | Active | 80 | 2.1.0.201705011011 | AllPlay Binding

@Kai Why one have to delete the binding-folders manually? Should it not been overwritten automatically?

This gets even more weird:

On a manual installed #906 build, comes with:

198 | Active | 80 | 2.1.0.201704261428 | HarmonyHub Binding

Uninstalled harmony binding via PaperUI, installed harmony binding via PaperUI:

2017-05-02 19:37:19.633 [INFO ] [core.karaf.internal.FeatureInstaller] - Uninstalled ‘openhab-binding-harmonyhub’
218 | Active | 80 | 2.1.0.201704261428 | HarmonyHub Binding

Still same version of the binding.

Uninstalled harmony binding, deleted the files in the /tmp … directory, installed the harmony binding again via PaperUI:

219 | Active | 80 | 2.1.0.201704261428 | HarmonyHub Binding

Still old version. I guess I have to reopen the git issue … there seems to be definitely something wrong, because this has worked before (without deleting the binding files manually).
BTW, restarting openhab2 service did not help either.

Did you check?

\userdata/etc/version.properties
userdata/etc/org.ops4j.pax.url.mvn.cfg

No. I won’t go any deeper into this or tweak my system, this update “thing” has to be a feature from openHAB and not from me tinkering around in system files.

No idea, I would expect it to work as well. Did it work in the past?
openHAB uses plain Apache Karaf features here, so maybe someone could check how Karaf handles the updates from remote snapshot repos.

@Kai

I didn’t use this in the past. But after several “harmonyhub” issues (March/April 2017), I tried a recommendation of wborn from this topic:

I only use addons directory for inofficial or testing or my own bindings. All officially were installed via PaperUI or are inside addons.cfg.

But it never worked that (wborn’s recommended) way. (uninstall and install it again).

So I opened my own topic, here… (this one!)

Yes (manual install, not repo).

See first post, @Celaeno1 already did that without success.

What I meant was to check the Karaf documentation or its user forum on how this is designed to work.

That’s a whole different story then :slight_smile:

From what I’ve found upgrading should even be possible with just installing the feature (Karaf 4). In Karaf 3 you have to uninstall the feature first and then reinstall the feature.

http://karaf.922171.n3.nabble.com/Feature-and-Karaf-upgrades-tt4047334.html#a4047336

http://karaf.apache.org/manual/latest/#_features_upgrade

@Kai @sihui

For me it’s now enough to know how it works:

I edited (checked) the following files:

\userdata\etc\ version.properties
\userdata\etc\ org.ops4j.pax.url.mvn.cfg
\userdata\config\org\ops4j\pax\url\ mvn.config

I checked if there are the following (correct) entries:

version.properties

online-repo     : https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1

org.ops4j.pax.url.mvn.cfg

org.ops4j.pax.url.mvn.repositories = https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1@id=openhab@snapshots

mvn.config

org.ops4j.pax.url.mvn.repositories="https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1@id\=openhab@snapshots"

Then I uninstall my binging(s) that should be updated via PaperUI
or I remove them from \conf\services\ addons.cfg

Then I go to the following folder:

\userdata\tmp\mvn\org\openhab\binding and delete the corresponding folder of the binding, eg:

org.openhab.binding.harmonyhub

Then I put the entry back to \conf\services\ addons.cfg

or install it via PaperUI again.

Then the newest available version of the binding will be downloaded from above Online-Repo.

Ready! :slight_smile:

1 Like

Nice workaround … but in my opinion the upgrade procedure should be fixed, there are a lot of users out here who don’t like to mess with system files (and they should not have to do that).

1 Like

@sihui Yes, you are right. Maybe I have time on next weekend to investigate this… But I only can test karaf console commands, what they are doing exactly. If there are any changes in programcode neccessary, someone else has to do this…

@sihui @Kai
Here are my investigations:

I tested on Window10,(32bit and 64bit) with the following builds:

  • 741 (=2.0.0-SNAPSHOT, there is no old 2.0.0 Online-Repo available anymore, but uninstall worked, leaving folder \userdata\tmp\mvn\org\openhab\binding\ untouched!)

  • 2.0.0.RC1

  • 798

  • 850

  • 858

  • 896

  • 903 (=with new Online-Repo!)

I tested 798,850,858,896 with “old url” of Online-Repo: --> latest installed version of a binding always was: 2.1.0.201704261428 ((if I e.g. manually deleted folder \userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub before!))

Then I changed path to “new url” of Online-Repo: --> latest installed version of a binding: depending on the latest available build number (903,904,905,906,907,908,909), but it ever was the newest available!

All above builds have excatly the same behavior!

If a binding NEVER was installed before, both (“karaf console command” or PaperUI) installed the newest available version of the binding from Online-Repo!

But PaperUI does NOT recognize this if you use “karaf console commands” only!

Here are my examples with “HarmonyHub Binding”:

bundle:list
222 | Active   |  80 | 2.1.0.201705011011     | HarmonyHub Binding

bundle:update 222 https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1/org/openhab/binding/org.openhab.binding.harmonyhub/2.1.0-SNAPSHOT/org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar

bundle:list
222 | Active   |  80 | 2.1.0.201705072117     | HarmonyHub Binding   <---newest version!

\userdata\cache\org.eclipse.osgi\222\3\ bundleFile (created with newest version)

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar (not updated or changed!)

bundle:uninstall 222

\userdata\cache\org.eclipse.osgi\222\3\ bundleFile <-- deleted
\userdata\cache\org.eclipse.osgi\222\3\ .delete (file created)

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar (not deleted, untouched!)

PaperUI:

HarmonyHub Binding recognized still as installed!

HarmonyHub Binding uninstalled (via PaperUI)
HarmonyHub Binding installed (via PaperUI)

bundle:list
249 | Active   |  80 | 2.1.0.201705011011     | HarmonyHub Binding	<---old version again, restored from \userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\

PaperUI:

HarmonyHub Binding uninstalled (via PaperUI)

\userdata\cache\org.eclipse.osgi\249\ .delete (bundeFile deleted and .delete created)

Karaf console:

bundle:install https://openhab.jfrog.io/openhab/online-repo-snapshot/2.1/org/openhab/binding/org.openhab.binding.harmonyhub/2.1.0-NAPSHOT/org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar

bundle:list
250 | Installed |  80 | 2.1.0.201705072117     | HarmonyHub Binding

bundle:start 250
bundle:list

250 | Active   |  80 | 2.1.0.201705072117     | HarmonyHub Binding	<---newest version again!

\userdata\cache\org.eclipse.osgi\250\0\ bundleFile (created, newest version!)

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar (not deleted or overwritten!)

PaperUI:

HarmonyHub Binding recognized still as uninstalled!

HarmonyHub Binding installed (via PaperUI)

bundle:list
250 | Active    |  80 | 2.1.0.201705072117     | HarmonyHub Binding	(still the newest version, installed from karaf console!)
251 | Installed |  80 | 2.1.0.201705011011     | HarmonyHub Binding	(installed old version again, and it's doubled!!) <--this surely is wrong!!)

PaperUI:

HarmonyHub Binding uninstalled!

karaf console:

bundle:uninstall 250
bundle:list
both 250 and 251 are gone!

manually deleted folder
\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\

PaperUI:

HarmonyHub Binding installed!

bundle:list
252 | Active   |  80 | 2.1.0.201705072117     | HarmonyHub Binding	(installed with the newest version!)

\userdata\cache\org.eclipse.osgi\252\0\ bundleFile (created, newest version!)

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\org.openhab.binding.harmonyhub-2.1.0-SNAPSHOT.jar (newest version!)

Conclusion:

karaf console commands do exactly what they should do.

bundle:uninstall (OK)
bundle:update (OK)
bundle:install (OK)

BUT, PaperUI does NOT recognize any changes!

PaperUI did an uninstalling, but newest version never was installed. It always installs version from “tmp”

\userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.harmonyhub\2.1.0-SNAPSHOT\

If you delete this folder manually, the newest version is installed!

My recommendation if you want an update of a binding:

  • Use PaperUI to uninstall a binding.
  • Delete corresponding folder from \userdata\tmp\mvn\org\openhab\binding\
  • Use PaperUI to install the binding again.

I cannot confirm, that simply an uninstall/install of a binding via PaperUI or via addons.cfg (to do an update) ever worked before!

1 Like