Jump to content

Connecting to minecraft server running on CentOS 8, please help (!)

Go to solution Solved by MrPotatoFace,

Ok, I formatted and removed every partition from the drive, reinstalled CentOS, redownloaded the server but did everything according to this guide instead: https://www.spinup.com/setting-up-a-minecraft-server-on-centos-8/. Everything now works great! Thanks a lot to @Eigenvektor & @Master Disaster for all the help. Edit: I realized afterwards that may have sounded sarcastic, that was truly not the intention. I have however run into a small issue: I cannot for the life of me prevent the machine from sleeping when I close the lid. I have changed pretty much every setting related to the lid in "/etc/systemd/logind.conf" to "ignore". I have also run this command: "systemctl restart systemd-logind", which asks for authorization and then turns my blinking underscore-cursor red. It does not help however. Edit: solution turned out to be uncommenting the lines in the .conf file by removing the #.

After some hassle, I managed to download CentOS on an old laptop of mine, as well as running a minecraft server after accepting the EULA. The problem is that I can't connect to it. I followed this guide for CentOS 8: https://linuxhint.com/install_centos_8_server/, this guide for sever: https://www.hostinger.com/tutorials/how-to-setup-minecraft-server#How-to-Make-a-Minecraft-Server-on-Linux, and finally portforwarded port 25565 to said laptop. Note that I am using the version of CentOS with no graphical interface and I did not get to install Screen. After reading this: 

I downloaded tmux instead (simply replacing the word screen with tmux), but did not end up using it, simply skipping it in tutorial about server. I seem to be having the same issue as this guy: https://forums.centos.org/viewtopic.php?t=59003, however, when trying their solution I simply get "Authorization Failed."

"Make sure polkit agent is running or run the application as superuser."

I am a big noob when it comes to Linux and all this other stuff, but I have run a minecraft server om my main PC for me and my friends before. I have been at this for hours and I really appreciate any help I can get!

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, MrPotatoFace said:

Note that I am using the version of CentOS with no graphical interface and I did not get to install Screen.

Screen is a command line tool and does not require a graphical interface. It allows you to run a command (e.g. in an SSH session) and detach from that session so that it continues running even though you're disconnected.

 

Have you checked whether the required ports are open in the firewall of the CentOS 8 machine? Try "sudo iptables -vL", this should tell you whether a firewall is active and which ports are allowed in.

 

Can you give a bit more details about which commands you've tried and what the exact result is?

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

Did a bit of Googling and it seems like Screen is stored in the EPEL (Extra Programs for Enterprise Linux) Repo which isn't enabled by default.

 

Edit - This change was made for RHEL/CENTOS 8 and the guide you are following is for CENTOS 7 which is why the method it states doesn't work anymore.

 

You need to do

dnf install epel-release -Y

to enable it then you can pull Screen with

dnf install screen -Y

 

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Eigenvektor said:

Screen is a command line tool and does not require a graphical interface. It allows you to run a command (e.g. in an SSH session) and detach from that session so that it continues running even though you're disconnected.

 

Have you checked whether the required ports are open in the firewall of the CentOS 8 machine? Try "sudo iptables -vL", this should tell you whether a firewall is active and which ports are allowed in.

 

Can you give a bit more details about which commands you've tried and what the exact result is?

Checked ports? no clue. the command you suggested return 3 text chunks;

 

Chain INPUT (policy ACCEPT 20026 packets, 40M bytes)

 pkts vytes target    prot opt in    out     source

same thing repeats 2 times, except with:

... FORWARD ... 0 ... 0

&

... OUTPUT ... 5039 ... 395K

 

I've tried the solution person with firewall issues was suggested, that is when i get the error message.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Master Disaster said:

Did a bit of Googling and it seems like Screen is stored in the EPEL (Extra Programs for Enterprise Linux) Repo which isn't enabled by default.

 

You need to do


dnf install epel-release -Y

to enable it then you can pull Screen with


dnf install screen -Y

 

Ok, now it says it needs to be run with superuser priviliges (under the root user on most systems) but I am logged into the only user(which is admin) and username of said user is displayed on last line in command prompt.

Link to comment
Share on other sites

Link to post
Share on other sites

sudo dnf install epel-release

then

sudo dnf install screen

 

You can miss the -Y, all this does is accept the pull without asking you.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, MrPotatoFace said:

Chain INPUT (policy ACCEPT 20026 packets, 40M bytes)

 pkts vytes target    prot opt in    out     source

