How to get English error messages on a localized Ubuntu?

Have you ever noticed that oftentimes people in anglophone forums will almost be offended if someone quotes an error message in their local language? Well, on one hand I can understand it, on the other I see more value in providing a copied+pasted error message in whatever language rather than some machine-translated abomination which makes it incomprehensible to readers trying to answer the question and the native speaker posting it alike 1.

But what if we could simply convince our programs to spit their errors in English and at the same time diagnose an error that is locale-specific? Turns out we can. On Ubuntu the en_US.UTF-8 locale always seems to get installed as a fallback. So if we ran apt-get update as ordinary user, it’d tell us in plain Russian that it can’t acquire a lock:

oliver@rukubuntu:~$ apt-get update
E: Не удалось открыть файл блокировки /var/lib/apt/lists/lock - open (13: Отказано в доступе)
E: Невозможно заблокировать каталог /var/lib/apt/lists/
E: Не удалось открыть файл блокировки /var/lib/dpkg/lock - open (13: Отказано в доступе)
E: Не удалось выполнить блокировку управляющего каталога (/var/lib/dpkg/); у вас есть права суперпользователя?

If we wanted the same phrased in plain English instead, we could set the LANG variable for this single invocation of apt-get.

oliver@rukubuntu:~$ LANG=en_US.UTF-8 apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Neat, eh?

// Oliver

  1. there is of course still the chance that the OP will be able to provide a sensible translation. []
This entry was posted in Administration, EN, Linux, Software and tagged , , . Bookmark the permalink.

Leave a Reply

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