NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.45k stars 13.65k forks source link

locale not found at init #188998

Closed tfmoraes closed 2 years ago

tfmoraes commented 2 years ago

Describe the bug

I'm using nixos-unstable. This is my config https://github.com/tfmoraes/nixoscfg/. In the last two updates this error message is showing at init to me:

stage-1-init: [Tue Aug 30 17:36:22 UTC 2022] /init: line 267: locale: not found

But the system is running ok.

Steps To Reproduce

Steps to reproduce the behavior:

  1. I'm using this config https://github.com/tfmoraes/nixoscfg
  2. nixos-rebuild --flake '.#' --use-remote-sudo switch
  3. reboot

Expected behavior

Not show that message

Additional context

I'm using luks and btrfs.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.19.4, NixOS, 22.11 (Raccoon), 22.11.20220828.a63021a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.10.3`
 - nixpkgs: `/etc/nixpkgs`
mixedCase commented 2 years ago

Also reproduced here:

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.19.4, NixOS, 22.11 (Raccoon), 22.11.20220828.a63021a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.10.3`
 - channels(root): `"nixos"`
 - channels(mixedcase): `""`
 - nixpkgs: `/nix/store/5f83a60c6lcxfzdh7yg3ifmk150dkqb2-source`
samhh commented 2 years ago

I just noticed this for the first time today:

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.19.4, NixOS, 22.11 (Raccoon), 22.11.20220828.a63021a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.10.3`
 - channels(root): `"nixos"`
 - channels(sam): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I think it started when I updated inputs yesterday: https://github.com/samhh/dotfiles/commit/186180c96bd7d9c64b3da5d3105454702e13b9b1

das-g commented 2 years ago

I got this, too since yesterday or so. And ever since it occurred, unless I select an unaffected older generation in the boot manager, I cannot unlock the disk encryption. I suspect that problem is related, as I have a non-en-US keyboard layout and use some non-en-US characters in my disk encryption passphrase and as exactly those system generations that give the error message about locale not being found are affected.

photo of of screen output after several unsuccessful attempts of entering passphrase transcript:

[    0.124612] x86/cpu: SGX disabled by BIOS.

<<< NixOS Stage 1 >>>

loading module btrfs...
loading module dm_mod...
running udev...
Starting version 251.4
/init: line 267: locale: not found
Passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad:
Verifying passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad...No key available with this passphrase.
 - failrue
Passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad:
Verifying passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad...No key available with this passphrase.
 - failrue
Passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad:
Verifying passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad...No key available with this passphrase.
 - failrue
Passphrase for /dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad: _

nix-shell -p nix-info --run "nix-info -m" (on a generation where I can still unlock the disk encryption)

Potentially relevant sections of my /etc/nixos/configuration.nix:

{ config, lib, pkgs, ... }:

{
  # …

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

  # Disk encryption
  boot.initrd.luks.devices = {
    nixos-enc = {
      device = "/dev/disk/by-uuid/33d33ef7-7008-40d2-aa04-e3a1bcfcd7ad";
      preLVM = true;
    };
  };

  # …

  # Select internationalisation properties.
  console.keyMap = "de_CH-latin1";
  i18n = {
  #   consoleFont = "Lat2-Terminus16";
    defaultLocale = "de_CH.UTF-8";
  };

  # …

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.layout = "ch,de";
  services.xserver.xkbOptions = "eurosign:e";

  # …
}
das-g commented 2 years ago

I got this, too since yesterday or so. And ever since it occurred, unless I select an unaffected older generation in the boot manager, I cannot unlock the disk encryption. […]

189075 fixes this for me. (No message about locale not being found and I can unlock disk encryption and thus boot my system.) :tada:

ztmr commented 2 years ago

I had console.keyMap = us and i18n.defaultLocale = en_US.UTF-8, which is the same as defaults. Even removing this completely didn't help and I am still seeing this issue.

It also affects recovery from hibernation on one of my machines that does not support suspend. Grub asks for password, everything recovers, but when I get back to normal work, Xorg suddenly crashes and TTY starts showing nixos instead of the hostname and I am not able to login.

Next time I boot, I can see there is a new generation in Grub that I have not created! It looks like the system gets restored from suspend, and then realizes something is not quite right (broken init vs async systemd startup?) and then reverts to some bare-bone failsafe whatever.

No idea if this is related, but the only error I am seeing is this init/locale issue. Is anyone else having the same problem here?

My boot partition is encrypted using LUKS (hence booting with Grub and not systemd-boot) and all is ZFS.

Booting an older generation helps ofc.

yu-re-ka commented 2 years ago

Fixed by