I've been trying to set my locale to en_US.UTF-8 without any success. Based off of other answers around the internet, I should first generate the locale with

sudo locale-gen en_US.UTF-8

And then apply it with

sudo dpkg-reconfigure locales

However, running locale-gen does something weird:

user@Host /home/user $ sudo locale-gen en_US.UTF-8
Generating locales (this might take a while)...
  en_US.ISO-8859-1... done
Generation complete.

As you see, it never actually generates UTF-8, but instead keeps falling back to ISO-8859-1. I can never manage to set LC_ALL to en_US.UTF-8, probably because it can't generate.

Am I doing something wrong? I'm running Debian 8.1.

2 Answers 2


You've tried to apply a recipe for Ubuntu under Debian. That usually works, but in this specific case it doesn't.

Ubuntu is derived from Debian, and doesn't change much apart from the installer and the GUI. The locale-gen command is one of those few other things that it changes. I don't know why.

Under Debian, the locale-gen command takes no arguments and regenerates the compiled locale definitions according to the configured list of locales. To modify the selection of locales that you want to use, edit the file /etc/locale.gen then run the locale-gen command. Alternatively, run dpkg-reconfigure locales as root, select the additional locales you want (and deselect the ones you don't want), and press OK.

Under Ubuntu, if you run the locale-gen command without arguments, it regenerates the compiled locale definitions according to the configured list of locales. But if you pass some arguments, they're added to the list and generated immediately. The list of locales is kept in /var/lib/locales/supported.d/local. Running dpkg-reconfigure locales just regenerates the compiled locales without giving you an opportunity to modify the selection.

In summary, to add en_US.UTF-8 to the list of usable locales:

  • Debian, interactive: dpkg-reconfigure locales
  • Debian, automated: sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen && locale-gen
  • Ubuntu, automated: locale-gen en_US.UTF-8
  • So how would you add packages with dpkg-reconfigure? I got the interactive interface, but when selecting an item with enter, it did not get installed.
    – Erik S
    Dec 3, 2015 at 9:27
  • @ErikDolor I don't understand your question. Unless you've changed debconf settings, dpkg-reconfigure locales brings up a text mode dialog box, with a checkbox for each locale that can be generated. You scroll down to en_US.UTF-8, check it, and press the OK button. Dec 3, 2015 at 10:08
  • I tried checking it with the enter button, but that apparently functioned as pressing OK.
    – Erik S
    Dec 3, 2015 at 11:51
  • 2
    @ErikDolor Oh. Press Space to toggle a checkbox. Dec 3, 2015 at 12:29
  • Also works for raspbian jessie May 18, 2018 at 16:16

After actually reading the man file for locale-gen instead of blindly trusting the internet, I found that locale-gen actually takes the locales to generate from /etc/locale.gen. By uncommenting en_US.UTF-8 there, I managed to generate it.

  • sed -i '/^#.* es_ES /s/^#//' /etc/locale.gen If you are using docker this might be usefull
    – Borjante
    Mar 20, 2018 at 12:16
  • The ONLY answer that worked for me after scouring the internet for days!! Thank you SO MUCH!
    – I.Am.A.Guy
    Apr 9, 2018 at 14:18

You must log in to answer this question.

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