-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minecraft client no longer works on NixOS #179323
Comments
This is happening on recent versions of
|
I am experiencing the same problem. I can aditionally provide some logs:
|
might be related to the launcher, because it was not updated since 2021-01-27 |
I've experienced the same, and I believe it might be a launcher issue as well. From what I understand, the Minecraft launcher is responsible for pre-fetching Java libraries (which makes sense, given the error message posted by @Stunkymonkey ). Unfortunately, it looks like the version of the launcher within the derivation is the most recent that can be fetched with a reproducible build. In The actual Minecraft launcher download page for Linux just uses the URL When the client is run, there's a popup about updating the client with a clickable link (see img)
So, it looks like a patch might be necessary regardless. I've tried |
In the past it looks like we've referred to Flatpak for how they download the launcher: #107046. I was looking at Flatpak again and in flathub/com.mojang.Minecraft#126 they switch to a different version train (?) of the launcher. I'm not totally sure what launcher this is, but it coincides with the
{
"jre-x64": [],
"jre-x86": [],
"launcher-bootstrap": [
{
"availability": {
"group": 2631,
"progress": 100
},
"manifest": {
"sha1": "b233e56e61f74c8aa69e377fb348dc4643da8b36",
"size": 460,
"url": "https://launchermeta.mojang.com/v1/packages/b233e56e61f74c8aa69e377fb348dc4643da8b36/manifest.json"
},
"version": {
"name": "1.0.1221",
"released": "2022-03-23T23:03:04+00:00"
}
}
], I'm able to actually download an archive by updating
However, once I do so I'm running into issues with
|
I think this might just be the launcher bootstrapper (which would download the launcher), so probably not what we want, since it won't be reproducible. |
Still no luck trying to figure out the I ended up booting up Ubuntu in a VM and running the Minecraft launcher bootstrapper while sniffing the traffic with Wireshark to see what it's pulling. I'm still sorting through the packets, but I did find this URL that looked interesting:
If you download it you get an LZMA compressed file:
|
I downloaded version 2.2.1441 of the Minecraft launcher on my Ubuntu VM and clicked the link in the popup. It takes you to https://aka.ms/MinecraftLauncher which then redirects to https://www.minecraft.net/en-us/download to download Minecraft. |
One thing I did notice during this process is that the contents of the archive file downloaded from
Are very similar to the contents of the manifest for I suspect downloading each of these files from the manifest and putting them into a directory would be the equivalent of downloading and extracting a tar archive for the launcher version (albeit more annoying to do). |
I'm still trying to piece together what the different launcher versions are, but here's the relevant entries from https://launchermeta.mojang.com/v1/products/launcher/6f083b80d5e6fabbc4236f81d0d8f8a350c665a9/linux.json: "launcher-core-ado": [
{
"availability": {
"group": 6499,
"progress": 100
},
"manifest": {
"sha1": "775504f590a53c88f8636d796e0ebfaf42caf9db",
"size": 30807,
"url": "https://piston-meta.mojang.com/v1/packages/775504f590a53c88f8636d796e0ebfaf42caf9db/manifest.json"
},
"version": {
"name": "2.3.280",
"released": "2022-06-30T20:49:19+00:00"
}
}
],
"launcher-core-v2": [
{
"availability": {
"group": 4022,
"progress": 100
},
"manifest": {
"sha1": "688bc2598db8ce144841701ad2b0b11a1bf8035f",
"size": 29102,
"url": "https://launchermeta.mojang.com/v1/packages/688bc2598db8ce144841701ad2b0b11a1bf8035f/manifest.json"
},
"version": {
"name": "2.2.12148",
"released": "2022-03-24T03:13:44+00:00"
}
}
], The version listed under |
For anyone else who's stuck on this and just wants to play Minecraft (as opposed to fixing the broken |
I only have this problem when launching 1.19. Earlier versions work fine. nixos-22.05 |
Unfortunately Minecraft is currently broken in nixpkgs :'( NixOS/nixpkgs#179323
I have this problem too |
I wrote a script to download the launcher and assemble the Commits are here: 3a11db5...plredmond:nixpkgs:92e8b4bcdee4896470c319bbda472d441df265a9 To reproduce, you run |
Maybe we should at least ask Mojang if the new versions are available at another URL and if not, if they could restore that feature? |
I was able to get the new minecraft client to run. These are the steps I took:
Here, I tried to run the My workaround was to copy the files in
I'm aware that this is a somewhat hacky solution, yet as I'm unexperienced in nix packaging, I hope someone else can take the info and update the package accordingly. Would be much appreciated :) 1: let pkgs = import <nixpkgs> {};
in pkgs.callPackage (
{ lib, stdenv
, at-spi2-core
, at-spi2-atk
, libsecret
, libdrm
, mesa
, fetchurl
, nixosTests
, copyDesktopItems
, makeDesktopItem
, makeWrapper
, wrapGAppsHook
, gobject-introspection
, jre # old or modded versions of the game may require Java 8 (https://aur.archlinux.org/packages/minecraft-launcher/#pinned-674960)
, xorg
, zlib
, nss
, nspr
, fontconfig
, pango
, cairo
, expat
, alsa-lib
, cups
, dbus
, atk
, gtk3-x11
, gtk2-x11
, gdk-pixbuf
, glib
, curl
, freetype
, libpulseaudio
, libuuid
, systemd
, flite ? null
, libXxf86vm ? null
}:
let
desktopItem = makeDesktopItem {
name = "minecraft-launcher";
exec = "minecraft-launcher";
icon = "minecraft-launcher";
comment = "Official launcher for Minecraft, a sandbox-building game";
desktopName = "Minecraft Launcher";
categories = [ "Game" ];
};
envLibPath = lib.makeLibraryPath [
curl
libpulseaudio
systemd
alsa-lib # needed for narrator
flite # needed for narrator
libXxf86vm # needed only for versions <1.13
];
libPath = lib.makeLibraryPath ([
alsa-lib
at-spi2-core
at-spi2-atk
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
libsecret
libdrm
mesa
pango
gtk3-x11
gtk2-x11
nspr
nss
stdenv.cc.cc
zlib
libuuid
] ++
(with xorg; [
libX11
libxcb
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
libXScrnSaver
]));
in
stdenv.mkDerivation rec {
pname = "minecraft-launcher";
version = "2.2.1441-2";
src = fetchurl {
url = "http://localhost:8000/minecraft-launcher.tar.gz";
sha256 = "27e1d10333b4ff5aabef04fe0c61d53368db5e699f3d80621b9c4b55c5d4d465";
};
icon = fetchurl {
url = "https://launcher.mojang.com/download/minecraft-launcher.svg";
sha256 = "0w8z21ml79kblv20wh5lz037g130pxkgs8ll9s3bi94zn2pbrhim";
};
nativeBuildInputs = [ makeWrapper wrapGAppsHook copyDesktopItems ];
buildInputs = [ gobject-introspection ];
sourceRoot = ".";
dontWrapGApps = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/opt
mv minecraft-launcher $out/opt
install -D $icon $out/share/icons/hicolor/symbolic/apps/minecraft-launcher.svg
runHook postInstall
'';
preFixup = ''
patchelf \
--set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/chrome-sandbox
patchelf \
--set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/minecraft-launcher
patchelf \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/libcef.so
patchelf \
--set-rpath '$ORIGIN/'":${libPath}" \
$out/opt/minecraft-launcher/liblauncher.so
'';
postFixup = ''
# Do not create `GPUCache` in current directory
makeWrapper $out/opt/minecraft-launcher/minecraft-launcher $out/bin/minecraft-launcher \
--prefix LD_LIBRARY_PATH : ${envLibPath} \
--prefix PATH : ${lib.makeBinPath [ jre ]} \
--set JAVA_HOME ${lib.getBin jre} \
--chdir /tmp \
"''${gappsWrapperArgs[@]}"
'';
desktopItems = [ desktopItem ];
meta = with lib; {
description = "Official launcher for Minecraft, a sandbox-building game";
homepage = "https://minecraft.net";
maintainers = with maintainers; [ cpages ryantm infinisil ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
passthru = {
tests = { inherit (nixosTests) minecraft; };
updateScript = ./update.sh;
};
}) {} |
To anyone else who has followed the above advice, beware the following (got this when updating):
see more on #196480 (comment). |
This comment was marked as duplicate.
This comment was marked as duplicate.
Has there been any updates on this issue? I got here after facing the same issue on |
I don't think so, but I am actually using PrismLauncher with any problems |
RIP, I hoped I could stick to the official launcher. |
I think you should be able to download the official |
Nah, I'd rather have simple setup than sticking to the official. Thanks anyways. |
This is a good choice, that i could not make, unfortunateally (for accounts of age <18, you cannot use 3rd party launchers) For anyone who does want to go down this path, here are the steps (because oh my god did this suck to figure out). Dependencies:
Installing the LauncherDownload the official launcher (use the
Now, to launch the launcher you can run the following command (with LD_LIBRARY_PATH=/home/<your-username>/.nix-profile/lib:/nix/var/nix/profiles/system/sw/lib ~/.minecraft/launcher/minecraft-launcher You are now done! (but not if you use fabric (mod loader), or an nvidia optimus laptop...) Configuring NVIDIA dGPU for optimus laptops (if you dont know what that means, you probably do not have one)This is where First, copy the following rust code to a file named use std::{env, process::Command, os::unix::process::CommandExt};
fn main() {
Command::new("java")
.env("__NV_PRIME_RENDER_OFFLOAD", "1")
.env("__NV_PRIME_RENDER_OFFLOAD_PROVIDER", "NVIDIA-G0")
.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
.env("__VK_LAYER_NV_optimus", "NVIDIA_only")
.args(env::args().skip(1))
.exec();
} Then, place the produced executable But why rust? isn't bash good?WRONG. Attempting to use a bash script to replicate the function of the rust program will not work. If you do try this, or like me tried it thinking it was the correct way, minecraft will launch, and it will use the dedicated GPU, however fabric, and any mods for it will not be loaded AT ALL. no error messages, no logs, nothing. Notes:This is not a great way of doing things (having to run multiple commands in the shell every time you want to start the launcher is the big reason, though i might try and improve this in the future), and if anyone wants to upstream a better version of this that would be great Also, if the current |
This seems odd, any idea why? What about launching via something like switcherooctl? |
absolutely no idea. the issue with something like notes:
|
Thanks for the detailed walk-through, @rowan-sl.
Can you test if this package works on other platforms? If it does, then it's probably just broken on Linux; Depending on this, either |
You're welcome!
I'm not set up to test on anything other than my current system unfortunateally (which if it matters is NixOS 23.11 unstable, nvidia optimus laptop with an AMD Ryzen 7 cpu and NVIDIA 1650 Ti Mobile) (also this might actually be a NixOS spacific problem?) I think the package probably should be marked out of date (or equivilant) untill the version of the launcher in the package can be updated to the latest version, since in its current state it just crashes when launching the game. (also to me it looks like the only blocking issue here is the requirement of nixpkgs to have reliable builds, and not any technical issue (can someone clarify?)) The information/problems listed here will mostly be usefull after the version is updated, or for people doing it manually, and i think is the lesser problem here, since it only applies to using nvidia optimus with modded minecraft spacifically (either of the two on their own, or vanilla works just fine) If anyone would like to do more detailed testing and needs more details from me, or if anyone is trying to do the fix and it is failing, please ask me! |
I'll try an updated version of this on my local system, if it works I'll send a PR to update the same. (I doubt the fix would be as easy as this as is evident from earlier comments in this issue). Besides, there are 2 things you can mark in a package for this scenario:
Untrue, to the best of my knowledge; the requirement also includes basic functionality of the build working correctly (as is evident from this PR template checkbox requirement. |
Sorry, I had meant that the reason no one had fixed the problem of the launcher crashing [because of an outdated launcher] was that mojang does not offer a way to download specific versions of the more recent launcher builds. (unless this was not what you meant, in which case ignore what i just said) Either way, thank you for looking into this more on the nixpkgs side of things |
I'm new to Nix(OS), but I was wondering, has anybody tried simply writing a configuration snippet that loads an Ubuntu or Arch container in the background and simply runs Minecraft Launcher from there? |
I got this: prismlauncher works perfectly for me though! Thanx for the suggestion! |
Alr so i turned on logs for Java Edition and Here are The Results: Vanilla: ```12:02:08.002 12:02:08.063 Fabric: not sure if this helps but i thought it was a good idea yo put this in |
Alr i found a solution for myself, use See if this helps |
Hey, @cpages @ryantm @infinisil. Could you please look into this thread and potentially add a broken tag to this package until it's fixed? (if it applies) |
Someone pinged me asking for help with this, and I got curious about the actual root cause. Seems nobody has figured it out yet, so I went sleuthing. tl;dr: Minecraft versions 1.19 and up are broken with the official launcher because it now tries to download natively compiled, non-Java libraries to execute. This complicates things. As a workaround, use PrismLauncher (and use it anyway since it's open source, ad-free, community maintained, and has useful features to boot).As far as I can tell, the issue is a change in lwjgl, or how it is used. From what I can tell, prior to version 1.19 of the game, the Minecraft launcher would start it with lwjgl 3.2.2. It lists these lwjgl-related libraries in the classpath:
None of them contain an Since Minecraft version 1.19, it instead has all these libraries:
The From some sleuthing, it looks like lwjgl has always had the option of using native components. It just looks like Microsoft recently flipped over to actually using them. Previously it was instead using the pure java implementation, which naturally had no issues with NixOS. The good news is that PrismLaucher also uses lwjgl-3.3.1, and it also uses the native components as far as I can tell, but works in spite of this, so there's no issue with loading the shared library. This means it can probably be fixed without having to do something horrible like patching things at runtime. The difference is that, since PrismLauncher is compiled natively instead of being a repackaged binary package, it does not modify Hence, the nix package is broken (for Minecraft versions 1.19 and up). I think it should be marked as such, I'll send up a PR. I'm unsure why the previously detailed workarounds work. My guess is that somewhere hidden in them there is an env clear that applies only to the launched java instance that gets rid of the packages' |
Hm, scratch that, I'm not sure. The package still partially works, it's just broken for any Minecraft version younger than 1.19. Is this sufficiently broken to mark it broken? |
@TLATER thanks for your work in debugging this. I was recently setting up machines for young people to play Minecraft, and encountered the joys of the official launcher crashing.
I'd say so. This has been ongoing for ~18 months, give or take (in addition to however long it was occurring prior to this issue being opened). It was a fairly frustrating experience, and I found this issue only after I had decided to use |
Also just helped people with this... ran into the same problem regarding new versions failing in a way hard for people to debug themselves. I'm leaning toward marking the minecraft client as broken. (if people explicitly need old versions, they likely need a launcher anyway, or can figure out how to un-broken it). Or at least a warning. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
I used to play Minecraft on NixOS just fine, but ever since the game switched from Mojang IDs to Microsoft IDs, the Linux client no longer works. If I attempt to log in with Mojang, the software says that I am not online, which means that the server it's trying to talk to has disappeared I guess. If I attempt to log in with the Microsoft ID, it does work initially, but then the game won't start saying it experienced an unexpected crash.
The text was updated successfully, but these errors were encountered: