New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error message in Karaf console on Windows 10 #530
Comments
I have the same problem, at least with #1031to #1033. |
I have / had it to, it is in a piece about setting up color output. Does your environment run fine for the rest? |
I have some problems, but I think, it has other resons. |
In my case it also was not the reason to stop it from starting that was: openhab/openhab-docker#102
|
Same issue here with build 1037. |
Others reported it starting after build 1003 and on or before 1010. So is something now calling convertPaths twice? |
|
I updated from build 982 to build 1039. Having the same error! |
I “solved” the problem! I commented the following line in userdata\etc\system.properties:
Now, the error is gone! Can anyone confirm this, too? |
Yea I can confirm this. Now it starts! But still creates a directory one directory abovoe the .bat. Named "OPENHA~2.0-B\userdata\logs" is in there at my system. |
Except that shell.init.script is likely never run since it is not defined. |
I tested also with this in userdata\etc\system.properties:
or
The error also is gone! But now I would like to know how to test it! (--> if shell.script is running??) Anyone else who knows that? |
Further tests with: \userdata\etc\system.properties:
result: --> C:\Openhab2\userdata\Openhab2userdata\etc\shell.init.script
result: --> C:\Openhab2\userdata\Openhab2runtime\etc\shell.init.script It seems that at all variables are missing the \ or / in the path: karaf.base = Openhab2userdata Then I forced an exception:
Maybe someone else knows where and what to do, now?? |
I have compared the batch files and the system.properties file delivered with openHAB with the files delivered with plain Karaf. And finally I found this comment in the system.properties file delivered with Karaf
After changing openHAB's system.properties file as follows:
the error message disappeared! It seems that everything works correctly with this change, but I am not sure whether it is also OK for Linux environments and therefore it will need some further testing. @kaikreuzer Do you have any idea why this setting was modified for openHAB and changed to an absolute path? |
@MHerbst I assume I didn't read the comment carefully enough and must have changed it to an absolute path. The issue is that we have different locations of the etc folder for the different installation types. I am actually not 100% certain, where the "." location is for an apt-based installation (@BClark09 can you tell?). If it is the "openHAB application", we might have a chance to move these scripts to runtime/etc, which should be the same for all installation types; might be worth a try. |
Editing
To test, I added the following line to
So it looks like the working directory is $OPENHAB_USERDATA, just as it is in @MHerbst's instance. |
Thanks, the fix should then pretty simple indeed. |
@MHerbst I just noticed that the line
Isn't contained in our system.properties, so that is why I didn't notice that. Browsing the Karaf code, I now just found this from 8 days ago 😲 - so before removing that prefix, I would want to clarify what this is about on https://issues.apache.org/jira/browse/KARAF-5352. |
The value looks good to me. It seems that the problem is that |
@jbonofre The underlying cause for that problem is a mystery (at least to me) however. It is set properly in oh2_dir_layout.sh:
which gets passed to karaf.etc in karaf.bat:
|
@jbonofre Too me it seems that the "/" or "" is removed somewhere within Karaf itself if the entry contains a reference to an environment variable. Maybe the cause lies in the code that resolves the variables in non-Linux/Unix environments. |
@MHerbst Could you test that on a plain Karaf installation and if there are problems when setting KARAF_ETC manually, would you add a comment to https://issues.apache.org/jira/browse/KARAF-5352? To me it yet isn't clear where the path gets set and where the backslash is lost on the way. I also wonder whether it needs to be forward or back slashes on Windows, at the moment we seem to have an unhealthy mix... |
I put the echos in runtime/bin/karaf.bat behind
|
I modyfied C:/oh22/userdata/etc/system.properties line 31 and document the results
|
So, in otherwords ${karaf.etc} is fine until the point in which it's processed by the Java process, where it gets muddled by backslashes? |
@kaikreuzer I have performed some tests and added the results to the Apache jira. It doesn't matter how KARAF_ETC is set. The Java code of Karaf seems to perform some conversion while expanding karaf.etc and this conversion probably does not work correctly on Windows 10. It seems that all directory names a translated to the system's standard separator character. Therefore it makes no difference whether you use forward or back slashes.
This is really a problem. Generally, Windows supports forward and back slashes and you can even mix different slashes in a path. In Java code (and properties files) I normally use forward slashed in order to avoid escaping of the back slashes. |
Many thanks for your analysis and for reporting details at the Karaf issue tracker. Let's see if the issue can be confirmed and fixed there! |
Hi, it seems that the issue was resolved in Karaf issue tracker. But the error still appears on the latest OH snapshot. |
Please note that the version in which it is fixed is not released so we have to wait for that: |
Thanks for explanation! |
#570 is merged, so please check whether the issue is solved in distro 1083 and above! |
No good. This init script is a pain, even on my Mac it now fails on the first startup. |
Afaik the problem originates from around: It seems that they commented out line 53 but that makes the vars unused, so maybe we should just remove the whole block. However I fear that we have bigger problems :-( https://community.openhab.org/t/jetty-update-karaf-4-1-3-upgrade-and-full-lsp-support/36354/12 And my own test with the docker upgrade is also not looking good, note that I have version 1084 instead of 1083. |
Could you test if you find some changes to shell.init.script that make it work better (maybe also without causing having to start twice, which might help for the docker setup)? |
Trying to answer Kai's question about which file the fix is contained: It seems that is system.properties as seen here. |
Thanks! but imho this looks pretty okay already: openhab-distro/distributions/openhab/src/main/resources/userdata/etc/system.properties Line 31 in b1c1118
|
I´m still getting the same error on windows with snapshot 1084... |
I've noticed here (Fix startup scripts on windows), that issue with shell.init.script on windows was resolved in karaf by using "etc/shell.init.script" in system.properties |
It seems to work with just karaf.shell.init.script = shell.init.script. So without any further paths. But I will investigate the behavior further |
Maybe a stupid question but isn't that maybe caused by the fact that it cannot find the file and no error will happen. Because the actual error is in the file itself AFAIK. |
Yes, that was the point. The path to the script was wrong. With ${karaf.etc} it was still the path where the backslashes were missing. |
Sorry, I'm having another problem on my machines they complain about an error in the actual script, that is on Mac OS and Linux. |
To take a step back a bit, before Karaf 4.1.2 the line in question was:
This uses a relative path which is safely parsed through Java for Windows. The line in openHAB's verson of system.propeties now contains:
Which evaluates to a full path and gets garbled by the process. The fix, that is not currently in openHAB's implementation is this one: To resolve this issue we need to at least set this to a relative path (i.e. |
So that is actually in karaf-4.2.0.M1? At least according to github. Please try it would be great if that finally solves it :-) |
It'll work in both versions:
After downloading a standalone Karaf 4.1.3, system.properties contains the fix also, so I do not think that the openHAB upgrade to Karaf has changed all of the associate files. openHAB's version of |
@martinvw, @kaikreuzer, would the distro contain the Karaf default
(Which also resolves this todo) |
Sounds hopeful, I hope @kaikreuzer can give a detailed opinion |
I do not understand why this should work. The todo references https://issues.apache.org/jira/browse/KARAF-3949 which is still unresolved. So the correct fix would instead be to keep the existing system.properties and only update all the "standard" settings to be identical to what is shipped in Karaf 4.1.3. |
The first line of Karaf's system properties in 4.1.3 is:
Anything written in the referenced file overwrites the standard system.properties. |
Interesting :-) So if this works - please create an according PR! |
Will do, the screenshot of the working instnce I added above uses the custom file so all should be fine. Will deleting the file on this repo cause it to be replace by Karaf's default? |
Done :-) |
. |
Using documentation for updating on Windows the error persists. Should I propose to add a file for deletion - system.properties - during the update process? |
Good spot! The list in the Updating the openHAB Runtime section should include both files for deletion:
|
Done #575 |
Since switching to Karaf 4.1.2 the following message appears on the Karaf console:
I have downloaded Karaf 4.1.2. and it does not show any error messages. I suppose it has something to do with the files used to start up openHAB.
The text was updated successfully, but these errors were encountered: