TheRemote / MinecraftBedrockServer

Sets up a Minecraft Bedrock dedicated server on Ubuntu with options for automatic updates and running at startup
https://jamesachambers.com/minecraft-bedrock-edition-ubuntu-dedicated-server-guide/
MIT License
811 stars 173 forks source link

Minecraft latest version check stuck waiting response, cannot start server #87

Closed christo911 closed 3 years ago

christo911 commented 3 years ago

Hi, After working system was rebooted, I am stuck at the version check part of the start script.

Resolving www.minecraft.net (www.minecraft.net)... 203.121.59.232, 203.121.59.241 Connecting to www.minecraft.net (www.minecraft.net)|203.121.59.232|:443... connected. HTTP request sent, awaiting response...

Then endless wait. Have reinstalled server.. not solved New VM with Ubuntu 20.4 and run new SetupShell... also not solved (Stuck at checking latest version) Can ping .minecraft.net ok

Any ideas?

lurobi commented 3 years ago

Can confirm on an AWS Ubuntu instance as well as my home server (Debian).

Oddly enough my home server the --timeout option will at least be respected and I can force a time out in 15 seconds, but on the AWS instance, wget 1.20.3 won't timeout for a very long time, regardless of the --timeout option.

This is the command that is hanging:

wget --quiet http://www.minecraft.net/ -O /dev/null

(and then)

wget -O downloads/version.html https://minecraft.net/en-us/download/server/bedrock/

It's worth noting that curl works fine:

curl -o downloads/version.html https://www.minecraft.net/en-us/download/server/bedrock

This SO post seems to suggest it could be SSL/TLS handshake messing up wget. curl --verbose reports TLSv1.3 being used, but forcing this choice with wget --secure-protocol=TLSv1_3 doesn't seem to fix it.

lneukirchner commented 3 years ago

Just tried to convert the script to using curl commands. It seems the problem may not just be the wget commands but also

DownloadURL=$(grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' downloads/version.html)

The reason why I believe this to be the case is replacing the following wget with a curl command returns

curl: (3) URL using bad/illegal format or missing URL

And running

echo $DownloadURL

returns nothing. I'm not sure of the exact implications of what all this means, but I believe this to be another issue closely related. Hopefully it is fixed soon, most likely by mojang or microsoft since it seems the URL is the problem.

lurobi commented 3 years ago

My testing worked fine below, and simply replacing those two commands in start.sh worked when I restarted the service.

From your error, it looks like the initial curl command was given a bad URL, but that's a static option in the script...

lurobi@poirot:~$ curl -o version.html https://www.minecraft.net/en-us/download/server/bedrock
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  301k    0  301k    0     0   424k      0 --:--:-- --:--:-- --:--:--  423k
lurobi@poirot:~$ DownloadURL=$(grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' version.html)
lurobi@poirot:~$ echo $DownloadURL
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.221.01.zip
lurobi@poirot:~$ curl -O $DownloadURL
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 51.7M  100 51.7M    0     0  13.0M      0  0:00:03  0:00:03 --:--:-- 13.0M
lurobi@poirot:~$ ls -lh bedrock-server-1.16.221.01.zip
-rw-r--r-- 1 lurobi lurobi 52M May 22 00:09 bedrock-server-1.16.221.01.zip
lurobi@poirot:~$
starkey-01 commented 3 years ago

I am experiencing the same issue. Minecraft fails to start automatically as it hangs on "HTTP request sent, awaiting response..." at the end of start.sh.

My workaround for now is to comment out the Minecraft update lines at the end of start.sh until this issue is resolved. However, the Bedrock server may stop working if Mojang release an update any time soon. Alternatively, you can manually start your server with the following command in your /minecraftbe/servername directory: $ LD_LIBRARY_PATH=. ./bedrock_server

$ wget http://www.minecraft.net/ -O /dev/null

URL transformed to HTTPS due to an HSTS policy
--2021-05-22 16:09:00--  https://www.minecraft.net/
Resolving www.minecraft.net (www.minecraft.net)... 61.9.193.233, 23.205.115.19
Connecting to www.minecraft.net (www.minecraft.net)|61.9.193.233|:443... connected.
HTTP request sent, awaiting response... 
lurobi commented 3 years ago

I believe @TheRemote fixed it in 7caa391d76dba4d4f643c36e422c68f2201881a8 by changing the wget commands to include a user agent. It now reads:

wget -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" -O downloads/version.html https://minecraft.net/en-us/download/server/bedrock/
ZsZs73 commented 3 years ago

Apparently Akamai (frontend of minecraft.net) considers wget as bot. At least we enjoy the 'tarpit' action of their bot manager: https://developer.akamai.com/akamai-bot-manager I also found that wget http://www.minecraft.net works only if User-Agent does not contain wget

Parkertg commented 3 years ago

I'm having the same issue here.. still haven't been able to trouble shoot it enough to get the server started though. I was able to (somewhat manually) get the new version downloaded, but can't start the server now.. Seems to be a permission error

Parkertg commented 3 years ago

well, I just needed chmod +x ./bedrock_server it seems. not so hard after all. still not sure what changed that required me to include that now where as it wasn't needed before

TheRemote commented 3 years ago

Hey everyone,

This was due to more flagging of the script as a bot. Sorry for the inconvenience, it has been patched to impersonate Chrome to try to get ahead of this as I'm certain we're not the target of this!