Trying to update windows openhab 2.5.0.M1 to M2

hey all,

im having issues trying to update openhab on my windows 10 pc.

what i have done so far is stop openhab from running.
started powershell and got to the update.bat file in runtime/bin foler with the version number i wanted to update to

 C:\openhab\runtime\bin\update.bat 2.5.0.M2     

looks to download ok

then it fails after its done downloading

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
                                                                                                                        Try the new cross-platform PowerShell https://aka.ms/pscore6                                                                                                                                                                                    PS C:\WINDOWS\system32> C:\openhab\runtime\bin\update.bat 2.5.0.M2                                                                                                                                                                              #################################
#  openHAB 2.x.x update script  #
#################################

Checking whether a service exists
Checking the specified openHAB directory
Using C:\openhab\conf as conf folder
Using C:\openhab\userdata as userdata folder
Using C:\openhab\runtime as runtime folder
Using C:\openhab\addons as addons folder
The current version is 2.5.0.M1
Changing location to C:\openhab
Creating temporary update directory C:\Users\nick_\AppData\Local\Temp\openhab
Downloading the openHAB 2.5.0.M2 distribution to C:\Users\nick_\AppData\Local\Temp\openhab\openhab-2.5.0.zip
Downloaded 72934K of 72934K [100%]
Finished Download
Extracting the archive (C:\Users\nick_\AppData\Local\Temp\openhab\openhab-2.5.0.zip) to C:\Users\nick_\AppData\Local\Temp\openhab\update

########################################################################################################################################
#  New update.ps1 was found - executing it instead (found in C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1)  #
########################################################################################################################################


#################################
#  openHAB 2.x.x update script  #
#################################

Checking whether a service exists
Checking the specified openHAB directory
Using C:\openhab\conf as conf folder
Using C:\openhab\userdata as userdata folder
Using C:\openhab\runtime as runtime folder
Using C:\openhab\addons as addons folder
The current version is 2.5.0.M1
Changing location to C:\openhab
########################################################################################################################################################
#  Execution of new update.ps1 failed - please execute it yourself (found in C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1)  #
########################################################################################################################################################
PrintAndReturn : 2.5.0.M1 is not formatted correctly (d.d.d)
At C:\openhab\runtime\bin\update.ps1:568 char:22
+ ...        exit PrintAndReturn "Execution of new update.ps1 failed - plea ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PrintAndReturn

Press any key to continue . . .

so i hit any key navagate to where it says i need to try execting it myself. which also fails.

PS C:\WINDOWS\system32> C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1
C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1 : File
C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ C:\Users\nick_\AppData\Local\Temp\openhab\update\runtime\bin\update.p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\WINDOWS\system32>

Newer PowerShells don’t let you launch scripts by default. You have to change a security setting.

The error message you posted included this:

That link explains the security model and has examples on how to change it. You’ll need to pick a less restrictive model.

Once you set it to something more open, the update should work.

1 Like

sweet thanks for that Lou,

i still get the st1 error though. when i start the .ps1 file nothing happens. should there be something that comes up?

from this line

PrintAndReturn : 2.5.0.M1 is not formatted correctly (d.d.d)

makes me think its not expecting the M1 as its a extra dot

Hey Nick, I have the same issue. Did you ever figure this out?

@COB

I’ve executed update.bat several times, and it was always successful.

According to the example in batch file the correct syntax should be: update.bat 2.5.0-M2

See also here.

But my folder is named: c:\openHAB2 (as recommended).

And I didn’t start update.bat from PowerShell, I’ve started it from command prompt running as Administrator.

@Bruce_Osborne

It is not always easy to decide if it is the same problem or just similar. In the forum guidelines is also written, you should first search for a same error. I consider this question to be legitimate, since update.bat last changed in December 2018. This is valid for all distributions that have been released after that time.

update.bat calls update.ps1 and update.ps1 checks if there is a newer version in downloaded and extracted folder, if so, it uses this newer version.

See above:

“New update.ps1 was found - executing it instead (found in c:\ …)”

The newer update.ps1 should be valid exactly for the version you are trying to install.

update.ps1 was last changed on 02 Aug 2019 (=7 days before 2.5.0.M2 was released.) So the latest update.ps1 is used in 2.5.0.M2, 2.5.0.M3, 2.5.0.M4 and all Snapshots after 1651.

@Celaeno1, thanks so much for your reply.

I’m afraid I can’t get that to work. I have tried both powershell and command prompt but similar results. If I use the syntax 2.5.0-M4 it fails to find files to download. If I use the syntax 2.5.0.M4 then it will download the files and extract but then fail with an error “PrintAndReturn : 2.5.0.M1 is not formatted correctly (d.d.d)”. 2.5.0.M1 is the version that I am currently running.

Note that I have changed my openhab folder to openHAB2 but I can’t change the path to the root of C for a range of reasons.

I’m sorry. The syntax 2.5.0-M4 seems to be wrong, although in the batch it is given as an example.

I tried out for milestones, now. But I get the same error.

PrintAndReturn : 2.5.0.M3 is not formatted correctly (d.d.d)

For latest milestone update.bat 2.5.0.M4 should be the correct syntax. Download and extracting is running but then it stops, with:

PrintAndReturn : 2.5.0.M3 is not formatted correctly (d.d.d)

For updating from Snapshot to Snapshot it is running with update.bat 2.5.0-SNAPSHOT. I’ve used this many times without any problems.

And for snapshots this is running also:

Open PowerShell as Administrator.

Maybe you have to set a Execution Policy:

Set-ExecutionPolicy Bypass

.

1) cd C:\openHAB2
2) . .\runtime\bin\update.ps1
3) Update-openHAB -OHVersion 2.5.0-SNAPSHOT 

.
.

But for milestones this is not running, too.

So, for milestones the script should be changed.

@Benjy
@bjoernbrings
@wborn
@tmrobert8

Do you know about this issue?

1 Like

Thanks for confirming Alex.

For now I have worked around this by doing things the old fashioned way… I reached the previous upgrade instructions via an archived page here
https://web.archive.org/web/20190416185311/https://www.openhab.org/docs/installation/windows.html

Regards,

COB

1 Like

If you knew the current documentation is in error, why did you not file an issue or PR on GitHub? The developers are not omniscient. Unless you document an issue, they may not know about it. That is what GitHub is used for. Not all OH developers use this user forum.

sorry, @Bruce_Osborne, I didn’t know what the issue was, I just knew that I couldn’t figure it out and worked around it using methods I had used previously

1 Like

You also find previous doc here:

Filing an issue helps the developers determine what the actual issue is.

Hi, i had the same problem to upgrade from 2.5.0.M4 to 2.5.0.
My workaround was:
open the file

userdata\etc\version.properties

and change the entity from

openhab-distro : 2.5.0.M4

to

openhab-distro : 2.4.0

the powershell procedure has been completed without any error. the installation works fine for me (after second restart)

regards

1 Like

Just submitted a PR for this - will fix it shortly…

1 Like

I am not sure I understand properly but that PS1 script should be signed… no??. Why not signing it?

Worked for me updating from 2.5.0 M4 to 2.5.9.
Thanks!

Perhaps the volunteer developer has not paid for a recognized code signing certificate.

Hi,
Can this be used to upgrade 2 5.10 to 3.0.M5?

  1. cd C:\openHAB
  2. . .\runtime\bin\update.ps1
  3. Update-openHAB -OHVersion 3.0.M5

Or will that only update 2 x.x to 2.y.y ?

Is there another way if that isn’t supported?
Delete certain folders and copy in the OH3 files?

Thanks,
Richie