Trouble updating OH2 in windows

Troubles running the OpenHAB update in Windows Powershell:

What I did:

C:\ProgramData\OpenHAB2> Set-ExecutionPolicy Unrestricted
C:\ProgramData\OpenHAB2> …\runtime\bin\update.ps1 Update-openHAB -OHVersion 2.5.12

…\runtime\bin\update : The term ‘…\runtime\bin\update’ is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1

  • …\runtime\bin\update Update 2.5.12
  •   + CategoryInfo          : ObjectNotFound: (..\runtime\bin\update:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException

If I change the directory to C:\ProgramData\OpenHAB2\runtime\bin
and run the bat file like this

.\update 2.5.12

it seam to run but does nothing. No error no nothing.

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\ProgramData\OpenHAB2\runtime\bin\update.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): R
PS C:\ProgramData\OpenHAB2\runtime\bin>

So I do something wrong or miss something and does not see it. Can anybody see my blind spot?
Thank you for help.

Are you running Power Shell as administrator? (Right Click and choose “Run as Administrator”

Yes I did

What folder is your openHAB installed in? I see you trying to run from c:\ProgramData\OpenHAB2?

Is that where you installed to? I am no longer on OH2.

But as I recall:

Make a backup of your openHAB installation folder.
Run PowerShell as an administrator and change to your openHAB root directory (e.g. cd C:\openHAB)

Run the update command:
. .\runtime\bin\update.ps1
Update-openHAB -OHVersion <Version Required>

All I can think is the wrong directory?

Correct that ist my OH mother directory.

I tried also this version, see above. It results in an error. Can be that I have a blind spot, it drives me crazy…

With running the bat, I seem to be close. But I have to run it with.\ and if I run it from the "mother directory, it does or run.

Are you running windows? Did it work in your installation.
Did you stop OH when running the update, does it matter?

I wonder if something in my current installation 2.5.6 ist wrongly set up and if I can update to 2.5.12 somehow manually to fix any hidden potential problems. final target is to upgrade to OH 3.

Works for me.

Only differences I can see are the install directory and I run the command over two lines:

. .\runtime\bin\update.ps1
Update-openHAB -OHVersion <Version Required>

Thank you for your help. Is it

. .\runtime\bin\update.ps1
Update-openHAB -2.5.12


. .\runtime\bin\update.ps1
Update-openHAB -OHVersion 2.5.12

Would be the second as in my examples above.

Thanks, getting closer
It runs now, I see the header of the Update and some lines with directories, but after seconds it seem to fail, I see two red lines and powershell closes. All to fast to read or copy :frowning:

What directory is OH installed in?

Weird that Power Shell closes?

It is installed in c:\ProgramData\OpenHAB2 and I ran it from there like you proposed.

I have to postpone to the evening (sitting in Switzerland)
I will then rerun and try to read the red lines before Powershell closes.

I will let you know. Many thanks so far, very apprechiated.


JAVA_HOME is important.

If you are trying to update TO version 2.5.12 you waited too long because the bintray repo used by older versions has been shut down by its maintainers.

Backing up and performing a clean installation and then restoring your backup is the only remaining option.

Ok, thank you. So you think that is the reason the update runs into an error after it starts properly.

To be sure, by backup you think of this procedure, as written in the documentation:

“Make sure that you make regular backups of the conf and userdata folders, you can zip and unzip these folders too and from openHAB installations (even across most versions).”

Would that also work, if I install OH V 3, and then load the OB V 2 conf and userdata to that version?

Hi rossko57.
update.ps1 is running into an error and shutting down powershell, not start.bat. Or do you refer to my other topic about the rrj4d error I get when I start OH 2.5.6? JAVA_HOME is set.

Okay, that’s the important part (assuming set correctly!)

Yes, JAVA_HOME is set correctly for V2, the version that runs (it would not run, if it was set wrongly).
I wait for Bruce_Osborne to confirm, that I can copy conf and userdata V2 to a V3 installation from scratch. At the moment my guess is, that I will not be able to run update, if he’s right that update fails because the bintray vor V2 is gone.

I do not know because I have not done an upgrade from v2 to v3. Sorry. I think @rlkoshak may know though.

There are differences between OH 2 and OH 3 that will cause some things to break in your config. But I think those things wouldn’t be handled during an upgrade anyway such as the removal of Joda DateTime from rules and such.

I upgraded by setting up a new OH and gradually recreating my config on the OH 3 instance so I don’t know how well it will work if you just copy your 2.5 configs over to a 3.0 instance. Rules will likely break but that’s true of an upgrade as well. Things might break too for some bindings. But everything else should be fine.

1 Like

Thanks a lot for the details, and eventualities that will occure. I will keep fingers crossed.