This tells you, that the machine's default policy for incoming network connections is "ACCEPT". Essentially this means there is no firewall for incoming connections, it'll accept traffic on any network port. You didn't quote those parts for FORWARD and OUTPUT, but I'm going to assume they are ACCEPT also, which means the firewall is essentially inactive and not the source of your issues.

 

Install screen as @Master Disaster instructed, then try again running the Minecraft server. Once that is up an running you can use "netstat -tulpen" to see if it is listening on any port. If so, you should be able to connect to it.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Master Disaster said:

sudo dnf install epel-release

then


sudo dnf install screen

 

You can miss the -Y, all this does is accept the pull without asking you.

That worked! screen now running (presumably as it should)

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, Eigenvektor said:

This tells you, that the machine's default policy for incoming network connections is "ACCEPT". Essentially this means there is no firewall for incoming connections, it'll accept traffic on any network port. You didn't quote those parts for FORWARD and OUTPUT, but I'm going to assume they are ACCEPT also, which means the firewall is essentially inactive and not the source of your issues.

 

Install screen as @Master Disaster instructed, then try again running the Minecraft server. Once that is up an running you can use "netstat -tulpen" to see if it is listening on any port. If so, you should be able to connect to it.

Ok, screen is running, I used "netstat -tulpen" and the resulting list contains one line with 25565(minecraft port) in it:

Proto   Rev-Q   Send-Q   Local address   Foreign address   STATE       User     Inode      PID/Program name

tcp6     0            0              :::25565            :::*                        LISTEN     1000     82171     33583/java

Still can't connect to it, though

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, MrPotatoFace said:

Ok, screen is running, I used "netstat -tulpen" and the resulting list contains one line with 25565(minecraft port) in it:

Proto   Rev-Q   Send-Q   Local address   Foreign address   STATE       User     Inode      PID/Program name

tcp6     0            0              :::25565            :::*                        LISTEN     1000     82171     33583/java

Still can't connect to it, though

Are you connecting internally or externally? Have you forwarded the port through your router firewall?

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, MrPotatoFace said:

Ok, screen is running, I used "netstat -tulpen" and the resulting list contains one line with 25565(minecraft port) in it:

Proto   Rev-Q   Send-Q   Local address   Foreign address   STATE       User     Inode      PID/Program name

tcp6     0            0              :::25565            :::*                        LISTEN     1000     82171     33583/java

Still can't connect to it, though

Minecraft is a Java application, so that is probably it. It is listening on port 25565.

 

Is there an equivalent entry for tcp4? Because right now it seems to be only listening on IPv6. Are you using IPv6 on your internal network?

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Master Disaster said:

Are you connecting internally or externally? Have you forwarded the port through your router firewall?

Yes, I have forwarded the port(TCP + UDP), and I am trying to connect on my other PC using the local iPv4 address of the laptop running the server.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Eigenvektor said:

Minecraft is a Java application, so that is probably it. It is listening on port 25565.

 

Is there an equivalent entry for tcp4? Because right now it seems to be only listening on IPv6. Are you using IPv6 on your internal network?

There are no entries for tcp4 in the list, as far as I know I'm only using IPv4 on my network, that is at least what I have been using when trying to connect to the server.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, MrPotatoFace said:

There are no entries for tcp4 in the list, as far as I know I'm only using IPv4 on my network, that is at least what I have been using when trying to connect to the server.

Right now Minecraft seems to only be listening on the machine's IPv6 interface, which is why you can't connect to it through IPv4.

 

You could try this one: https://superuser.com/questions/453298/how-to-force-java-to-use-ipv4-instead-ipv6

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

49 minutes ago, Eigenvektor said:

Right now Minecraft seems to only be listening on the machine's IPv6 interface, which is why you can't connect to it through IPv4.

 

You could try this one: https://superuser.com/questions/453298/how-to-force-java-to-use-ipv4-instead-ipv6

Ok, to be honest I can't make that much sense of that thread. I know it may be a lot to ask, but I really want to get this going even though I get the felling I don't have the background knowledge necessary. I would really appreciate it if you could explain what commands I should use.

Link to comment
Share on other sites

Link to post
Share on other sites

14 minutes ago, MrPotatoFace said:

Ok, to be honest I can't make that much sense of that thread. I know it may be a lot to ask, but I really want to get this going even though I get the felling a don't have the background knowledge necessary. I would really appreciate it if you could explain what commands I should use.

