0

I am running Arch Linux. My locale appears to be incorrectly set, but I don't know how to fix it. When I run locale, my system outputs the following:

locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en-US.UTF-8
LC_CTYPE="en-US.UTF-8"
LC_NUMERIC="en-US.UTF-8"
LC_TIME="en-US.UTF-8"
LC_COLLATE="en-US.UTF-8"
LC_MONETARY="en-US.UTF-8"
LC_MESSAGES="en-US.UTF-8"
LC_PAPER="en-US.UTF-8"
LC_NAME="en-US.UTF-8"
LC_ADDRESS="en-US.UTF-8"
LC_TELEPHONE="en-US.UTF-8"
LC_MEASUREMENT="en-US.UTF-8"
LC_IDENTIFICATION="en-US.UTF-8"
LC_ALL=

The problem with this output is that it reads en-US.UTF-8 with a hyphen instead of en_US.UTF-8 with an underscore. However, my locale.conf reads LANG=en_US.UTF-8, and running sudo locale-gen doesn't fix this.
This problem is affecting different applications. For example, when I run rofi -show, I am faced with the following output:

(process:2360): Rofi-WARNING **: 20:42:40.268: Failed to set locale.

and when I run alacritty I get a similar error:

xkbcommon: ERROR: couldn't find a Compose file for locale "en-US.UTF-8" (mapped to "en-US.UTF-8")
Error: Failed to spawn command '/usr/bin/zsh': No such file or directory (os error 2)

Sorry if I made any obvious/rookie mistakes, as I'm new to writing questions on Super User. Thank you for taking the time to read this, and any help is greatly appreciated!

2
  • Grep your /etc and your ~/.dotfiles for the incorrect value until you find what sets it?
    – grawity
    Commented Jun 12, 2022 at 10:06
  • Alright, I’ll try that and see if I can find what’s causing the issue.
    – apad
    Commented Jun 13, 2022 at 13:41

1 Answer 1

0

just stumbled upon this error, the issue is that your LANG variable was screwed up when you set your locale.conf, to fix it we have to unset our LANG and source /etc/profile.d/locale.sh:

$ unset LANG
$ source /etc/profile.d/locale.sh

After that perform $ locale -a it should have the correct locales, if not then you have an error in your locale.gen

My locale -a example(it should have an underscore):

C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
POSIX

After that perform locale-gen and that should do it. Took all the information from the locales section on Arch wiki: https://wiki.archlinux.org/title/locale

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .