flathub / com.mojang.Minecraft

https://flathub.org/apps/details/com.mojang.Minecraft
32 stars 13 forks source link

Microsoft account doesn't remain logged in on non-GNOME systems #116

Closed vulongm closed 1 month ago

vulongm commented 2 years ago

When signing in with a Microsoft account I notice a warning that something went wrong and it would not automatically sign in the next session. The message links to https://help.minecraft.net/hc/en-us/articles/4408668374925-Secure-Token-Storage-Failure-on-Linux. image

AsciiWolf commented 2 years ago

Hmm, that's strange. I have Microsoft account logged in on my two computers with Flatpak Minecraft and everything seems to work fine.

AsciiWolf commented 2 years ago

Maybe they changed something in recent Launcher versions and gnome-keyring is now required for new accounts? That would be really unfortunate. Anyway, I will try to look into it when I have more time. Thank you for reporting it!

AsciiWolf commented 2 years ago

So, I have tested it on a clean Minecraft Flatpak installation multiple times and was not able to reproduce your issue. Can you try removing the ~/.var/app/com.mojang.Minecraft directory (warning: this will also remove all your Minecraft data) and logging in again?

ninjaguardsheep commented 2 years ago

I'm also seeing this issue, it persists even if I remove ~/.var/app/com.mojang.Minecraft.

I'm on openSUSE Tumbleweed with the following versions:

dave@titan:~> flatpak list
Name                        Application ID                              Version         Branch        Installation
Minecraft                   com.mojang.Minecraft                        928             stable        user
Freedesktop Platform        org.freedesktop.Platform                    21.08.7         21.08         user
Mesa                        org.freedesktop.Platform.GL.default         21.3.1          21.08         user
openh264                    org.freedesktop.Platform.openh264           2.1.0           2.0           user
Breeze GTK theme            org.gtk.Gtk3theme.Breeze                                    3.22          user
KDE Application Platform    org.kde.Platform                                            5.15-21.08    user

dave@titan:~> flatpak --version
Flatpak 1.12.2
AsciiWolf commented 2 years ago

Hmm, this is really strange. What desktop environment do you use? (Although it should not matter, Minecraft Flatpak does not have any dbus access to system gnome-keyring anyway.)

ninjaguardsheep commented 2 years ago

I'm on KDE, so gnome keyring Isn't running on the system.

vulongm commented 2 years ago

I'm still seeing the issue after removing the folder and retrying the sign in. I use the KDE Plasma DE as well.

vchernin commented 2 years ago

Hm, well it would be interesting if gnome-keyring helps. What portal packages do you have installed? e.g. xdg-desktop-portal-kde or xdg-desktop-portal-gtk?

vulongm commented 2 years ago

I have xdg-desktop-portal, xdg-desktop-portal-kde, and xdg-desktop-portal-gtk installed.

ninjaguardsheep commented 2 years ago

I have the same portal packages as @vulongm installed.

I've tried the following under KDE for the sake of completeness:

and I still get the error after running the launcher and going through the login flow.

vulongm commented 2 years ago

Trying out two new Fedora 35 VMs. Out of the box on the GNOME variant it seems to work fine but the issue does occur on the KDE Plasma variant.

vchernin commented 2 years ago

Could a KDE user try adding talk-name org.kde.kwalletd5 to the Minecraft Flatpak permissions? You can put it under Session Bus > Talks, with Flatseal or similar.

vulongm commented 2 years ago

The issue remains for me after adding it in. image

vchernin commented 2 years ago

To be sure did you restart Minecraft after adding it in Flatseal?

vulongm commented 2 years ago

Yes, I did restart the game after adding it in Flatseal and also tried deleting the app under the .var folder.

kowalski7cc commented 2 years ago

I have the same issue on ChromeOS, but not on Fedora 35

AsciiWolf commented 2 years ago

Yeah, Chrome OS probably does not have gnome-keyring-daemon running on background as well. However, this does not seem to be a Flatpak-related issue.

kowalski7cc commented 2 years ago

