NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.54k forks source link

display-manager.service fails to start #2 #74736

Open mzabani opened 4 years ago

mzabani commented 4 years ago

Describe the bug After booting, the display manager doesn't come up with NixOS 19.09. There's another posted issue with the same symptom but which seems to be a different problem: https://github.com/NixOS/nixpkgs/issues/62383

To Reproduce

  1. Use the following configuration.nix: https://gist.github.com/mzabani/ce02eda44f1812097975c2af4384c8f0
  2. Use the following nix channel and run nixos-rebuild switch --upgrade from a 18.09 NixOS system.
    # nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
    "19.09.1320.4ad6f1404a8"
  3. Boot into the new system, run systemctl status display-manager.service:
    
    ● display-manager.service - X11 Server
    Loaded: loaded (/nix/store/sw9hdni0zvasc49hin91g91araydmc7p-unit-display-manager.service/display-manager.service; linked; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sat 2019-11-30 10:44:50 -03; 49s ago
    Process: 904 ExecStartPre=/nix/store/whfc2qz651zbvzdph51qjqajkncqg471-unit-script-display-manager-pre-start (code=exited, status=0/SUCCESS)
    Process: 906 ExecStart=/nix/store/qj14p4v0xi21zlsbcndxpp64dwyjddp0-unit-script-display-manager-start (code=exited, status=1/FAILURE)
    Main PID: 906 (code=exited, status=1/FAILURE)
       IP: 0B in, 0B out
      CPU: 56ms

Nov 30 10:44:50 nixos systemd[1]: display-manager.service: Service RestartSec=200ms expired, scheduling restart. Nov 30 10:44:50 nixos systemd[1]: display-manager.service: Scheduled restart job, restart counter is at 3. Nov 30 10:44:50 nixos systemd[1]: Stopped X11 Server. Nov 30 10:44:50 nixos systemd[1]: display-manager.service: Start request repeated too quickly. Nov 30 10:44:50 nixos systemd[1]: display-manager.service: Failed with result 'exit-code'. Nov 30 10:44:50 nixos systemd[1]: Failed to start X11 Server.


**Expected behavior**
The display manager should start after booting without issues.

**Metadata**

nix run nixpkgs.nix-info -c nix-info -m

matthewbauer commented 4 years ago

You can get better logs with journalctl -b -u display-manager. But it looks like you may not have a displayManager enabled? Usually you would use gdm with gnome.

mzabani commented 4 years ago

Sorry for taking so long, and thanks for the tips. This is the output of journalctl -b -u display-manager:

-- Logs begin at Mon 2017-10-23 19:08:02 -02, end at Wed 2019-12-11 17:25:10 -03. --
Dec 11 17:24:40 nixos systemd[1]: Starting X11 Server...
Dec 11 17:24:40 nixos systemd[1]: Started X11 Server.
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Main process exited, code=exited, status=1/FAILURE
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Failed with result 'exit-code'.
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Service RestartSec=200ms expired, scheduling restart.
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Scheduled restart job, restart counter is at 1.
Dec 11 17:24:40 nixos systemd[1]: Stopped X11 Server.
Dec 11 17:24:40 nixos systemd[1]: Starting X11 Server...
Dec 11 17:24:40 nixos systemd[1]: Started X11 Server.
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Main process exited, code=exited, status=1/FAILURE
Dec 11 17:24:40 nixos systemd[1]: display-manager.service: Failed with result 'exit-code'.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Service RestartSec=200ms expired, scheduling restart.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Scheduled restart job, restart counter is at 2.
Dec 11 17:24:41 nixos systemd[1]: Stopped X11 Server.
Dec 11 17:24:41 nixos systemd[1]: Starting X11 Server...
Dec 11 17:24:41 nixos systemd[1]: Started X11 Server.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Main process exited, code=exited, status=1/FAILURE
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Failed with result 'exit-code'.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Service RestartSec=200ms expired, scheduling restart.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Scheduled restart job, restart counter is at 3.
Dec 11 17:24:41 nixos systemd[1]: Stopped X11 Server.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Start request repeated too quickly.
Dec 11 17:24:41 nixos systemd[1]: display-manager.service: Failed with result 'exit-code'.
Dec 11 17:24:41 nixos systemd[1]: Failed to start X11 Server.

I tried enabling gdm too, but it also failed, although in a different way: journalctl -b -u display-manager

-- Logs begin at Mon 2017-10-23 19:08:02 -02, end at Wed 2019-12-11 17:31:31 -03. --
Dec 11 17:30:46 nixos systemd[1]: Starting X11 Server...
Dec 11 17:30:46 nixos systemd[1]: Started X11 Server.
Dec 11 17:30:46 nixos gdm[856]: Child process -872 was already dead.
Dec 11 17:31:17 nixos gdm[856]: Child process -1215 was already dead.
Dec 11 17:31:21 nixos gdm[856]: Child process -1223 was already dead.
aniketd commented 4 years ago

I'm having exactly the same issue on a new machine (no upgrade involved).

On Crtl-Alt-F7 i see a cursor blinking continuously (this is as soon as I tried to systemctl start display-manager.server), while on Ctrl-Alt-F1 I am able to see these logs:

Starting X11 Server...
Started X11 Server
display-manager.service: Main process exited, code=exited, status=1/FAILURE
display-manager.service: Failed with result 'exit-code'.
display-manager.service: Scheduled restart job, restart counter is at 1.
Stopped X11 Server
Starting X11 Server...
...
matthewbauer commented 4 years ago

If you don't have a display manager - I think that setting services.xserver.desktopManager.xterm.enable = true may fix this.

aniketd commented 4 years ago

Thanks @matthewbauer. I tried it with combinations of enabled/disabled desktopManager.xterm and enabled/disabled displayManager.service, with running nix-channel --update before nixos-install, but the result is still the same, unfortunately.

aniketd commented 4 years ago

Sharing some information I learned while trying to get my setup working, here. I don’t have a working system yet, I’m still trying to get it to work.

    1. On version 19.09, amdgpu-pro errors out with abiCompat, specifically that it is compatible with xserver 1.19 and not 1.20. (1.20 is the default on 19.09 at the moment)
  1. Using amdgpu, the OS gets installed alright, but X11 server exits with an error upon trying to startx. Logs below (~/.xorg.log):

    [...]
    [   856.488] (==) Using config file: "/etc/X11/xorg.conf"
    [   856.489] (==) Using config directory: "/etc/X11/xorg.conf.d"
    [   856.489] (==) Using system config directory "/nix/store/z927pbwkkwagg0lx4imiyfip1jkxpy5j-xorg-server-1.20.5/share/X11/xorg.conf.d"
    [   856.489] (==) ServerLayout "Layout[all]"
    [   856.489] (**) |-->Screen "Screen-amdgpu[0]" (0)
    [   856.489] (**) |   |-->Monitor "<default monitor>"
    [   856.489] (**) |   |-->Device "Device-amdgpu[0]"
    [   856.489] (==) No monitor specified for screen "Screen-amdgpu[0]".
        Using a default monitor configuration.
    [   856.489] (**) |-->Screen "Screen-radeon[0]" (1)
    [   856.489] (**) |   |-->Monitor "<default monitor>"
    [   856.489] (**) |   |-->Device "Device-radeon[0]"
    [   856.489] (==) No monitor specified for screen "Screen-radeon[0]".
        Using a default monitor configuration.
    [   856.489] (**) Option "DontZap" "on"
    [   856.489] (**) Option "AllowMouseOpenFail" "on"
    [   856.489] (==) Automatically adding devices
    [   856.489] (==) Automatically enabling devices
    [   856.489] (==) Automatically adding GPU devices
    [   856.489] (==) Max clients allowed: 256, resource mask: 0x1fffff
    [   856.489] (**) FontPath set to:
    [...]
    [   856.494] (II) AMDGPU(0): [KMS] drm report modesetting isn't supported.
    [   856.494] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
    [   856.494] (EE) Screen 0 deleted because of no matching config section.
    [   856.494] (II) UnloadModule: "amdgpu"
    [   856.494] (EE) Device(s) detected, but none match those in the config file.
    [   856.494] (EE)
    Fatal server error:
    [   856.494] (EE) no screens found(EE)
    [   856.494] (EE)
    Please consult the The X.Org Foundation support
         at http://wiki.x.org
    for help.
    [   856.494] (EE) Please also check the log file at "/home/aniketd/.xorg.log" for additional information.
    [   856.494] (EE)
    [   856.495] (EE) Server terminated with error (1). Closing log file.
  2. I tried to be smart with a /etc/X11/xorg.conf.d/20-radeon.conf, with the following contents:

    
    Section "Device"
        Identifier "RADEON HDMI"
        Driver "amdgpu"
        Screen 0
    EndSection

Section "Screen" Identifier "Screen 0" Device "RADEON HDMI" EndSection


But my hunch is that this didn’t get picked up, because it led to no difference in the `.xorg.log` output.

**note**: You see “amdgpu” and “radeon” both in the generation of the xorg configuration most likely because I used videoDrivers = [ "amdgpu" "radeon" ]; (although I’m not super sure about this)

I don’t know what I should do next.

[ the same posted [on discourse](https://discourse.nixos.org/t/working-amdgpu-configurations/2305/11?u=aniketd) ]
aniketd commented 4 years ago

I found a solution that works - using boot.kernelPackages = pkgs.linuxPackages_5_4; (for now), but using the unstable channel. This unfortunately does not work on the 19.09 channel. Corresponding discussion on discourse

mzabani commented 4 years ago

My case was simple. I own a Legacy NVIDIA card, and at some point, I suppose the default NVIDIA driver is no longer compatible with it. I'm not sure why the error doesn't appear in journalctl when using -u display-manager, but looking at all of journalctl showed me the driver was incompatible. The solution for me was to add this to configuration.nix:

  boot.kernelPackages = pkgs.linuxPackages.extend (self: super: {
    nvidia_x11 = super.nvidia_x11_legacy390;
  });

I'll keep this issue open because it seems @aniketd 's error is different from mine, and could be a bug in nixpkgs.

stale[bot] commented 3 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

lapp0 commented 3 years ago

I upgraded from linuxPackages_5_4 (20.09's linuxPackages_latest) to linuxPackages_5_11 (unstable'slinuxPackages_latest`) and also got this error. There may be some issue with X11 on some hardward and/or configurations resulting in X11 having issues with some non-5.4 kernels?

aniketd commented 3 years ago

I'm currently on 20.09 with linuxPackages_5_10 with no issues, as a data-point, if it helps @lapp0

lapp0 commented 3 years ago

EDIT (Aug 2021): linuxPackages_5_13 and linuxPackages_5_12 gave me this same error, still on linuxPackages_5_10

Thanks, can confirm linuxPackages_5_10 works. linuxPackages_5_4 has an unrelated bug with my configuration under 21.05 so I'm glad there's a working kernel for me!

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

aniketd commented 1 year ago

@matthewbauer @NixOSInfra Just bringing to your notice that may be this issue can be closed.

nixos-discourse commented 6 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/fresh-system-after-graphical-install-hangs-on-started-display-manager/40970/6