Black screen when typing LUKS password

I use LUKS over LVM setup with root and home volumes on one encrypted partition and I have a problem with usability. After selecting a GRUB option the black screen appears and there is no info about what’s happening whatsoever. I can type the password and the disk is decrypted and I get the system running, but there’s no visual feedback. If I start typing too early it will not work, if I misstype the password it will also fail (and it seems like I can’t enter again?).

I don’t think that’s a NixOS issue as I remember my brother having a similar problem on Manjaro some time ago, but I couldn’t find any relevant info anywhere, so I thought NixOS forum will be still my best bet.

Here is my config:

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  boot.kernelParams = [
    # https://patchwork.kernel.org/patch/9285379/
    "button.lid_init_state=open"
  ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub = {
    enable = true;
    version = 2;
    device = "nodev";
    efiSupport = true;
    gfxmodeEfi = "text";
    gfxmodeBios = "text";
    gfxpayloadEfi = "1920x1080";
    gfxpayloadBios = "1920x1080";
  };
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  # Grub menu is painted really slowly on HiDPI, so we lower the
  # resolution. Unfortunately, scaling to 1280x720 (keeping aspect
  # ratio) doesn't seem to work, so we just pick another low one.
  #boot.loader.grub.gfxmodeEfi = "1920x1080";

  boot.initrd.luks.devices = [
    {
      name = "root";
      device = "/dev/disk/by-uuid/36f99f04-6525-49bf-b99f-49c62e59814d";
      preLVM = true;
      allowDiscards = true;
    }
  ];

I tried different gfx settings and it doesn’t really change anything (other than GRUB appearance).

Cannot offer any help but I have the same problem. I have a setup similar to what’s described here https://nixos.wiki/wiki/Full_Disk_Encryption under zimbatm’s recommendation.

Why do you even use “GRUB”? You do not need it if you use “Systemd”.

1 Like

Good question! I heard that I can use systemd, but honestly I wasn’t sure what’s the difference. Also, how do I uninstall GRUB? I tried just removing the entry, but it seems it didn’t remove GRUB. Is there any Nixos method or should I remove it like on other distros?

I know that I could just check it and use the live USB to fix it if it blows up, but I didn’t want to spend too much time on it as it’s not that pressing for me.

Ok, so I have some time to play with it and this is what I did:

  1. Remove the boot.loader.grub entry from the configuration.nix file
  2. Specify /boot/efi file system in the hardware-configuration.nix file (previously I didn’t have it properly configured). If you don’t know which is the EFI partition you can easily check with any partitioning tool (like fdisk)
  3. Run sudo nixos-rebuild --install-bootloader switch

It worked and now I can actually see the password prompt properly.

Thanks for help with this!

1 Like

Can you elaborate on what this means? I’m afraid I don’t understand enough about booting to follow. My current configuration.nix is as follows:

  boot.loader.systemd-boot.enable = true;
  boot.loader.grub.enable = true;
  boot.loader.grub.efiSupport = true;
  boot.loader.grub.efiInstallAsRemovable = true;
  boot.loader.grub.device = "nodev";

My hardware-configuration.nix has these:

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/69bd3955-03ff-423e-8b98-f584ef09c5d3";
      fsType = "ext4";
    };

  boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/b5c9ff15-6c5a-48c1-915b-b4f15888e359";

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/7274-2AA0";
      fsType = "vfat";
    };

And the output of sudo fdisk -l /dev/sda is

Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SAMSUNG MZNLN256
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D8C5C417-4591-417D-9096-297094CB1A3D

Device       Start       End   Sectors  Size Type
/dev/sda1  1048576 500117503 499068928  238G Linux filesystem
/dev/sda2     2048   1048575   1046528  511M EFI System

Partition table entries are not in disk order.

Sure. When you configure a boot loader you can either let it create an efi directory on the boot partition or specify an EFI partition. If you decide to do the latter you basically set the following line:

boot.loader.efi.efiSysMountPoint = "/boot/efi";

But then /boot/efi needs to be a separate mounted filesystem, so you need to have a separate entry in the hardware configuration, for example:

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/F87B-26AD";
      fsType = "vfat";
    };

In your case, as you have only one system and one boot partition, I think it’s fine to don’t set efiSysMountPoint at all.