I'm trying to set up a server on a google cloud server running Ubuntu 18.04.3 LTS. I've set up an apache web site and am able to access it and am able to ping it from my computer. The only servers I know of running on my server are apache and ssh. I'm able to turn off apache but not ssh as I am using ssh to tunnel into the server.

Things I've tried:

-Shutdown + restart, many, many times

-Turning off ufw entirely

-Allowing port 25565 in google cloud VPC network firewall

-Leaving server-ip blank (allows server to start but does not allow server to be accessed externally)

-Using internal ip for server-ip (same as leaving blank)

-Changing port number (same as leaving blank)

-Not having apache

Server.properties is same as default except with my server's external IP in the server-ip address.

$java -Xmx2048m -Xms2048m -jar server.jar nogui
[01:29:03] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[01:29:03] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:29:03] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:29:03] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[01:29:03] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:29:04] [Server thread/INFO]: Starting minecraft server version 1.15.1
[01:29:04] [Server thread/INFO]: Loading properties
[01:29:04] [Server thread/INFO]: Default game type: SURVIVAL
[01:29:04] [Server thread/INFO]: Generating keypair
[01:29:04] [Server thread/INFO]: Starting Minecraft server on 3X.X.X.X:25565
[01:29:04] [Server thread/INFO]: Using epoll channel type
[01:29:05] [Server thread/WARN]: **** FAILED TO BIND TO PORT!
[01:29:05] [Server thread/WARN]: The exception was: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Cannot assign requested address
[01:29:05] [Server thread/WARN]: Perhaps a server is already running on that port?
[01:29:05] [Server thread/INFO]: Stopping server
[01:29:05] [Server thread/INFO]: Saving worlds
[01:29:05] [Server thread/ERROR]: Exception stopping the server
java.lang.NullPointerException: nullat net.minecraft.server.MinecraftServer.a(SourceFile:558) ~[server.jar:?]
at net.minecraft.server.MinecraftServer.r(SourceFile:586) ~[server.jar:?]
at wd.r(SourceFile:593) ~[server.jar:?]
at net.minecraft.server.MinecraftServer.run(SourceFile:688) [server.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

Running netstat -tulpen displays the following:

$ netstat -tulpen
tcp     0   0*   LISTEN  101 15881   -
tcp     0   0*   LISTEN  0   20363   -
tcp6    0   0   :::80   :::*    LISTEN  0   18044   -
tcp6    0   0   :::22   :::*    LISTEN  0   20374   -
udp     0   0*   0   18018   -
udp     0   0*   101 15880   -
udp     0   0*   100 15668   -
udp6    0   0   ::1:323 :::*    0   18019   -

Running nmap -sV localhost shows that only ports 22 and 80 are open, for ssh and http respectively.

  • It's perfectly normal that using a public address (more precisely, an address that wasn't assigned to the server itself) would causes such error. Even if the public address is indeed dedicated to you, you'll still need to set up port forwarding (DNAT) in that case. – Tom Yan Jan 6 '20 at 5:05

It seems that a service is listening on the stated port. to kill anything running on it, you can use:
kill $(sudo lsof -t -i:25565).
Of course, it would be better to know what's running on it, so you can stop the service for future startups. You can see what service is using that port by running this command:
lsof -i :port -S.
If the service runs on startup, you can use this command to disable it from running (of course make sure that it is safe to do so):
sudo systemctl disable <servicename>.
Where <servicename> is the name of the service that is using the port.

  • If it's started via a service, there's chance it will be respawned whenever killed, so instead of just kill it, find the service out with unix.stackexchange.com/questions/225802/… and stop it with systemctl. There's also --now for disable btw. – Tom Yan Jan 6 '20 at 2:28
  • Thanks for that, I'll update my answer to use this rather than kill when I get home. – Rulon Rock Jan 6 '20 at 3:37
  • Running sudo lsof | grep 25565, sudo lsof -t -i:25565, and sudo lsof -i :25565 all return nothing. – guninvalid Jan 6 '20 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.