Introduction

Today I have installed a new server at linode, and I put Arch Linux on it.

I've also installed LAMP on it, but as soon as I tried to start Apache I run into some errors.

LCCTYPE: cannot change locale (enUS.utf8): No such file or directory

These are the errors I found while trying to start Apache.

/etc/rc.d/functions: line 43: warning: setlocale: LC_CTYPE: cannot change locale (en_US.utf8): No such file or directory
/etc/rc.d/functions: line 43: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.utf8): No such file or directory
/etc/rc.d/functions: line 43: warning: setlocale: LC_TIME: cannot change locale (en_US.utf8): No such file or directory
/etc/rc.d/functions: line 43: warning: setlocale: LC_COLLATE: cannot change locale (en_US.utf8): No such file or directory
/etc/rc.d/functions: line 43: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.utf8): No such file or directory

Also when running locale -a I've got these other messages:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory

How to solve locale error

The problem here was that I had no locale generated, so I need to run

locale-gen

But that did not solve my problem, and all was because I had no locale defined to be generated.

To do this, edit the file /etc/locale.gen.

Once there uncomment the right lines for you. In my case was

en_US.UTF-8 UTF-8  
en_US ISO-8859-1  

Finally generate locale.

locale-gen

Now you have finished.