X attempts to start before graphics are detected?

Once every 3 or 4 boot, X starts to fail. This is on a brand new Dell Inspiron 14 Plus, NixOS (22.05) was setup about a week ago. It has Intel Graphics + NVIDIA RTX 3050. I haven’t tried to configure the NVIDIA GPU so far (I mostly want to use it on the Windows dual boot). When X fails to start on boot, a nixos-rebuild switch properly restarts X. My guess is that the Intel graphics are not always detected before the attempt to start X? Maybe there is a way to delay starting X a bit?

Highlights

configuration.nix for X

  services.xserver = {
    enable = true;
    videoDrivers = [ "modesetting" ];

    synaptics = {
      enable = true;
      additionalOptions = ''
        Option "CircularScrolling" "on"
        Option "CircScrollTrigger" "1"
      '';
    };

    displayManager.lightdm.enable = true;
    displayManager.autoLogin = {
        enable = false;
    };

X.0.log

Healthy

$ cat /var/log/X.0.log | grep "/dev/dri"
[    26.449] (II) xfree86: Adding drm device (/dev/dri/card0)
[    27.189] (II) xfree86: Adding drm device (/dev/dri/card1)
[    27.226] (II) modeset(0): using drv /dev/dri/card1
[    27.227] (II) modeset(G0): using drv /dev/dri/card0

Faulty

$ cat /var/log/X.0.log.old | grep "/dev/dri"
[     4.075] (II) xfree86: Adding drm device (/dev/dri/card0)
[     4.077] (II) modeset(G0): using drv /dev/dri/card0

Full X.0.log

Faulty

[     4.830] 
X.Org X Server 1.20.14
X Protocol Version 11, Revision 0
[     4.830] Build Operating System: Nix 
[     4.830] Current Operating System: Linux nixos 5.15.53 #1-NixOS SMP Thu Jul 7 15:53:35 UTC 2022 x86_64
[     4.830] Kernel command line: initrd=\efi\nixos\j28xzy45fbyqw34gbbv8f00mg4nr89rh-initrd-linux-5.15.53-initrd.efi init=/nix/store/xnw3f61jk1q4s93mvgmf7ggfa3y98d3n-nixos-system-nixos-22.05.1627.4aceab3cadf/init i915.force_probe=46a6 loglevel=4
[     4.830] Build Date: 15 December 2021  07:01:53PM
[     4.830]  
[     4.830] Current version of pixman: 0.38.4
[     4.830] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[     4.830] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[     4.830] (++) Log file: "/var/log/X.0.log", Time: Tue Jul 19 11:49:50 2022
[     4.830] (++) Using config file: "/nix/store/p29sg7lqpy98a4pvlq95rzkjyqdq8991-xserver.conf"
[     4.830] (==) Using config directory: "/etc/X11/xorg.conf.d"
[     4.830] (==) Using system config directory "/nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/share/X11/xorg.conf.d"
[     4.830] (==) ServerLayout "Layout[all]"
[     4.830] (**) |-->Screen "Screen-modesetting[0]" (0)
[     4.830] (**) |   |-->Monitor "<default monitor>"
[     4.830] (**) |   |-->Device "Device-modesetting[0]"
[     4.830] (==) No monitor specified for screen "Screen-modesetting[0]".
	Using a default monitor configuration.
[     4.830] (**) Option "DontZap" "on"
[     4.830] (**) Option "AllowMouseOpenFail" "on"
[     4.830] (==) Automatically adding devices
[     4.830] (==) Automatically enabling devices
[     4.830] (==) Automatically adding GPU devices
[     4.830] (==) Max clients allowed: 256, resource mask: 0x1fffff
[     4.830] (**) FontPath set to:
	/nix/store/xbfkph5ah43famhz4pf4gzbw9vgw9g4j-dina-font-2.92/share/fonts/misc,
	/nix/store/zl5ajmy46ki77bz9y44zv9630iywj9pn-proggyfonts-0.1/share/fonts/misc,
	/nix/store/2pzl4xm9rwp4nvbk01pwicpdhmd3hpa9-siji-2016-05-13/share/fonts/misc,
	/nix/store/pklnlgj7x9ysmri8slhcd91dbp5y2xsg-unifont-14.0.03/share/fonts,
	/nix/store/3vwk6ij4hf9vrxl581l7djfdjykm9yqb-font-cursor-misc-1.0.3/lib/X11/fonts/misc,
	/nix/store/3qvdinmzcy52rc8n6c8nwnksmqcv3xzm-font-misc-misc-1.1.2/lib/X11/fonts/misc,
	/nix/store/1di5jvsr8pbr1f5812aw6gcb5737wzpg-font-adobe-100dpi-1.0.3/lib/X11/fonts/100dpi,
	/nix/store/4sajnx0v8b7c8wsd3w4n7inq25cvkxik-font-adobe-75dpi-1.0.3/lib/X11/fonts/75dpi
[     4.830] (**) ModulePath set to "/nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/lib/xorg/modules,/nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/lib/xorg/modules/drivers,/nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/lib/xorg/modules/extensions,/nix/store/hcdql9wargk63bi1bmwxj0b768wqwyhc-xf86-input-evdev-2.10.6/lib/xorg/modules/input,/nix/store/v32y99crf00vz199lmj9c40kscbgfszl-xf86-input-synaptics-1.9.1/lib/xorg/modules/input"
[     4.830] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[     4.830] (II) Loader magic: 0x62cd40
[     4.830] (II) Module ABI versions:
[     4.830] 	X.Org ANSI C Emulation: 0.4
[     4.830] 	X.Org Video Driver: 24.1
[     4.830] 	X.Org XInput driver : 24.1
[     4.830] 	X.Org Server Extension : 10.0
[     4.830] (++) using VT number 7

[     4.830] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[     4.831] (II) xfree86: Adding drm device (/dev/dri/card0)
[     4.832] (--) PCI:*(0@0:2:0) 8086:46a6:1028:0b4a rev 12, Mem @ 0x6134000000/16777216, 0x4000000000/268435456, I/O @ 0x00004000/64, BIOS @ 0x????????/131072
[     4.832] (--) PCI: (1@0:0:0) 10de:25a2:1028:0b4a rev 161, Mem @ 0x8e000000/16777216, 0x6000000000/4294967296, 0x6100000000/33554432, I/O @ 0x00003000/128
[     4.832] (II) Open ACPI successful (/var/run/acpid.socket)
[     4.832] (II) "glx" will be loaded by default.
[     4.832] (II) LoadModule: "glx"
[     4.832] (II) Loading /nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/lib/xorg/modules/extensions/libglx.so
[     4.832] (II) Module glx: vendor="X.Org Foundation"
[     4.832] 	compiled for 1.20.14, module version = 1.0.0
[     4.832] 	ABI class: X.Org Server Extension, version 10.0
[     4.832] (II) LoadModule: "modesetting"
[     4.832] (II) Loading /nix/store/v9wzqiripzwih0dxgyf992rm6xvn7xri-xorg-server-1.20.14/lib/xorg/modules/drivers/modesetting_drv.so
[     4.832] (II) Module modesetting: vendor="X.Org Foundation"
[     4.832] 	compiled for 1.20.14, module version = 1.20.14
[     4.832] 	Module class: X.Org Video Driver
[     4.832] 	ABI class: X.Org Video Driver, version 24.1
[     4.832] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[     4.832] (WW) Falling back to old probe method for modesetting
[     4.832] (II) modeset(1): using default device
[     4.832] (II) modeset(G0): using drv /dev/dri/card0
[     4.832] (EE) Screen 0 deleted because of no matching config section.
[     4.832] (II) UnloadModule: "modesetting"
[     4.832] (EE) 
Fatal server error:
[     4.832] (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices
[     4.832] (EE) 
[     4.832] (EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
[     4.832] (EE) Please also check the log file at "/var/log/X.0.log" for additional information.
[     4.832] (EE) 
[     4.832] (EE) Server terminated with error (1). Closing log file

Healthy

https://pastebin.com/0yUcNXyr (char limit in the post)

It might be trying to use the wrong GPU, depending on what loads more quickly or something. Have you seen the Optimus section on the NixOS wiki?

1 Like

Though I wish I had been able to understand how to fix it on its own, a week after configuring the NVIDIA GPU I haven’t had any more trouble.

1 Like

I had this problem as well on an Intel i7-11370H with its integrated graphics. Note that I’m using LightDM, which is the default display manger in NixOS (at least, as of nixpkgs commit 9ecc270f02b). According to this Reddit post, the problem of LightDM starting before display drivers are initialized can be solved by adding logind-check-graphical=true to /etc/lightdm/lightdm.conf. In NixOS, this can be accomplished with the following in configuration.nix:

services.xserver.displayManager.lightdm.extraConfig = "logind-check-graphical=true";
1 Like

Sounds like that should be added upstream?