I apt-get installed OH2 on my rPi 3 a few weeks ago. After play around for a while with setup (which still vexes me), I decided to wipe and start from scratch. I followed the instructions here Reset Config and Databases to remove my configs, but that didn’t seem to do what I expected (the web UI was just broken after that). No problemo - I just ran apt-get remove openhab2, which worked easily, then I rebooted, and ran apt-get install openhab2-addons (I wanted both core and addon packages, so this was shorthand, of course). So far so good.
I had previously modified /etc/default/openhab2 so that it would listen on port 8080, which worked for the initial install. After re-install I can’t seem to connect at all and I see OH2 is now, for some reason, on port 8181, despite the config still telling it listen on 8080.
I don’t mind it being on 8181, but I suspect that’s a symptom of some larger problem because I can’t seem to connect, even on 8181 (it has been running for well over an hour, so this isn’t the “wait 15 min” thing… also, it only took about 3 minutes from install to usable last time around):
HTTP ERROR 404
Problem accessing /. Reason:
Powered by Jetty:// 9.3.22.v20171030
Here’s proof it is running, it is configured to 8080, but it somehow started on 8181. I don’t see any errors or useful details in /var/log/openhab2/openhab.log or events.log, only the usual stuff after a successful install.
root@raspberrypi:/var/log/openhab2# /bin/systemctl | grep -C 2 open; grep -C 2 port /etc/default/openhab2; netstat -lptn
networking.service loaded active exited LSB: Raise network interfaces.
ntp.service loaded active running LSB: Start NTP daemon
openhab2.service loaded active running openHAB 2 - empowering the smart home
packagekit.service loaded active running PackageKit Daemon
polkitd.service loaded active running Authenticate and Authorize Users to Run Privileged Tasks
## The ports openHAB will bind its HTTP/HTTPS web server to.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 632/vncserver-x11-c
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 757/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 8070/cupsd
tcp6 0 0 :::5900 :::* LISTEN 632/vncserver-x11-c
tcp6 0 0 :::5007 :::* LISTEN 24959/java
tcp6 0 0 :::8181 :::* LISTEN 24959/java
tcp6 0 0 :::22 :::* LISTEN 757/sshd
tcp6 0 0 ::1:631 :::* LISTEN 8070/cupsd
tcp6 0 0 127.0.0.1:42399 :::* LISTEN 24959/java
tcp6 0 0 127.0.0.1:8101 :::* LISTEN 24959/java
I wouldn’t worry about that. The fact that the CLI reports the URL to be http://192.168.1.3:8080 is a good indicator that it will use the correct port.
The errors that follow in the systemctl status command hint that openHAB is in a weird state. Did you manually delete folders and files in /var/lib/openhab2?
Those errors can be further investigated using the command:
sudo journalctl -u openhab2 -b
Perhaps this indicates anything useful? Feel free to post here if you’re unsure. Otherwise, the easiest thing to do to revert everything to defaults and remove everything including configuration is to run:
sudo apt purge openhab2
sudo apt install openhab2
since using apt remove doesn’t get rid of configuration files for a package and will keep your settings for the next install.
No worries! yum and apt work fairly differently so it can be a pain to go straight from one to the other. I think a yum removedoes get rid of everything.
@rlkoshak, would you be able to edit that post? Unfortunately, deleting the userdata folder will break openhab, so it needs to be fully replaced. Obviously, manual users can just copy the distro folder from the zip across. But for apt users, deleting a file or folder is regarded as a valid configuration, so it will not attempt to replace the file unless you specify the command: