Can't get xserver/GUI running on raspberry pi 4

Hey all,

I’m still new (from knowledge, not usage time) and tried to get NixOS up and running on Rasberry Pi for a long time. I’ve now bought a Pi 4 Model B as this seems to be the one covered with docs most of the time … I followed Installing NixOS on a Raspberry Pi — nix.dev documentation which worked fine.

My goal is to have an auto login that will start Kodi in the end. As I use the raspberry pi via HDMi and Kodi for my TV.

But I’m not able to get a GUI up and running. I’ve configured autologin and xserver and lxqt as I’ve done for my MacBook Air where it is working just fine.
Maybe it is related to something with Raspberry Pi, I don’t know. And I don’t know where to look. There are no issues. Instead, I’m greeted with tty1 and am asked to login.

You can find my configuration here: https://git.daniel-siepmann.de/danielsiepmann/nixpkgs/src/branch/hikari-pi/systems/hikari-pi/configuration.nix and I’m on nixos-unstable with channel, no flakes.
And the working one for my MacBook Air here: nixpkgs/systems/hikari/configuration.nix at main - danielsiepmann/nixpkgs - Forgejo of Daniel Siepmann

I would be happy if someone can tell me where I should have a look to find the issue or even an error message …

systemd tells me the display-manager (lightdm) is running.

Seems the same here… with my Pi 4 Model B 8GB. I followed Installing NixOS on a Raspberry Pi — nix.dev documentation which worked fine.

Boots ok to user pi console. I have tried out quite a lot now, but as i am new to Nix(Os) and also no Linux-Pro… i’am giving up for now :slightly_frowning_face:

Btw: In this situation on Raspbian I would use raspi-config or do a “sudo systemctl set-default graphical.target”

Here is my configuration.nix:

{ config, pkgs, lib, … }:

let
user = “pi”;
password = “???”;
SSID = “WLAN-???”;
SSIDpassword = “???”;
interface = “wlan0”;
hostname = “pi48GB”;
in {

boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
initrd.availableKernelModules = [ “xhci_pci” “usbhid” “usb_storage” ];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};

fileSystems = {
“/” = {
device = “/dev/disk/by-label/NIXOS_SD”;
fsType = “ext4”;
options = [ “noatime” ];
};
};

networking = {
hostName = hostname;
wireless = {
enable = true;
networks.“${SSID}”.psk = SSIDpassword;
interfaces = [ interface ];
};
};

services.xserver = {
enable = true;
displayManager.lightdm.enable = true;
displayManager.autoLogin.enable = true;
displayManager.autoLogin.user = “pi”;
desktopManager.xfce.enable = true;
#desktopManager.gnome.enable = true;
videoDrivers = [ “fbdev” ];
};

services.xserver.autorun = true;
services.xserver.displayManager.startx.enable = true;

users = {
mutableUsers = false;
users.“${user}” = {
isNormalUser = true;
password = password;
extraGroups = [ “wheel” ];
};
};

environment.systemPackages = with pkgs; [
vim
firefox
];

services.openssh.enable = true;

i18n.defaultLocale = “de_DE.UTF-8”;
console.keyMap = “de-latin1”;

hardware.enableRedistributableFirmware = true;
system.stateVersion = “23.11”;

}

From Bootlog:

Nov 09 12:58:18 pi48GB systemd[1]: Starting X11 Server…
Nov 09 12:58:18 pi48GB systemd[1]: Started Getty on tty1.
Nov 09 12:58:18 pi48GB systemd[1]: Reached target Login Prompts.
Nov 09 12:58:18 pi48GB systemd[1]: Started D-Bus System Message Bus.
Nov 09 12:58:18 pi48GB wpa_supplicant[752]: Successfully initialized wpa_supplicant
Nov 09 12:58:18 pi48GB dbus-daemon[720]: [system] Successfully activated service ‘org.freedesktop.systemd1’
Nov 09 12:58:18 pi48GB dbus-daemon[720]: [system] Activating via systemd: service name=‘org.freedesktop.PolicyKit1’ unit=‘polkit.service’ requested by ‘:1.3’ (uid=0 pid=774 comm=“/nix/store/hc9cnz45n7hb3w3hx7jqxwfs0qbiy7yq-accoun”)
Nov 09 12:58:18 pi48GB systemd[1]: Starting Authorization Manager…
Nov 09 12:58:18 pi48GB sshd[822]: Server listening on 0.0.0.0 port 22.
Nov 09 12:58:18 pi48GB sshd[822]: Server listening on :: port 22.
Nov 09 12:58:18 pi48GB kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
Nov 09 12:58:18 pi48GB polkitd[828]: Started polkitd version 122
Nov 09 12:58:18 pi48GB dbus-daemon[720]: [system] Activating via systemd: service name=‘org.freedesktop.Accounts’ unit=‘accounts-daemon.service’ requested by ‘:1.5’ (uid=0 pid=827 comm=“/nix/store/qk3nadfzi8197svf160v0n3cr12f7r5w-lightd”)
Nov 09 12:58:18 pi48GB systemd[1]: Started X11 Server.
.
.
.
Nov 09 12:58:33 pi48GB systemd[1]: Started Name Service Cache Daemon (nsncd).
Nov 09 12:58:33 pi48GB systemd[1]: Reached target Host and Network Name Lookups.
Nov 09 12:58:33 pi48GB systemd[1]: Reached target User and Group Name Lookups.
Nov 09 12:58:33 pi48GB systemd[1]: Started DHCP Client.
Nov 09 12:58:33 pi48GB systemd[1]: Reached target Network is Online.
Nov 09 12:58:34 pi48GB systemd[1]: Reached target Multi-User System.
Nov 09 12:58:34 pi48GB systemd[1]: Reached target Graphical Interface.
Nov 09 12:58:34 pi48GB systemd[1]: Startup finished in 5.702s (kernel) + 18.454s (userspace) = 24.156s.

I’m also experiencing this. Xorg won’t start. Did you figure something out here?

I’ve had some success with this config for my Pi3B+ and Pi4B:

  services.xserver = {
    enable = true;
    layout = "us";
    autorun = true;
    exportConfiguration = true;
    displayManager.startx.enable = false;
    displayManager.autoLogin.enable = true;
    displayManager.autoLogin.user = "rjpc";
    displayManager.lightdm = {
      enable = true;
      background = pkgs.nixos-artwork.wallpapers.nineish-dark-gray.gnomeFilePath;
      greeters.gtk.indicators = [
        "~host"
        "~spacer"
        "~clock"
        "~spacer"
        "~session"
        "~power"
      ];
      greeters.gtk.clock-format = "%A %F %I:%M %p";
    };
    windowManager.cwm.enable = true;
  };

I’m using the latest kernel, I think…or whatever the default is.
I will try with a full fledged DE and report back.

yes, runs fine on Pi3B+ (not much memory left); I can check my Pi4B soon.

I’ve just disabled cwm and used desktopManager.xfce.enable = true;

ok, it seems this wass mising

  hardware.raspberry-pi."4".fkms-3d.enable = true;
1 Like

Glad to hear it. I hadn’t tried my 4 yet so it probably would not have worked. Where is the option defined? :thinking:

https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi

Looks like it is in NixOS/nixos-hardware

Yes, I found that too and wanted to get a sanity check. Thanks @bowmanjd

1 Like