Zeddock
(aaron)
November 20, 2023, 9:03pm
1
Platform information:
Hardware: AMD Ryzen 5/16g/os on m.2 openHAB on HDD
OS:Win 10 Pro
Java Runtime Environment: jdk-17
openHAB version: 4.0.4
Issue of the topic:
At stage 5 of the windows install this is what happens.
C:\Windows\system32>D:\OpenHab\openhab-4.0.4\userdata\bin\openHAB-service.bat
Usage: karaf-service ( commands … )
commands:
** run Start openHAB in the current console**
** install Install openHAB as a Windows service**
** remove Remove the openHAB Windows service**
C:\Windows\system32>D:\OpenHab\openhab-4.0.4\userdata\bin\openHAB-service.bat install
wrapper | Unable to set working directory to: D:\OpenHab\userdata (The system cannot find the file specified. (0x2))
I am unsure what to do because the files are there.
Thank you in advance,
Zed
Oliver2
(Oliver)
November 20, 2023, 9:27pm
2
Did you set the environment settings and did you start openhab with start.bat?
Zeddock
(aaron)
November 20, 2023, 10:54pm
3
If by environment setting you mean the Java home or the copy and paste from the install guide then yes I did those. If you mean something else then no I didn’t.
I did start using the start.bat file as well.
Oliver2
(Oliver)
November 20, 2023, 10:59pm
4
Could you double check with set
command if path and java_home are really set?
Is the output above a direct result of the start.cmd?
edit:
are you trying to setup a service? Are you running the command as administrator?
Zeddock
(aaron)
November 20, 2023, 11:06pm
5
Forgive me I am not well versed in command code. How does the set command work.
I can verify that the Java home is linked to the Java 17 install location.
Oliver2
(Oliver)
November 20, 2023, 11:09pm
6
to check the environment: open a cmd window and enter the following command
set
Zeddock
(aaron)
November 20, 2023, 11:16pm
7
okay
C:\Windows\system32>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\zeddo\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=CALLISTO
ComSpec=C:\Windows\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
HOMEDRIVE=C:
HOMEPATH=\Users\zeddo
JAVA_HOME=C:\Program Files\Java\jdk-17
LOCALAPPDATA=C:\Users\zeddo\AppData\Local
LOGONSERVER=\CALLISTO
NUMBER_OF_PROCESSORS=12
OneDrive=C:\Users\zeddo\OneDrive
OneDriveConsumer=C:\Users\zeddo\OneDrive
OS=Windows_NT
Path=C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Python\Scripts;D:\Python;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Users\zeddo\AppData\Local\Microsoft\WindowsApps
PATHEXT=.COM ;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 25 Model 33 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=25
PROCESSOR_REVISION=2102
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\zeddo\AppData\Local\Temp
TMP=C:\Users\zeddo\AppData\Local\Temp
USERDOMAIN=CALLISTO
USERDOMAIN_ROAMINGPROFILE=CALLISTO
USERNAME=zeddo
USERPROFILE=C:\Users\zeddo
VBOX_MSI_INSTALL_PATH=D:\HomeAssistant
windir=C:\Windows
Oliver2
(Oliver)
November 20, 2023, 11:22pm
8
ok. Is the error message the result of your attempt to install openhab as a service or the result of starting start.bat?
In either case, could you start the batch file as admin? right-click → run as administrator
Zeddock
(aaron)
November 20, 2023, 11:23pm
9
The error is from the Service. I’ll try to run as admin
Zeddock
(aaron)
November 20, 2023, 11:24pm
10
I’ll do that in 10 minutes. I’m eating with my family.
Thank you for your help so far it is appreciated.
Oliver2
(Oliver)
November 20, 2023, 11:33pm
11
The working directory seems to be
D:\OpenHab\openhab-4.0.4\userdata\
but the batch file is looking for
D:\OpenHab\userdata
please double check with openHAB-wrapper.conf
justaoldman
(Justan Oldman)
November 20, 2023, 11:37pm
12
if you open the command prompt like shown and it defaulted to C:\Windows\system32 you most likely have a cmd with administrator already
Always better to execute commands from the actual working directory to avoid path failures.
change directory to the d:\ how to ? trom this line \C:\windows\system32> cd d:\ press enter
then when your prompt shows this D:\OpenHab\openhab-4.0.4\userdata\bin>
type openHAB-service.bat install
press enter
Once it completes you can then type type
net start "openHab"
press enter
and your openHab should be running as a service if all went well you go to services from control panel and you should see the openHab serivce running
Zeddock
(aaron)
November 20, 2023, 11:39pm
13
" openHAB-service.bat install "
This is where it fails
Zeddock
(aaron)
November 20, 2023, 11:40pm
14
I think this might be the issue. This is what is in the config file. So will I need to go in and change all the locations or just the first one that is listed as default?
#*******************************************************
openHAB-wrapper.conf for Windows Service Installation
#*******************************************************
openHAB installation dir (Adapt this first setting to your system)
set.default.OPENHAB_HOME=D:\OpenHab
Wrapper Properties
set.default.OPENHAB_CONF=%OPENHAB_HOME%\conf
set.default.OPENHAB_RUNTIME=%OPENHAB_HOME%\runtime
set.default.OPENHAB_USERDATA=%OPENHAB_HOME%\userdata
set.default.OPENHAB_LOGDIR=%OPENHAB_USERDATA%\logs
set.default.KARAF_LOG=%OPENHAB_USERDATA%\logs
set.default.KARAF_HOME=%OPENHAB_RUNTIME%
set.default.KARAF_BASE=%OPENHAB_USERDATA%
set.default.KARAF_DATA=%OPENHAB_USERDATA%
set.default.KARAF_ETC=%OPENHAB_USERDATA%\etc
set.default.PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_HOME%\lib
Java Application
wrapper.working.dir=%KARAF_BASE%
wrapper.java.command=%JAVA_HOME%\bin\java
wrapper.java.mainclass=org.apache.karaf.wrapper.internal.service.Main
wrapper.java.classpath.1=%KARAF_HOME%\lib\boot*.jar
wrapper.java.classpath.2=%KARAF_DATA%\lib\wrapper*.jar
wrapper.java.classpath.3=%KARAF_HOME%\lib\jdk9plus*.jar
wrapper.java.classpath.4=%KARAF_HOME%\lib\endorsed*.jar
wrapper.java.library.path.1=%KARAF_DATA%\lib\wrapper\
Java Parameters
wrapper.java.additional.1=-Dkaraf.home=“%KARAF_HOME%”
wrapper.java.additional.2=-Dkaraf.base=“%KARAF_BASE%”
wrapper.java.additional.3=-Dkaraf.data=“%KARAF_DATA%”
wrapper.java.additional.4=-Dkaraf.etc=“%KARAF_ETC%”
wrapper.java.additional.5=-Dcom.sun.management.jmxremote
wrapper.java.additional.6=-Dkaraf.startLocalConsole=false
wrapper.java.additional.7=-Dkaraf.startRemoteShell=true
wrapper.java.additional.8=-Dopenhab.home=“%OPENHAB_HOME%”
wrapper.java.additional.9=-Dopenhab.conf=“%OPENHAB_HOME%\conf”
wrapper.java.additional.10=-Dopenhab.runtime=“%OPENHAB_HOME%\runtime”
wrapper.java.additional.11=-Dopenhab.userdata=“%OPENHAB_HOME%\userdata”
wrapper.java.additional.12=-Dopenhab.logdir=“%OPENHAB_USERDATA%\logs”
wrapper.java.additional.13=-Dfelix.cm.dir=“%OPENHAB_HOME%\userdata\config”
wrapper.java.additional.14=-Dorg.osgi.service.http.port=8080
wrapper.java.additional.15=-Dorg.osgi.service.http.port.secure=8443
wrapper.java.additional.16=-Djava.util.logging.config.file=“%KARAF_ETC%\java.util.logging.properties”
wrapper.java.additional.17=-Dkaraf.logs=“%OPENHAB_LOGDIR%”
wrapper.java.additional.18=-Dfile.encoding=UTF-8
wrapper.java.maxmemory=512
Wrapper Logging Properties
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=%OPENHAB_USERDATA%\logs\wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=5
wrapper.syslog.loglevel=NONE
Wrapper Windows Properties
wrapper.console.title=openHAB
wrapper.ntservice.name=openHAB
wrapper.ntservice.displayname=openHAB
wrapper.ntservice.description=openHAB Service
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false
justaoldman
(Justan Oldman)
November 20, 2023, 11:41pm
15
do it from the working directory not from c:\windows\system32 directory
Also make sure you correctly edited the conf file in step 4 including the path to your openHab install.
Zeddock
(aaron)
November 20, 2023, 11:43pm
16
Changing the .conf file did it. I did change it just not the the full directory.
C:\Windows\system32>D:\OpenHab\openhab-4.0.4\userdata\bin\openHAB-service.bat install
wrapper | openHAB installed.
Thanks guys its much appreciated!
justaoldman
(Justan Oldman)
November 20, 2023, 11:43pm
17
is not what your error listed as the install path
This is what you posted as your install path
*D:\OpenHab\openhab-4.0.4*
Oliver2
(Oliver)
November 20, 2023, 11:44pm
18
Change just this line
set.default.OPENHAB_HOME=D:\OpenHab
into
set.default.OPENHAB_HOME=D:\OpenHab\openhab-4.0.4
I would recommend copying the content from openhab-4.0.4 to D:\OpenHab
justaoldman
(Justan Oldman)
November 20, 2023, 11:50pm
19
Either way but when it comes time to remove the service and or do backups it might become confusing with 2 installs
Edit I would just fix the path in the openHAb-wrapper.conf
file myself