NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.31k forks source link

XQuartz does not display anything on screen #151816

Open ayushkarnawat opened 2 years ago

ayushkarnawat commented 2 years ago

Describe the bug

When attempting to run any GUI application that depends on X11/XQuartz, the X11 server seem to startup, but no graphics are displayed locally. Running just the XQuartz binary (via the commandline XQuartz), results in the XQuartz app opening, but then immediately crashing with an error message "Failed to activate core devices."

Steps To Reproduce

  1. Create and activate a nix-shell environment with a (relatively new) version of nixpkgs:
# shell.nix
{ nixpkgs ? import (
  fetchTarball {
    name = "nixpkgs-21.08";
    url = "https://github.com/nixos/nixpkgs/archive/" +
      "fbafeb7ad5dd6196fcc5d84264e1706653a62f81.tar.gz";
    sha256 = "1kvx8j1z0xwfqjh33l3plhjc6dkjdg5md6zg667abdi06sg9w8pk";
  }) {}
}:

with nixpkgs;

mkShell {
  buildInputs = [
    llvmPackages_12.clang
    xorg.xeyes
    xquartz # for darwin only
  ];
  # Automate process of extracting correct paths to binaries. This (somewhat)
  # hacky approach works despite the fact that there might be multiple different
  # versions of the pkg of interest, as each version has its own unique hash.
  shellHook = ''
    clang_dir=$(ls -l /nix/store/ | grep ${llvmPackages_12.clang.pname + "-" +
      llvmPackages_12.clang.version} | grep '^d' | awk '/ / {print $NF}')
    export PATH="/nix/store/$clang_dir/bin:$PATH"
  '';
}
  1. Run xquartz-install to install xquartz as per the instructions

  2. Ensure that the DISPLAY environment variable is now set (note: you may need to logout for it to be set).

$ echo $DISPLAY
/private/tmp/com.apple.launchd.pahMNJkiNX/org.nixos.xquartz:0
  1. Run xeyes from the command line. The process hangs here, and no graphics are displayed.

Expected behavior

The application runs without error and displays the requested objects in a new Window on screen.

Screenshots

N.A., but can attach if it helps.

Additional context

NOTE: This pertains to and tested on darwin-based systems. Attempting to install/use XQuartz with nix-env results in the same problems. However, when using XQuartz downloaded via the disk installer .dmg, all applications work well, e.g. the graphics are displayed properly.

Notify maintainers