You should only need put the line below into the file ".bash_profile" in the home directory of the user that you use to run the Minecraft server. When you have added the line, you can reload the file by doing "source ~/.bash_profile". Replace "~" with the user's home directory, if you're using a different user than the one you're signed in with.

 

export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"

Afterwards you need to restart the Minecraft service and it should now default to using IPv4 instead of IPv6.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, Eigenvektor said:

You should only need put the line below into the file ".bash_profile" in the home directory of the user that you use to run the Minecraft server. When you have added the line, you can reload the file by doing "source ~/.bash_profile". Replace "~" with the user's home directory, if you're using a different user than the one you're signed in with.

 


export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"

Afterwards you need to restart the Minecraft service and it should now default to using IPv4 instead of IPv6.

Ok, I am about 95% sure I did this correctly, but I still cannot connect, and "netstat -tulpen" still doesn't show any tcp4.

Link to comment
Share on other sites

Link to post
Share on other sites

Ok, new day and for some reason things have changed. After restarting the laptop(now server I guess) I opened screen and attempted to run the server using the following command:

 

java Xmx4G Xms4G -jar server.jar nogui

 

This resulted in the following output:

Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true

Error: Could not find or load main class Xmx4G

Edit: Oops, typo(- before Xmx and Xms). Server now running, but I still can't connect to it.

Link to comment
Share on other sites

Link to post
Share on other sites

Can you try again what the output of the following two commands is:

ip addr show
netstat -tulpen

The first one should show you the IP address(es) of the server, the second one once again the listening port.

 

With the IP address and port you could try simply connecting to it with telnet from another machine. So "telnet <ip> <port>", see if you can connect or what kind of error you get.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

-> Moved to Linux, macOS and Everything Not-Windows

^^^^ That's my post ^^^^
<-- This is me --- That's your scrollbar -->
vvvv Who's there? vvvv

Link to comment
Share on other sites

Link to post
Share on other sites

Ok, I formatted and removed every partition from the drive, reinstalled CentOS, redownloaded the server but did everything according to this guide instead: https://www.spinup.com/setting-up-a-minecraft-server-on-centos-8/. Everything now works great! Thanks a lot to @Eigenvektor & @Master Disaster for all the help. Edit: I realized afterwards that may have sounded sarcastic, that was truly not the intention. I have however run into a small issue: I cannot for the life of me prevent the machine from sleeping when I close the lid. I have changed pretty much every setting related to the lid in "/etc/systemd/logind.conf" to "ignore". I have also run this command: "systemctl restart systemd-logind", which asks for authorization and then turns my blinking underscore-cursor red. It does not help however. Edit: solution turned out to be uncommenting the lines in the .conf file by removing the #.

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, MrPotatoFace said:

Edit: I realized afterwards that may have sounded sarcastic, that was truly not the intention.

No worries ;) Sometimes starting from scratch is the easiest option.

 

Not really familiar with power settings, since I'm primarily a desktop user. Could you check in the laptop's BIOS if there's some setting that might still cause it to go to sleep?

 

The settings in logind.conf should be the correct ones, as far as I could find. You probably found this link already: https://unix.stackexchange.com/a/52645, this is pretty much what you tried already. You could maybe try checking the kernel.log (see question on stackexchange) to see if there are entries related to sleep mode still.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

37 minutes ago, Eigenvektor said:

No worries ;) Sometimes starting from scratch is the easiest option.

 

Not really familiar with power settings, since I'm primarily a desktop user. Could you check in the laptop's BIOS if there's some setting that might still cause it to go to sleep?

 

The settings in logind.conf should be the correct ones, as far as I could find. You probably found this link already: https://unix.stackexchange.com/a/52645, this is pretty much what you tried already. You could maybe try checking the kernel.log (see question on stackexchange) to see if there are entries related to sleep mode still.

I checked the BIOS, but they seem very limited. Couldn't find the correct settings. Could it be that the BIOS have been intentionally limited, since this is a laptop? I couldn't find any "expert" or "advanced" mode either.

Link to comment
Share on other sites

Link to post
Share on other sites

15 hours ago, MrPotatoFace said:

I checked the BIOS, but they seem very limited. Couldn't find the correct settings. Could it be that the BIOS have been intentionally limited, since this is a laptop? I couldn't find any "expert" or "advanced" mode either.

Figured it out! Turns out all the lines in the logind.conf file are commented out, something I probably should have recognized, but I'm really only used to the // for comments. Anyways, changing this fixed it and the server now runs like a charm!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×