@AsciiWolf I followed https://wiki.archlinux.org/title/GNOME/Keyring#Shell for both fish (my login shell) and bash scripts, and it does work fine for the official DEB version. I also tried to delete everything and restart the launcher, with no success. 😢

~/.v/a/c/.minecraft ❯❯❯ flatpak run com.mojang.Minecraft                                                                                                                                                                                      ✘ 130
https://launchermeta.mojang.com/v1/products/launcher/6f083b80d5e6fabbc4236f81d0d8f8a350c665a9/linux.json
[0113/000208.813128:INFO:main_context.cpp(136)] CEF initialized successfully.
[0113/000208.813214:INFO:main_context.cpp(138)] CEF version: 86.0.23+ga2c2edf+chromium-86.0.4240.193
sh: riga 1: orca: comando non trovato
[0113/000208.844281:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Code Cache/wasm
[0113/000208.844391:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Code Cache/js
Created browser window for reuse: 0x400001
[0113/000208.946200:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Code Cache/wasm
[0113/000208.946331:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Code Cache/js
[0113/000208.967877:ERROR:disk_cache.cc(184)] Unable to create cache
[0113/000208.967943:ERROR:disk_cache.cc(184)] Unable to create cache
[0113/000209.013282:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
[0113/000209.164143:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=1
[0113/000209.397254:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Cache
[0113/000209.399696:ERROR:simple_backend_impl.cc(757)] Simple Cache Backend: wrong file structure on disk: 2 path: /home/kowalski7cc/.var/app/com.mojang.Minecraft/data/../.minecraft/webcache2/Cache
[0113/000209.399818:ERROR:disk_cache.cc(184)] Unable to create cache
[0113/000211.371987:WARNING:value_store_frontend.cc(43)] Reading mhjfbmdgcfjbbpaeojofohoefgiehjai.alarms from  failed: IO error: .../LOCK: Access denied. (ChromeMethodBFE: 15::LockFile::5)
Created browser window for reuse: 0x400007
[0113/000237.248608:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=2
[0113/000251.240917:ERROR:gl_surface_presentation_helper.cc(259)] GetVSyncParametersIfAvailable() failed for 1 times!
[0113/000253.509544:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=2
Created browser window for reuse: 0x40000f
[0113/000256.081759:WARNING:xproto_util.cc(51)] X error received: serial 1653, error_code 3 (BadWindow (invalid Window parameter)), request_code 4, minor_code 0 (X_DestroyWindow)
[0113/000258.602849:ERROR:gl_surface_presentation_helper.cc(259)] GetVSyncParametersIfAvailable() failed for 2 times!
[0113/000302.138358:ERROR:gl_surface_presentation_helper.cc(259)] GetVSyncParametersIfAvailable() failed for 3 times!
[0113/000314.666158:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-01-12 23:02:08.727709169: LauncherMain.cpp(104)] Initiated models
[0113/000314.666524:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-01-12 23:02:08.727921669: LauncherController.cpp(435)] Constructing launcher controller with workDir: /.../.minecraft, isActive: 0
[0113/000314.666685:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-01-12 23:02:56.100534289: LauncherAppRenderer.cpp(172)] Javascript bridge extended in OnWebKitInitialized.
[0113/000314.956288:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=3
[0113/000314.969778:INFO:LauncherAppRenderer.cpp(69)] OnBrowserDestroyed: id=3
[0113/000315.086804:WARNING:xproto_util.cc(51)] X error received: serial 2178, error_code 3 (BadWindow (invalid Window parameter)), request_code 4, minor_code 0 (X_DestroyWindow)
AsciiWolf commented 2 years ago

Hmm. Are you sure the deb version does not have this issue on Chrome OS?

kowalski7cc commented 2 years ago

@AsciiWolf Yes, and with the DEB, mojangClientToken appears listed in seahorse. I tried also adding Keyring to PAM (https://wiki.archlinux.org/title/GNOME/Keyring#PAM_step) and adding org.freedesktop.secrets to Session Bus with Flatseal, but still nothing.

jelle619 commented 2 years ago

I have this issue too. I am running GNOME on Debian 11 and have gnome-keyring installed.

vulongm commented 2 years ago

Installing gnome-keyring and adding org.freedesktop.secrets to session bus talks seems to fix it for me. Not sure if there's a solution that works without gnome-keyring though.

heavyelement commented 2 years ago

I'm getting this exact same issue on the Steam Deck and since Steam OS 3 uses an immutable filesystem, installing gnome-keyring is not an option. Would appreciate a fix for this! Thanks!

AsciiWolf commented 2 years ago

I have tried multiple ways to fix/workaround this, but still no luck. :-/ Would appreciate any help.

vulongm commented 2 years ago

I have tried multiple ways to fix/workaround this, but still no luck. :-/ Would appreciate any help.

Would it be possible to bundle a gnome-keyring just for this flatpak? The only flatpak I know of that has done it in the past is Evolution. An example is at https://github.com/flathub/org.gnome.Evolution/blob/6b363e4f1b330a4d816eedb6af961141f72006df/org.gnome.Evolution.json#L177.

AsciiWolf commented 2 years ago

I have tried multiple ways to fix/workaround this, but still no luck. :-/ Would appreciate any help.

Would it be possible to bundle a gnome-keyring just for this flatpak? The only flatpak I know of that has done it in the past is Evolution. An example is at https://github.com/flathub/org.gnome.Evolution/blob/6b363e4f1b330a4d816eedb6af961141f72006df/org.gnome.Evolution.json#L177.

Thanks for the link! Feel free to prepare a PR. I can't test this myself since I don't have any non-GNOME system here and don't have enough free time to set up one.

AsciiWolf commented 2 years ago

By the way, if anyone is interested in helping me co-maintain this Flatpak, I will be more than happy. I am sadly the only active maintainer.

vchernin commented 2 years ago

Could someone test please with this MR? https://invent.kde.org/frameworks/kwallet/-/merge_requests/11 It seems like it would be the proper fix (i.e. no bundling of gnome-keyring needed). But testing is needed.

Seil0 commented 2 years ago

Could someone test please with this MR? https://invent.kde.org/frameworks/kwallet/-/merge_requests/11 It seems like it would be the proper fix (i.e. no bundling of gnome-keyring needed). But testing is needed.

You mean by installing a patched version of kwallet while using the current minecraft flatpak? If so, i don't think this will fix this issue on the steam deck.

vchernin commented 2 years ago

You mean by installing a patched version of kwallet while using the current minecraft flatpak?

Yes

If so, i don't think this will fix this issue on the steam deck.

Why would it not? Is kwallet not used on the steam deck in the same way it's used elsewhere?

vchernin commented 2 years ago

And as mentioned in that PR, apparently the non Flatpak Minecraft launcher is affected by the same bug.

So it makes a lot of sense to fix it in KDE for everyone.

Seil0 commented 2 years ago

You mean by installing a patched version of kwallet while using the current minecraft flatpak?

Yes

If so, i don't think this will fix this issue on the steam deck.

Why would it not? Is kwallet not used on the steam deck in the same way it's used elsewhere?

Yes, kwallet is missing on the steam deck/steamOS 3.0 and I think if they are adding it, it'll take a while until it reaches affected users.

And as mentioned in that PR, apparently the non Flatpak Minecraft launcher is affected by the same bug.

So it makes a lot of sense to fix it in KDE for everyone.

You are right. It's currently just the steam deck that would require a special treatment until the issue can hopefully resolved properly.

vchernin commented 2 years ago

Yes, kwallet is missing on the steam deck/steamOS 3.0 and I think if they are adding it, it'll take a while until it reaches affected users.

Yeah. Even if it was already present, it would take some time to update it in any case.

That said steam os definitely should include it. Could someone please report the lack of kwallet in steam os to valve?

It's currently just the steam deck that would require a special treatment until the issue can hopefully resolved properly.

Yeah, when I have a moment I will test out bundling gnome-keyring here.

Seil0 commented 2 years ago

Could someone test please with this MR? https://invent.kde.org/frameworks/kwallet/-/merge_requests/11 It seems like it would be the proper fix (i.e. no bundling of gnome-keyring needed). But testing is needed.

Can confirm, this mr fixes the login issue with a KDE desktop.

Edit: If someone on tumbleweed wants to test it: https://software.opensuse.org//download.html?project=home%3Aseil0%3Abranches%3AKDE%3AFrameworks5&package=kwallet

Seil0 commented 2 years ago

That said steam os definitely should include it. Could someone please report the lack of kwallet in steam os to valve?

Done: https://steamcommunity.com/app/1675200/discussions/2/5764050278015152055/

vchernin commented 2 years ago

Made a quick attempt to bundle gnome-keyring in #122, it's very outdated for now since newer versions require some dependency hunting.

But in any case we need to know if the workaround actually works. At least nothing seems to regress for me on gnome.

grazzolini commented 2 years ago

This issue manifested itself first with me on the steam deck, but it also happened on Arch, when using the minecraft-launcher with firejail. But, even after running the launcher without firejail and with a keyring application installed, I still get an error when starting the launcher where it was not able to retrieve the account details and asks for login again. I have not yet tried installing kwallet on the deck, however.

AsciiWolf commented 2 years ago

Can you or someone else please try the build from #122? Thanks!

vulongm commented 2 years ago

Can you or someone else please try the build from #122? Thanks!

The build from the PR seems to give me the same error here without any noticeable differences.

grazzolini commented 2 years ago

@AsciiWolf I think the flatpak also needs permission to interact with the kernel keyring, and I didn't saw it on #122. The problem is that the launcher apparently saves the session information on the keyring.

AsciiWolf commented 2 years ago

I have updated the bundled libsecret. Feel free to retest using latest stable Minecraft Flatpak once the update is live on Flathub. It probably won't help, but it is still worth a try.

Atem18 commented 2 years ago

The same error is still present

JordanL2 commented 2 years ago

I also have this issue on Arch+Plasma with the flatpak, while the AUR works. I've installed gnome-keyring + seahorse and set up a "default" keyring with blank password.

The flatpak has many errors in the log about connecting to KWallet when it starts.

I've tried

  1. installing gnome-keyring (plus ensuring the daemon is running and the PAM modules are enabled)
  2. doing the above while setting XDG_CURRENT_DESKTOP=GNOME - this stopped the error messages about trying to connect to KWallet
  3. doing the above while enabling access to the session bus for the flatpak
  4. installing the patched KWallet mentioned above, and enabling access to the session bus for the flatpak - this also stopped the error messages about trying to connect to KWallet but still didn't fix it
JordanL2 commented 2 years ago

The following merge to KWallet might help (Frameworks 5.97): https://invent.kde.org/frameworks/kwallet/-/merge_requests/11

AsciiWolf commented 2 years ago

It will, but not on the Steam Deck non-desktop mode.

JordanL2 commented 2 years ago

Confirmed, worked for me too (Edit: On Arch).

Commands to apply changes:

flatpak --user override --socket=session-bus com.mojang.Minecraft
flatpak --user override --system-talk-name=org.kde.kwalletd5 com.mojang.Minecraft
vertigo-red commented 2 years ago

It did reset for some reason after reboot. Permissions remained same. Investigating issue. Previous post:

Fixed it. My system:

Operating System: openSUSE Tumbleweed 20220725
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.11-1-default (64-bit)
Graphics Platform: X11

with kwallet-5.96.0-1.1 installed.

My steps:

  1. Turned on socket=session-bus
  2. Added org.kde.kwalletd5 to System Bus -> Talks

Everything done through Flatseal.

JordanL2 commented 2 years ago

For me it worked after rebooting.

I have kwallet-manager and kwallet-pam installed. The kwallet subsystem is enabled (so presumably starts on boot) and I have no password set on the wallet. I'm using SDDM.

vulongm commented 2 years ago

@SirDK The patch hasn't landed in 5.96 yet.

JordanL2 commented 1 year ago

Well that's a head scratcher. Wonder how it's working. @SirDK do you have gnome-keyring installed? I do, I wonder if these permissions enabled access to gnome-keyring and got it past a stage where it was previously blocked.

EDIT: I also used the same .minecraft directory that I used with the non-flatpak version (and have access to ~/.minecraft enabled in the flatpak).