I tried to update to OH 3.2.0 from OH 3.1.0 Windows 10.
The script failed because it could not create the backup Files at the foreseen location.
Unfortunately the Powershell closes after the failure so that I could not copy the text. But I made a picture of the error.
It says “could not backup existing distribution to C:\users\Homeserver.V68-HOME\AppData\local\Temp\openhab\backup 3.1.0”
where Homeserver is the Username and V68-HOME the Host name.
If I look at the files that should have been created in the backup location - in my case “backup-3.1.0” it looks strange: The sub-directory conf is not there, but the files of conf are directly written into “backup-3.1.0”. Sub-directory UserData ist correct with the content. So it looks like this:
I think this is not the issue and the reason why the script fails. “$TempBackupDirConf” is a subdirectory in “$TempBackupDir” see line
Anyway, I have copied the failing part of the code from the official OH powershell script “update.ps1”. I need some advise why the script delivered with the OpenHAB distribution fails. Best would be from anyone who was involved in setting up the Windows update script.
Has anybody an idea how to address this? Did I open a wrong topic?
Was not my intention to say this. Was more thinking that the output vs. what is done could have caused confusion.
Shouldn’t the $_ in the catch part of the script get the root cause and print it to screen.
I am wondering if that is not shown because of limitation in screen width.
I would try to put it in an extra line to see if that helps to identify the root cause.
Thanks for helping here, it is highly apprechiated.
I hope I have got you right:
Unfortunately there is nothing on the screen. I do not think it is a screen width problem, as on the last line before the error the letter “f” of “Conf” is shown on the next line on the screen (see picture of my first post).
I think execution runs here into ErrorAction:
Here a screenshot of all lines from the start to the error:
thank you. Yes you are right. It looks like everything is displayed there.
Nevertheless the root cause of the exeception should be printed there as well but is not shown there. Content of $_ should be shown below the red text box.
function PrintAndReturn {
param(
[Parameter(Mandatory = $True)]
[string] $msg,
[Parameter(Mandatory = $False)]
[System.Management.Automation.ErrorRecord] $ex,
[Parameter(Mandatory = $False)]
[int] $rc
)
BoxMessage $msg Red
if ($ex) {
Write-Error $ex
}
if ($rc) {
return $rc
}
return -1
}
Is there a way to get this output other than on the console? The end is so fast!
But you are right. Not knowing what to do else I made a movie while running the script and there for a tenth of a second this line appeared. In German as my Windows is in German.
Thank you for the hint concerning the output.
Shall we assume this error as given or do you want me to run it with the output on a file? If so it will take a few days as I will be out till the 16th.
If it was this error, is it a problem of the script or can I change something in my environment that prevents the error and makes the script run through?
I think it is not a problem in general as others would have reported it as well.
I am mainly working on linux systems so I think my windows knowledge is limited or a least less than compared to linux os.
Items to check would be if
I tried to file the output and failed. The file ist empty output is still on screen. But I have managed to get the complete text of the error.
I have moved the OpenHAB Directory directly under C: to get a shorter path length
I have changed the hostname to avoid any special signs.
It still ends with this crazy error writing en enormous path.
i wonder as I am for sure not the only Windows user.
Have you considered backing up your current openhab folder structure and trying a new “clean” install? You could then just restore your data? I am sure there are details on the community about backing up and restoring?
Would at least give you an idea if it is an environment issue or a specific config issue
Ok, this could be a work around. I have a weekly backup to a NAS not using the backup.ps1 script.
But since I am using OpenHAB I have the issue that I cannot use update.ps1 and have to take the work arround.
Nevertheless it is strange why update.ps1 is not running. I would love to chat with an other Windows user, how there the setup is.
I found an entry for backup.ps1 (unfortunately not for update.ps1) dealing with the issue of too long file names. Unfortunately I am not a programmer and I hardly understand how that could help
So if I install from scratch What do I have to copy back from the backup
With copying back I ment to restore the data. Or did I misunderstand? I understood to install and manually insert my installation files.
So what I did.
backup from my installation
new installation of OH V 3.1.0
run update.ps1 that ran through without a problem.
after I started to investigate and found that in OpenHAB/userdata/tmp are some very long path
I restored my installation
I deleted OpenHAB/userdata/tmp
I ran update.ps1 that ran through with one problem:
This file was missing.
"\OpenHAB\userdata\config\org\openhab\metrics.config’ "
Execute 'POST' instructions for version 3.2.0
Performing post-update tasks for version [3.2.0]
Could not move C: \users\Homeserver\0penHAB\userdata/config/org/openhab/io/metrics/MetricsRestController.config to C:luse
rs\Homeserver\0penHAB\userdata/config/org/openhab/metrics.config
Get-Content : Cannot find path
"C:lusers\Homeserver\OpenHAB\userdata\config\org\openhab\metrics.config'becauseit
does not exist.
At C:\Users\Homeserver\AppData\Local\Temp\openhab\update\runtime\bin\update.ps1:218char:22
(Get-Content$parts[3]).replace($parts[1],Sparts
+ CategoryInfo
ception
ObjectNotFound:(C:lusers\Homese...\metrics.config:String)[Get-Content],ItemNotFoundEx
+ FullyQualifiedErrorld:PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
Could not replace string org.openhab.io.metrics.MetricsRestController to org.openhab.metrics in file C:\users\Homeserver
\OpenHAB\userdata/config/org/openhab/metrics.config
DeletedC:lusers\Homeserver\OpenHAB\userdata/config/org/openhab/io/metrics
openHAB updated to version 3.2.0!
Run start.bat to launch it.
Check https://www.openhab.org/docs/installation/windows.html
for instructions on re-installing the Windows Service if desired
I would say you can do it without content of the userdata/tmp folder as userdata/tmp folder sometimes needs to be removed / cleared after an update. Necessary/required files then will be created again during runtime.
I neither see a metrics.config file in my OH2 nor OH3 setup.