Cannot start desktop after installation

Hi! I tried nixos in a virtualbox machine, installed and it works.

Now i launched it from usb, everything is ok. Installed with plasma desktop, rebooted and now the desktop doesn’t start, i only see the shell.

I have a santech c88 with nvidia 3060 .

Thanks

Did you configure a desktop? Any errors in journalctl --boot -e? I think the last 20 people with iGPU+Nvidia with similar issues just had to configure this: Nvidia - NixOS Wiki

Edit: I can’t read

Hi! Thanks for your response. I checked the journalctl and there were several errors from nouveau drivers.

I I followed the guide, I no longer see nouveau’s errors but it still doesn’t start.

Nix Configuration

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

let 
  nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
    export __NV_PRIME_RENDER_OFFLOAD=1
    export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-GO
    export __GLX_VENDOR_LIBRARY_NAME=nvidia
    export __VK_LAYER_NV_optimus=NVIDIA_only
    exec "$@"
  '';
in
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/Rome";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.utf8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "it_IT.utf8";
    LC_IDENTIFICATION = "it_IT.utf8";
    LC_MEASUREMENT = "it_IT.utf8";
    LC_MONETARY = "it_IT.utf8";
    LC_NAME = "it_IT.utf8";
    LC_NUMERIC = "it_IT.utf8";
    LC_PAPER = "it_IT.utf8";
    LC_TELEPHONE = "it_IT.utf8";
    LC_TIME = "it_IT.utf8";
  };


  # Enable the X11 windowing system.
  services.xserver.enable = true;

  hardware.nvidia.modesetting.enable = true;
  services.xserver.videoDrivers = ["nvidia"];
  hardware.nvidia.prime = {
    offload.enable = true;

    # Bus ID of Intel GPU
    intelBusId = "PCI:0:2:0";

    # Bus ID of NVIDIA GPU
    nvidiaBusId = "PCI:1:0:0";
  };

  # Enable the KDE Plasma Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.lg = {
    isNormalUser = true;
    description = "Luca Guglielmi";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      firefox
      kate
    #  thunderbird
    ];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    nvidia-offload
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "22.05"; # Did you read the comment?

}

journalctl

nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) LoadModule: "nvidia"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading /nix/store/az9h44if54llf4grhlhhspz9hv5wx84z-nvidia-x11-515.48.07-5.15.76-bin/lib/xorg/modules/drivers/nvidia_drv.so
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Module nvidia: vendor="NVIDIA Corporation"
nov 13 14:36:42 nixos xserver-wrapper[1129]:         compiled for 1.6.99.901, module version = 1.0.0
nov 13 14:36:42 nixos xserver-wrapper[1129]:         Module class: X.Org Video Driver
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) modesetting: Driver for Modesetting Kernel Drivers: kms
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) NVIDIA dlloader X Driver  515.48.07  Fri May 27 03:23:48 UTC 2022
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
nov 13 14:36:42 nixos xserver-wrapper[1129]: (WW) Falling back to old probe method for modesetting
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) modeset(1): using default device
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading sub module "fb"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) LoadModule: "fb"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading /nix/store/aa2wbxc6wlc0mcy1i1548la858rvn3wa-xorg-server-1.20.14/lib/xorg/modules/libfb.so
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Module fb: vendor="X.Org Foundation"
nov 13 14:36:42 nixos xserver-wrapper[1129]:         compiled for 1.20.14, module version = 1.0.0
nov 13 14:36:42 nixos xserver-wrapper[1129]:         ABI class: X.Org ANSI C Emulation, version 0.4
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading sub module "wfb"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) LoadModule: "wfb"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading /nix/store/aa2wbxc6wlc0mcy1i1548la858rvn3wa-xorg-server-1.20.14/lib/xorg/modules/libwfb.so
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Module wfb: vendor="X.Org Foundation"
nov 13 14:36:42 nixos xserver-wrapper[1129]:         compiled for 1.20.14, module version = 1.0.0
nov 13 14:36:42 nixos xserver-wrapper[1129]:         ABI class: X.Org ANSI C Emulation, version 0.4
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Loading sub module "ramdac"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) LoadModule: "ramdac"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) Module "ramdac" already built-in
nov 13 14:36:42 nixos xserver-wrapper[1129]: (EE) Screen 0 deleted because of no matching config section.
nov 13 14:36:42 nixos xserver-wrapper[1129]: (II) UnloadModule: "modesetting"
nov 13 14:36:42 nixos xserver-wrapper[1129]: (EE)
nov 13 14:36:42 nixos xserver-wrapper[1129]: Fatal server error:
nov 13 14:36:42 nixos xserver-wrapper[1129]: (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices

There is a Fatal error at line 824 but i don’t understand why

Hrm, just to double check, these are actually the ones from your device, right? They just happen to be the same as the ones in the wiki entry?

If so, perhaps remove the offload settings for now, and try setting these options: common/gpu/nvidia*: Migrate to common/gpu/nvidia/* and add non-prime by TLATER · Pull Request #502 · NixOS/nixos-hardware · GitHub

Just to confirm your system can actually boot.

The error says that xserver couldn’t find the bus ids for the GPUs.

You can try the lspci command to get the bus id(s). If you don’t have the lspci command, you can add pciutils to environment.systemPackages in your configuration.nix or use nix-shell to use it temporarily.

The command below will filter out PCI devices to ones with VGA or 3D or NVIDIA in their name and should show both an Intel integrated GPU and your NVIDIA RTX 3060 dedicated GPU:

lspci | grep -E "VGA|3D|NVIDIA"

The first block of text in each returned line will be the PCI bus id. You’ll need to make sure that these match your actual hardware in your configuration.nix by prepending “PCI:”, replacing any “.” characters with “:”, and removing leading zeroes (so “00:02.0” is listed in configuration.nix as “PCI:0:2:0”).

$ lspci | grep -i -E "VGA|3D|NVIDIA"
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P Integrated Graphics Controller (rev 0c)
01:00.0 3D controller: NVIDIA Corporation TU117GLM [T600 Laptop GPU] (rev a1)

If that doesn’t fix your issue, then I’d recommend trying to get it to just boot to a desktop environment first, and then worry about Prime offloading or whatever after. Once of the nice things about Nix is the ability to experiment and then roll back if needed.

Below are some things you could try in configuration.nix. I’d try one change at a time, do nixos-rebuild boot or nixos-rebuild switch, and then reboot, painful as that may be. Maybe revert to a “default” config and then try the items below starting from there.

  1. Comment out the line: services.xserver.displayManager.sddm.enable = true;. If I recall I had issues with sddm with nvidia, but the default lightdm worked fine.

  2. Change the xserver driver from “nvidia” to “modesetting” services.xserver.videoDrivers = [ "modesetting" ];. This will use the nouveau driver instead of the proprietary nvidia driver. It should work fine, at least just to get the system to boot to a desktop environment.

This doesn’t work when two GPUs are fighting, which is where the thread started. You’ll want to disable the nvidia gpu entirely as here if you want to test if anything works.

Normally the nvidia GPU isn’t connected to the output directly, but the iGPU (in this case an intel one) is, which is why you need offloading.

Thank you both. I had to install another distro because I started work yesterday. I will try to install nixos side by side over the weekend and follow your advice.

Thanks again