Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl: warning: Setting locale failed after migration to nixos-22.11 channel #208080

Closed
datafoo opened this issue Dec 28, 2022 · 5 comments
Closed
Labels
0.kind: bug Something is broken

Comments

@datafoo
Copy link
Contributor

datafoo commented Dec 28, 2022

Describe the bug

When and after migrating to nixos-22.11 channel, I noticed a warning :

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LC_TIME = "nb_NO.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

Steps To Reproduce

Steps to reproduce the behavior:

  1. Put the following in your configuration.nix:
    i18n.defaultLocale = "en_US.UTF-8";
    console = {
      font = "Lat2-Terminus16";
      keyMap = "no";
    };
    services.xserver.layout = "no";
  2. Rebuild your system
  3. Type the Norwegian character ø in a terminal, as root user
  4. Notice the perl warning before ø: command not found
    # ø
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LANGUAGE = "",
            LC_ALL = (unset),
            LC_TIME = "nb_NO.UTF-8",
            LANG = "en_US.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
    ø: command not found

Expected behavior

No warning should appear.

Notify maintainers

@SuperSandro2000 (related to #177318)

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.81, NixOS, 22.11 (Raccoon), 22.11.656.52e3e80afff`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(me): `"home-manager-22.11.tar.gz"`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@datafoo datafoo added the 0.kind: bug Something is broken label Dec 28, 2022
@datafoo
Copy link
Contributor Author

datafoo commented Dec 28, 2022

I am not sure LC_TIME = "nb_NO.UTF-8" is because of console.keyMap or services.xserver.layout.

@datafoo datafoo closed this as completed Dec 28, 2022
@scvalex
Copy link
Contributor

scvalex commented Jan 4, 2023

FWIW I just ran into this with en_GB.UTF-8.

Empirically, it affected the machines where I had set time.timeZone = "Europe/London";. The fix was to set i18n.defaultLocale = "en_GB.UTF-8"; which causes the default value of i18n.supportedLocales to include it, which then presumably causes the locale to be built.

@datafoo
Copy link
Contributor Author

datafoo commented Jan 5, 2023

LC_TIME = "nb_NO.UTF-8" was because I set Norwegian in the regional settings of my non-root user (which modifies ~/.config/plasma-localerc ).

Now I have the following more advanced settings which were also set with plasma UI (not declaratively).

$ cat ~/.config/plasma-localerc 
[Formats]
LANG=en_US.UTF-8
LC_ADDRESS=nb_NO.UTF-8
LC_MEASUREMENT=nb_NO.UTF-8
LC_MONETARY=nb_NO.UTF-8
LC_NAME=nb_NO.UTF-8
LC_NUMERIC=nb_NO.UTF-8
LC_PAGE=nb_NO.UTF-8
LC_TELEPHONE=nb_NO.UTF-8
LC_TIME=en_GB.UTF-8
useDetailed=true

And I made the problem disappear by adding this in /etc/nixos/configuration.nix:

i18n = {
  defaultLocale = "en_US.UTF-8";
  supportedLocales = [
    "C.UTF-8/UTF-8"
    "en_US.UTF-8/UTF-8"
    "en_GB.UTF-8/UTF-8"
    "nb_NO.UTF-8/UTF-8"
  ];
};

Perhaps there is a way to configure my user regional settings in a declarative way that would be taken into account so that I do not have to explicitly specify i18n.supportedLocales.

@joepie91
Copy link
Contributor

joepie91 commented Jan 7, 2023

Could you reopen this? This is IMO a breaking bug in the 22.11 release, and the entry in the release notes really isn't anywhere near clear enough about the potential for breakage.

Edit: In my case, manually adding the relevant locales to supportedLocales did not fix it. I had to add the "all" entry instead.

@yapvoonyee
Copy link

Thanks this works. But I wonder if my computer is now stuck in the USA and not Australia?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

4 participants