Problems with missing locale files on Fedora 20 made libvirtd service not starting

Posted on Wed 15 January 2014 in Fedora

Since I am using Fedora 20 now for a while on two machines I came over some smaller bugs with my configuration.

I installed my systems using the KDE spin and installed with en_US language but a german keyboard layout. It looks like something after installation on my workstation did go wrong with local generation. Because I reinstalled the workstation for testing some different configurations with UEFI, I am quite sure this error is reproducible for me.

This is what I recognized first when I opened a shell and tried to use sudo I got messages like this one:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or director

First I didn't give it a lot of attention because the shell worked fine and I thought I need just to export my correct LC_ALL variable. But then I got problems running libvirtd service on that machine. It was a fresh installed Fedora 20 and the libvirtd service didn't want to start and quite while initialization. After some searching I found that this two problems are related.

I am not sure what did go wrong while installation or post installation process but because it is not a common known problem I think it is related to my configuration regarding language and keyboard layout. But I have to investigate some more to report a more qualified bug report than the usual bullsh** I fire them on their bug tool in general.

To fix the problem you need to generate the missing local files. This is done with different tools on most distributions. Arch, Gentoo and Ubuntu mostly refer to the locale-gen script which is not present on a default Fedora installation.

To regenerate your locale on Fedora run this command to fix the problem:

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

Of course you need to modify it to your local you want to have or which is missing on your system.