How to fix “%.# Configuration file for locale-gen” error on Arch Linux

A few days ago, I was reinstalling my daily driver laptop, because I wanted to dual-boot Windows and Linux. Everything was going fine, I installed windows on half my hard drive space, and I started installing Arch Linux from the ISO without archinstall. When I got to locale generation, I uncommented the UTF-8 English locale, and I tried to generate it with locale-gen. Next thing I see is I’m greeted with a nice error:

%.# Configuration file for locale-gen…Try `localedef –help’ or `localedef –usage’ for more information.

I have searched the Internet for answers. I even consulted the Arch wiki for answers, but I did not find the solution to my problem. Then, I stumbled upon an article on Arch Linux Forums. The solution that worked for OP and for me too was to check the start of /etc/locale.gen

There was a “%” and spaces before the first line! I have no idea how they got there, but after removing them, and running locale-gen, everything worked just fine.

Leave a Reply

Your email address will not be published. Required fields are marked *