ryansch / docker-unifi-rpi

Unifi Controller for Raspberry Pi 3+ and x86
https://hub.docker.com/r/ryansch/unifi-rpi/
347 stars 42 forks source link

Port 8080 taken always by java upon start-up of Raspi #87

Closed doremifajb closed 2 years ago

doremifajb commented 2 years ago

Hello!

I had this problem of getting "Port 8080 not available." on Unifi Controller after rebooting Raspi4. I got a fix for it: "kill PID" for the job using 8080. Now, I realized that this happens each time I turn off Raspi4 and boot it again. So I would like to find a way to eliminate this issue, instead of fixing it afterwords by killing the job.

The job that takes 8080 is always java. Moreover, when I kill java while Unifi Controller is running, it loses connectivity. So it looks like "java" is also used by Unifi Controller. Also, when I "reboot" the Raspi using CLI, Unifi Controller does not lose connectivity. So it looks like it loses when Raspi is off for more than just one moment.

For now, I wrote a script to kill java upon reboot (by cron), but like I said, in case Unifi didn't lose connectivity, this kill would also kill the connectivity, so I don't like it so much. I would appreciate if you could please tell me what I could do: perhaps something else is competing with Unifi, which I might not need: I got RaspiOS with recommended applications, but I seldom use it for anything other than Unifi Controller, so I don't mind uninstalling something, if it is conflicting with Unifi.

alexberry commented 2 years ago

There could be literally any other application listening on port 8080, so with the information provided thus far it would be difficult to help. The only thing that is almost certain is that it's a web server, as port 8080 is frequently used as such.

If your disable you cron entry, reboot and then visit your pi on port 8080 in a browser, e,g http://raspberrypi:8080 then you might get a hint as to what is listening.

doremifajb commented 2 years ago

Thanks a lot for your hint ! I tried that: I shut down the Raspi, turned it on, made sure that Unifi is not working. But 192.168.1.30:8080 didn't give anything. However, this time, the result was slightly different: I didn't get "Port 8080 not available." anymore in the log. It was something else. I will paste it later.

On the page https://network.unifi.ui.com/, my Unifi Controller is showing as "online" (earlier it was "off line", when Port 8080 is not available), but without any client or connected AP. (i.e. red circle) and I cannot access to the controller.

So I did sudo kill job# of java. Then I could open the Unifi controller, but the APs go back and forth between "provisioning" and "disconnected". So I restarted the controller (on the portainer), killed java a few times, then finally the APs did get connected back.

So in the end, killing java once doesn't even help always. I tried the whole thing again (i.e. shutting down Rpi etc), this time "Port 8080 not available." came. But still 192.168.1.30:8080 didn't give anything. Killing the java once worked fine, though.

What I also don't understand is, when I do sudo netstat -lpn, I see just one java job. But when I do pgrep java I get two numbers. As I repeat pgrep java, one number is always the same (that's the one I see under netstat), but the other one changes. How could one job have two, and one of them not show up under netstat ?

I haven't consciously installed any web server. I wonder if remote.it or vnc viewer might contain some kind of web server? Otherwise is there any possibility that one might unconsciously install an web server along with something else ?