Skip to content
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

Chromium apps wrapped with buildFHSEnvBubblewrap don't work on X11 when XAUTHORITY is stored in /run #301813

Open
steinuil opened this issue Apr 5, 2024 · 0 comments

Comments

@steinuil
Copy link
Contributor

steinuil commented Apr 5, 2024

Describe the bug

I tried to run the Heroic Games Launcher (which is an Electron application and is wrapped using buildFHSEnvBubblewrap in NixOS), but it returns an error:

Authorization required, but no authorization protocol specified

[74969:0405/130128.036942:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY
[74969:0405/130128.036952:ERROR:env.cc(255)] The platform failed to initialize.  Exiting

Which I suspect is related to Xauth, because the $DISPLAY env var is definitely set in my terminal.

I think this is what causes it:

I enabled user-authority-in-system-dir in LightDM to try and clean up my $HOME directory. This option makes LightDM start the X11 server with the .Xauthority file in /run/lightdm/<username>/xauthority rather than $HOME/.Xauthority, which is also reflected in the XAUTHORITY env variable.

I suspect that the bubblewrap env does not expose /run/lightdm, so Electron doesn't find the .Xauthority file and doesn't even try to connect to the X11 display. I kind of confirmed this by copying /run/lightdm/<username>/xauthority to ~/.Xauthority and started heroic with XAUTHORITY=~/.Xauthority heroic, which worked.

I see that there's already a fix for SDDM which places XAUTHORITY in /tmp. Would it be possible to also fix the situation where XAUTHORITY is in /run?

https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/build-fhsenv-bubblewrap/default.nix#L209

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enable user-authority-in-system-dir in lightdm config:
    {
      services.xserver.displayManager.lightdm.extraConfig = ''
        [LightDM]
        user-authority-in-system-dir=true
      '';
    }
  2. Start an X11 session through LightDM
  3. Run heroic

Expected behavior

Heroic Games Launcher connects to the X11 server using the Xauthority file in /run/lightdm/<username>/xauthority.

Notify maintainers

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.22, NixOS, 24.05 (Uakari), 24.05.20240321.20f77aa`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `not found`

Add a 👍 reaction to issues you find important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant