MinecraftBedrockServer icon indicating copy to clipboard operation
MinecraftBedrockServer copied to clipboard

Error updating to latest version of MC

Open crawlem opened this issue 7 months ago • 9 comments

During start.sh I see the following error, which prevents the server updating to the latest release (and therefore stops my clients connecting as they have successfully updated).

Checking for the latest version of Minecraft Bedrock server ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  319k    0  319k    0     0  1535k      0 --:--:-- --:--:-- --:--:-- 1535k
Latest version online is
Current install is: bedrock-server-1.21.84.1.zip
Installing
curl: (3) URL using bad/illegal format or missing URL

It looks like maybe the https://www.minecraft.net/en-us/download/server/bedrock page has changed, breaking the code which checks to see what the latest version is?

crawlem avatar Jun 17 '25 17:06 crawlem

Hey crawler and TheRemote -

I am also having this issue and looked pretty deep into it. I am a bash novice but my understanding is that Minecraft.net was modified to load the content dynamically which broke curl. I fixed the issue, though, by modifying start.sh to curl this page instead: https://net-secondary.web.minecraft-services.net/api/v1.0/download/links

I'd suggest that as a temporary workaround if not a potential fix to the GIT repo.

Cheers!

ywingdriver avatar Jun 17 '25 20:06 ywingdriver

I am having the same issue, the link has not changed by the looks of it, but something internal has which is preventing curl from downloading the file. Not sure if there is a third party site hosting separate download links that we can use.

TylerJohnson177 avatar Jun 17 '25 21:06 TylerJohnson177

@TylerJohnson177 try https://net-secondary.web.minecraft-services.net/api/v1.0/download/links - that's a page from the Minecraft API that returns the links. No clue if that will stay active at that link though.

ywingdriver avatar Jun 17 '25 21:06 ywingdriver

Is it possible for someone to upload their start.sh file with those modifications, because I am confused lol. I am ot sure where in the file to update the link, and which links to update.

Here is the part of the script that updates the server

`# Retrieve latest version of Minecraft Bedrock dedicated server echo "Checking for the latest version of Minecraft Bedrock server ..."

Test internet connectivity first

curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -s https://www.minecraft.net/ -o /dev/null if [ "$?" != 0 ]; then echo "Unable to connect to update website (internet connection may be down). Skipping update ..." exit else # Download server index.html to check latest version

curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -o downloads/version.html https://www.minecraft.net/en-us/download/server/bedrock
LatestURL=$(grep -o 'https://www.minecraft.net/bedrockdedicatedserver/bin-linux/[^"]*' downloads/version.html)

LatestFile=$(echo "$LatestURL" | sed 's#.*/##')

echo "Latest version online is $LatestFile"
if [ -e version_pin.txt ]; then
    echo "version_pin.txt found with override version, using version specified: $(cat version_pin.txt)"
    PinFile=$(cat version_pin.txt)
fi

if [ -e version_installed.txt ]; then
    InstalledFile=$(cat version_installed.txt)
    echo "Current install is: $InstalledFile"
fi

if [[ "$PinFile" == *"zip" ]] && [[ "$InstalledFile" == "$PinFile" ]]; then
    echo "Requested version $PinFile is already installed"
elif [ ! -z "$PinFile" ]; then
    echo "Installing $PinFile"
    DownloadFile=$PinFile
    DownloadURL="https://www.minecraft.net/bedrockdedicatedserver/bin-linux/$PinFile"

    # Download version of Minecraft Bedrock dedicated server if it's not already local
    if [ ! -f "downloads/$DownloadFile" ]; then
        curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -o "downloads/$DownloadFile" "$DownloadURL"
    fi

    # Install version of Minecraft requested
    if [ ! -z "$DownloadFile" ]; then
        if [ ! -e /home/tyler/minecraftbe/StormyLand/server.properties ]; then
            unzip -o "downloads/$DownloadFile" -x "*permissions.json*" "*whitelist.json*" "*valid_known_packs.json*" "*allowlist.json*"
        else
            unzip -o "downloads/$DownloadFile" -x "*server.properties*" "*permissions.json*" "*whitelist.json*" "*valid_known_packs.json*" "*allowlist.json*"
        fi
        Permissions=$(chmod u+x /home/tyler/minecraftbe/StormyLand/bedrock_server >/dev/null)
        echo "$DownloadFile" >version_installed.txt
    ./sendUpdate.sh
    fi
elif [[ "$InstalledFile" == "$LatestFile" ]]; then
    echo "Latest version $LatestFile is already installed"
else
    echo "Installing $LatestFile"
    DownloadFile=$LatestFile
    DownloadURL=$LatestURL

    # Download version of Minecraft Bedrock dedicated server if it's not already local
    if [ ! -f "downloads/$DownloadFile" ]; then
        curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -o "downloads/$DownloadFile" "$DownloadURL"
    fi

    # Install version of Minecraft requested
    if [ ! -z "$DownloadFile" ]; then
        if [ ! -e /home/tyler/minecraftbe/StormyLand/server.properties ]; then
            unzip -o "downloads/$DownloadFile" -x "*permissions.json*" "*whitelist.json*" "*valid_known_packs.json*" "*allowlist.json*"
        else
            unzip -o "downloads/$DownloadFile" -x "*server.properties*" "*permissions.json*" "*whitelist.json*" "*valid_known_packs.json*" "*allowlist.json*"
        fi
        Permissions=$(chmod u+x /home/tyler/minecraftbe/StormyLand/bedrock_server >/dev/null)
        echo "$DownloadFile" >version_installed.txt
    ./sendUpdate.sh
    fi
fi

fi `