@cstrahan

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.6.0, macOS 10.16`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.8`
 - channels: `"darwin-20.09pre246307.9b8530e3721, nixpkgs-21.03pre250093.0da76dab4c2"`
 - nixpkgs: `$HOME/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
ayushkarnawat commented 2 years ago

Looking more into the difference between Xorg logs when running the Xorg binary from the nix-shell,

# nix-shell
[352688.091] 
X.Org X Server 1.18.4
Release Date: 2016-07-19
[352688.091] X Protocol Version 11, Revision 0
[352688.091] Build Operating System: Darwin 17.7.0 x86_64 
[352688.091] Current Operating System: Darwin mbp16.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64
[352688.091] Build Date: 05 August 2021  03:23:02PM
[352688.091]  
[352688.091] Current version of pixman: 0.38.4
[352688.091]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[352688.091] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[352688.092] (==) Log file: "/Users/ayushkarnawat/Documents/dev/misc/configs/local/share/xorg/Xorg.0.log", Time: Tue Dec 21 15:44:49 2021
[352688.092] (II) Loader magic: 0x109450530
[352688.092] (II) Module ABI versions:
[352688.092]    X.Org ANSI C Emulation: 0.4
[352688.092]    X.Org Video Driver: 20.0
[352688.092]    X.Org XInput driver : 22.1
[352688.092]    X.Org Server Extension : 9.0
[352688.093] (==) Using default built-in configuration (21 lines)
[352688.093] (==) --- Start of built-in configuration ---
[352688.093]    Section "Device"
[352688.093]        Identifier  "Builtin Default fbdev Device 0"
[352688.093]        Driver  "fbdev"
[352688.093]    EndSection
[352688.093]    Section "Screen"
[352688.093]        Identifier  "Builtin Default fbdev Screen 0"
[352688.093]        Device  "Builtin Default fbdev Device 0"
[352688.093]    EndSection
[352688.093]    Section "Device"
[352688.093]        Identifier  "Builtin Default vesa Device 0"
[352688.093]        Driver  "vesa"
[352688.093]    EndSection
[352688.093]    Section "Screen"
[352688.093]        Identifier  "Builtin Default vesa Screen 0"
[352688.093]        Device  "Builtin Default vesa Device 0"
[352688.093]    EndSection
[352688.093]    Section "ServerLayout"
[352688.093]        Identifier  "Builtin Default Layout"
[352688.093]        Screen  "Builtin Default fbdev Screen 0"
[352688.093]        Screen  "Builtin Default vesa Screen 0"
[352688.093]    EndSection
[352688.093] (==) --- End of built-in configuration ---
[352688.093] (==) ServerLayout "Builtin Default Layout"
[352688.093] (**) |-->Screen "Builtin Default fbdev Screen 0" (0)
[352688.093] (**) |   |-->Monitor "<default monitor>"
[352688.093] (**) |   |-->Device "Builtin Default fbdev Device 0"
[352688.093] (==) No monitor specified for screen "Builtin Default fbdev Screen 0".
    Using a default monitor configuration.
[352688.093] (**) |-->Screen "Builtin Default vesa Screen 0" (1)
[352688.093] (**) |   |-->Monitor "<default monitor>"
[352688.094] (**) |   |-->Device "Builtin Default vesa Device 0"
[352688.094] (==) No monitor specified for screen "Builtin Default vesa Screen 0".
    Using a default monitor configuration.
[352688.094] (==) Not automatically adding devices
[352688.094] (==) Not automatically enabling devices
[352688.094] (==) Not automatically adding GPU devices
[352688.094] (==) Max clients allowed: 256, resource mask: 0x1fffff
[352688.094] (==) FontPath set to:

[352688.094] (==) ModulePath set to "/nix/store/ja7rv40yzxjzv4ap7c9kaz9lplfq4x7f-xorg-server-1.18.4/lib/xorg/modules"
[352688.094] (==) |-->Input Device "<default pointer>"
[352688.094] (==) |-->Input Device "<default keyboard>"
[352688.094] (==) The core pointer device wasn't specified explicitly in the layout.
    Using the default mouse configuration.
[352688.094] (==) The core keyboard device wasn't specified explicitly in the layout.
    Using the default keyboard configuration.
[352688.094] (II) LoadModule: "glx"
[352688.094] (II) Loading /nix/store/ja7rv40yzxjzv4ap7c9kaz9lplfq4x7f-xorg-server-1.18.4/lib/xorg/modules/extensions/libglx.so
[352688.107] (II) Module glx: vendor="X.Org Foundation"
[352688.107]    compiled for 1.18.4, module version = 1.0.0
[352688.107]    ABI class: X.Org Server Extension, version 9.0
[352688.107] (==) AIGLX enabled
[352688.108] (II) LoadModule: "fbdev"
[352688.108] (WW) Warning, couldn't open module fbdev
[352688.108] (II) UnloadModule: "fbdev"
[352688.108] (II) Unloading fbdev
[352688.108] (EE) Failed to load module "fbdev" (module does not exist, 0)
[352688.108] (II) LoadModule: "vesa"
[352688.108] (WW) Warning, couldn't open module vesa
[352688.108] (II) UnloadModule: "vesa"
[352688.108] (II) Unloading vesa
[352688.108] (EE) Failed to load module "vesa" (module does not exist, 0)
[352688.108] (II) LoadModule: "mouse"
[352688.108] (WW) Warning, couldn't open module mouse
[352688.108] (II) UnloadModule: "mouse"
[352688.108] (II) Unloading mouse
[352688.108] (EE) Failed to load module "mouse" (module does not exist, 0)
[352688.108] (II) LoadModule: "kbd"
[352688.109] (WW) Warning, couldn't open module kbd
[352688.109] (II) UnloadModule: "kbd"
[352688.109] (II) Unloading kbd
[352688.109] (EE) Failed to load module "kbd" (module does not exist, 0)
[352688.109] (EE) No drivers available.
[352688.109] (EE) 
Fatal server error:
[352688.109] (EE) no screens found(EE) 
[352688.109] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[352688.109] (EE) Please also check the log file at "/Users/ayushkarnawat/Documents/dev/misc/configs/local/share/xorg/Xorg.0.log" for additional information.
[352688.109] (EE) 
[352688.109] (EE) Server terminated with error (1). Closing log file.

versus the disk installer:

# XQuartz.dmg installer
[3384743.538]
X.Org X Server 1.20.11
X Protocol Version 11, Revision 0
[3384743.538] Build Operating System: Darwin 20.5.0 arm64
[3384743.538] Current Operating System: Darwin mbp16.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64
[3384743.539] Build Date: 25 April 2021  03:31:46PM
[3384743.539]
[3384743.539] Current version of pixman: 0.40.0
[3384743.539]   Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[3384743.539] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[3384743.539] (==) Log file: "/Users/ayushkarnawat/Documents/dev/misc/configs/local/share/xorg/Xorg.0.log", Time: Fri Dec 17 13:54:43 2021
[3384743.539] (II) Loader magic: 0x109401110
[3384743.539] (II) Module ABI versions:
[3384743.539]   X.Org ANSI C Emulation: 0.4
[3384743.539]   X.Org Video Driver: 24.1
[3384743.539]   X.Org XInput driver : 24.1
[3384743.539]   X.Org Server Extension : 10.0
[3384743.539] (==) Using default built-in configuration (21 lines)
[3384743.539] (==) --- Start of built-in configuration ---
[3384743.539]   Section "Device"
[3384743.539]       Identifier  "Builtin Default fbdev Device 0"
[3384743.539]       Driver  "fbdev"
[3384743.539]   EndSection
[3384743.539]   Section "Screen"
[3384743.539]       Identifier  "Builtin Default fbdev Screen 0"
[3384743.540]       Device  "Builtin Default fbdev Device 0"
[3384743.540]   EndSection
[3384743.540]   Section "Device"
[3384743.540]       Identifier  "Builtin Default vesa Device 0"
[3384743.540]       Driver  "vesa"
[3384743.540]   EndSection
[3384743.540]   Section "Screen"
[3384743.540]       Identifier  "Builtin Default vesa Screen 0"
[3384743.540]       Device  "Builtin Default vesa Device 0"
[3384743.540]   EndSection
[3384743.540]   Section "ServerLayout"
[3384743.540]       Identifier  "Builtin Default Layout"
[3384743.540]       Screen  "Builtin Default fbdev Screen 0"
[3384743.540]       Screen  "Builtin Default vesa Screen 0"
[3384743.540]   EndSection
[3384743.540] (==) --- End of built-in configuration ---
[3384743.540] (==) ServerLayout "Builtin Default Layout"
[3384743.540] (**) |-->Screen "Builtin Default fbdev Screen 0" (0)
[3384743.540] (**) |   |-->Monitor "<default monitor>"
[3384743.540] (**) |   |-->Device "Builtin Default fbdev Device 0"
[3384743.540] (==) No monitor specified for screen "Builtin Default fbdev Screen 0".
    Using a default monitor configuration.
[3384743.540] (**) |-->Screen "Builtin Default vesa Screen 0" (1)
[3384743.540] (**) |   |-->Monitor "<default monitor>"
[3384743.540] (**) |   |-->Device "Builtin Default vesa Device 0"
[3384743.540] (==) No monitor specified for screen "Builtin Default vesa Screen 0".
    Using a default monitor configuration.
[3384743.540] (==) Not automatically adding devices
[3384743.540] (==) Not automatically enabling devices
[3384743.540] (==) Not automatically adding GPU devices
[3384743.540] (==) Max clients allowed: 256, resource mask: 0x1fffff
[3384743.540] (==) FontPath set to:
    /opt/X11/share/fonts/misc/,
    /opt/X11/share/fonts/TTF/,
    /opt/X11/share/fonts/OTF,
    /opt/X11/share/fonts/Type1/,
    /opt/X11/share/fonts/75dpi/:unscaled,
    /opt/X11/share/fonts/100dpi/:unscaled,
    /opt/X11/share/fonts/75dpi/,
    /opt/X11/share/fonts/100dpi/,
    /Library/Fonts,
    /opt/X11/share/system_fonts
[3384743.540] (==) ModulePath set to "/opt/X11/lib/xorg/modules"
[3384743.540] (==) |-->Input Device "<default pointer>"
[3384743.540] (==) |-->Input Device "<default keyboard>"
[3384743.540] (==) The core pointer device wasn't specified explicitly in the layout.
    Using the default mouse configuration.
[3384743.541] (==) The core keyboard device wasn't specified explicitly in the layout.
    Using the default keyboard configuration.
[3384743.541] (II) LoadModule: "fbdev"
[3384743.541] (WW) Warning, couldn't open module fbdev
[3384743.541] (EE) Failed to load module "fbdev" (module does not exist, 0)
[3384743.541] (II) LoadModule: "vesa"
[3384743.541] (WW) Warning, couldn't open module vesa
[3384743.541] (EE) Failed to load module "vesa" (module does not exist, 0)
[3384743.541] (II) LoadModule: "mouse"
[3384743.541] (WW) Warning, couldn't open module mouse
[3384743.541] (EE) Failed to load module "mouse" (module does not exist, 0)
[3384743.541] (II) LoadModule: "kbd"
[3384743.542] (WW) Warning, couldn't open module kbd
[3384743.542] (EE) Failed to load module "kbd" (module does not exist, 0)
[3384743.542] (EE) No drivers available.
[3384743.542] (EE)
Fatal server error:
[3384743.542] (EE) no screens found(EE)
[3384743.542] (EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
[3384743.542] (EE) Please also check the log file at "/Users/ayushkarnawat/Documents/dev/misc/configs/local/share/xorg/Xorg.0.log" for additional information.
[3384743.542] (EE)
[3384743.542] (EE) Server terminated with error (1). Closing log file.

notice the differences in (a) package versions (e.g. X Server, pixman), (b) libiglx not being loaded at all when using the dmg installer, and (c) the fonts being set properly when using the dmg version.

ayushkarnawat commented 2 years ago

@cstrahan Any pointers on what might be the issue here? The only thing I can think of is upgrading XQuartz to the latest version (2.8.1) with the following (new) compilation instructions.

Additionally, the current version of XQuartz as defined in nixpkgs is confusing. Rather than inherit the xorg-server version, we should use the official version provided by the authors.

ayushkarnawat commented 2 years ago

@cstrahan Bumping again; haven't had much time to look into the exact reason why this is occurring, but any pointers on what you suspect might be the issue is appreciated.