Can not login as user with LightDM

Hello,

today I want to start my Laptop with NixOS 22.05 but I can’t login as user.

I am using Xmonad and LightDM as login prompt.
I can login via LightDM as root - no problems but when I want to login as user the screen turns black and jump back to the login screen.

Did anybody have the same problem or know how to solve it?

Thanks a lot

That sounds odd - might be something about your session being broken. Do you have a .xsession-errors file or something similar in your user’s home directory? Anything from journalctl -t xsession?

This is the output (sorry only got this bad Foto at the moment)

Something is very broken there! Looks like xmonad is being executed thinking you’re the root user, and trying to open its config from root’s home, which obviously won’t work for lack of permissions. You’re also missing a bunch of binaries that are probably available in your user profile.

Can you share your configuration? Do you use home manager?

Hi,
no I don’t use the home manager.

This is my configurations.nix

> # 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, ... }:
> 
> {
>   imports =
>     [ # Include the results of the hardware scan.
>       ./hardware-configuration.nix
>     ];
> 
>   # Use the systemd-boot EFI boot loader.
>   boot.loader.systemd-boot.enable = true;
>   boot.loader.efi.canTouchEfiVariables = true;
> 
>   # Set your time zone.
>   time.timeZone = "Europe/Berlin";
> 
>   # Automatic remove old unused packages
>   nix.gc = {
> 	automatic = true;
> 	dates = "daily";
> 	options = "--delete-older-than 30d";
>   }; 
> 
>   # Limit Bootoptions to 5
>   boot.loader.systemd-boot.configurationLimit = 5; 
> 
>   # Deduplicate nix-store filebase
>   nix.optimise.automatic = true;
> 
>   networking.useDHCP = false;
>   networking.interfaces.enp0s31f6.useDHCP = true;
>   networking.interfaces.wlp4s0.useDHCP = true;
>   networking.wireless.userControlled.enable = true;
>   # Configure keymap in X11
>   services.xserver.enable = true;
>   services.xserver.layout = "de";
>   services.xserver.xkbOptions = "eurosign:e";
>   services.xserver.windowManager.xmonad.enable = true;
>   services.xserver.windowManager.xmonad.enableContribAndExtras = true;
>   services.xserver.autorun = false;
>   
>   programs.zsh.enable = true;
>   # Enable sound.
>   # sound.enable = true;
>   # hardware.pulseaudio.enable = true;
> 
>   # Enable touchpad support (enabled default in most desktopManager).
>   services.xserver.libinput.enable = true;
>   
>   # Sound
>   services.jack = {
> 	jackd.enable = true;
> 	alsa.enable = false;
> 	loopback = {
> 		enable = true;
> 	};
>   };
> 
>   # Define a user account. Don't forget to set a password with ‘passwd’.
>   users.users.pho = {
>      isNormalUser = true;
>      extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
>      shell = pkgs.zsh;
>    };
> 
>   # FONTS
>   fonts.fonts = with pkgs; [
> 	ibm-plex
> 	google-fonts
> 	noto-fonts
>   ];
>   
>   # AUTOUPGRADE NIXOS
>   system.autoUpgrade.enable = false;
>   system.autoUpgrade.allowReboot = false;
> 
> 
>   # List packages installed in system profile. To search, run:
>   # $ nix search wget
>   # environment.systemPackages = with pkgs; [
>   #   wget vim
>   #   firefox
>   # ];
>   system.stateVersion = "20.09"; # Did you read the comment?
> 
> }

Thanks for your help :slight_smile:

Could you try sharing those logs with something like

journalctl --boot -t xsession | nix-shell -p pastebinit --run pastebinit

so we can see the full contents?

Also your xmonad config and ~/.xsession while we’re at it, since it’s not in your nixos config?

I’m unsure I’ll figure out what’s wrong, it seems like the xsession itself is invoked as root, which doesn’t happen with my xsession.

this command brings an error:
unrecognised flag '--run-pastebinit'

no I don’t have my xmonad config and xsession within my config

Look at the command again, it’s a space, not a dash :slight_smile:

First of all it might be helpful to enable gnome/kde/xfce in the configuration just to be able to log in and easily upload old logs (in my experience, this still works even if xmonad doesn’t). But be aware that enabling them will also enable service you might not want. These services will also run if xmonad is selected to log in.
My config currently looks like this:

  services.xserver = {
    enable = true;
    desktopManager = {
      # Fallback in case anything breaks
      xterm.enable = true;
      # It enables xfce notify daemon :(
      xfce.enable = false;
    };
    displayManager.lightdm.enable = true;
    windowManager.xmonad = {  
      enableContribAndExtras = true;
      enable = true;
    };
  };

I’m also interested in your .xsessionrc file and your .xinput, is xmonad started in one of these files? It might help to temporarily rename these files to see if something in there is breaking it.

ah - yes - I am an idiot :smiley:
here it is:

interesting. .xsessionrc and .xinput does not exist

Hm, where is compton started then? It looks a bit like you came from some kind of functioning system and just copied the $HOME/ folder over, given the various broken things in the logs (like broken xmobar, compont, the command nn missing…). Or did all of this happen after an upgrade to 22.05?

I would recommend you to try to “disable” all the startup configs and enable them one by one. E.g. start with an empty $HOME folder and configure the services one by one…

Once you’re able to get a plain xmonad (which you can get out of with ctrl+shift+q), then you can try with your xmonad config, etc.

1 Like

Ok I cleaned the whole system with a new configuration.nix and the default xmonad.hs and I can log in. I will now build new configs and hope everything works fine.
Thanks for that :+1:

I’d really recommend looking at home manager for the future. It gives you the reproducibility of NixOS, but for your user config as well. If you use a WM, you probably will like it :slight_smile:

1 Like

yes I read about the home-manager at the moment and want to learn more about it