TylerJohnson177 avatar Jun 17 '25 22:06 TylerJohnson177

Replace the line after

# Download server index.html to check latest version

(this line:)

curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -o downloads/version.html https://www.minecraft.net/en-us/download/server/bedrock

with this new line:

curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari/537.36" -o downloads/version.html https://net-secondary.web.minecraft-services.net/api/v1.0/download/links

Then run stop.sh and then start.sh (if you're on Ubuntu you can just right click the files and hit 'run as program'.) I believe restarting the server should also work but that's what I did.

Those steps are what worked for me anyway - definitely save a backup of the original start.sh in case that doesn't work.

UPDATE: For anyone who's interested in what this line does the original script downloads the page at https://www.minecraft.net/en-us/download/server/bedrock and saves it at the file location downloads/version.html in your Minecraft server folder. It does this so it can grab the URL of the bedrock server from the page. Unfortunately Microsoft has modified the page and so the link isn't downloaded anymore. The new page I've modified the script to download instead (https://net-secondary.web.minecraft-services.net/api/v1.0/download/links) I found by scouring the loaded network files at the suggestion of ChatGPT. Thankfully it's a publicly accessible JSON API endpoint so we can download it instead of the other page because it has the link to the bedrock zip file in it. Hopefully this endpoint will keep getting updated by Microsoft so it will be a reliable way to get the newest edition of the bedrock server.

ywingdriver avatar Jun 17 '25 22:06 ywingdriver

That worked, thank you very much.

TylerJohnson177 avatar Jun 17 '25 22:06 TylerJohnson177

Thanks everyone for bringing this up! I kind of figured Mojang updated the URL when my client version updated yesterday, but re-running the Instances on my Minecraft Server were still stuck on v1.21.84.1.

Created new 'start' scripts and now added them to my maintenance script I created. So I can manually run these as needed until an updated SetMinecraft.sh script is pushed.

POWerSUrgeSW3 avatar Jun 18 '25 20:06 POWerSUrgeSW3

As a simple workaround, you can add a version pin with the current version:

echo "bedrock-server-1.21.92.1.zip" > version_pin.txt

Then, simply stop & start the server.

QuimaxW avatar Jun 20 '25 03:06 QuimaxW