
A broken pearl (generated by Midjourney). Credit: libre-software.net. License: CC BY-SA 4.0
Ubuntu: resolve the “perl: warning: Setting locale failed” problem
Last updated on October 11, 2022
Are you running Ubuntu 18.04, 20.04 or 22.04 desktop or server edition, and getting warning or errors when installing software via apt-get
or aptitude
?
Here is a typical error message:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "es_ES.UTF-8",
LC_MONETARY = "de_DE.UTF-8",
LC_ADDRESS = "de_DE.UTF-8",
LC_TELEPHONE = "de_DE.UTF-8",
LC_NAME = "de_DE.UTF-8",
LC_MEASUREMENT = "de_DE.UTF-8",
LC_IDENTIFICATION = "de_DE.UTF-8",
LC_NUMERIC = "de_DE.UTF-8",
LC_PAPER = "de_DE.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Sometimes, trying to solve the problem using the update-locale
or locale
commands does not work and generates following error messages:
~ # sudo update-locale
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "de_DE.UTF-8",
LC_ADDRESS = "de_DE.UTF-8",
LC_MONETARY = "de_DE.UTF-8",
LC_NUMERIC = "de_DE.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_TIME = "es_ES.UTF-8",
LC_NAME = "de_DE.UTF-8",
LANG = (unset),
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
or
~ # locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=es_ES.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
Solution to the perl locale problem
The solution is to export the missing locales to ~/.bash_profile
. The following command is a one-command line:
echo "export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8">>~/.bash_profile
You could also run each command separately:
echo "export LANGUAGE=en_US.UTF-8">>~/.bash_profile
Alternatively, edit ~/.bash_profile “by hand” with nano, vim or a graphical editor like gedit or xed (Linux Mint).
Don’t forget to reboot and check if the new locales are applied with the locale
command.
Another solution is to add the locale variables to /etc/environment
instead of ~/.bash_profile
.
By Johannes Eva, April 2017 – October 2022
15 thoughts on “How to install LibreOffice 24.2 on Linux Mint, Ubuntu, MX Linux, Debian…”
You may use the official appimage in Libre Office as well. In fact, on Linux Mint 21 you can’t get rid of the default LO as it may lead to dependency issues. Appimage helps.
Pingback: Ubuntu 21.04: Essentials – Linux Sagas
Issuing
$ sudo apt-get remove libreoffice-core
installs an office core no gui. With or without purging. Yielding this:The following packages will be REMOVED:
libreoffice-base libreoffice-calc libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-impress libreoffice-lightproof-ru-ru libreoffice-math libreoffice-nlpsolver libreoffice-report-builder libreoffice-report-builder-bin libreoffice-script-provider-python libreoffice-sdbc-postgresql libreoffice-wiki-publisher python3-uno
The following NEW packages will be installed:
libreoffice-core-nogui
Many thanks for any clarification!
Right! The correct command for removing completely the stock LibreOffice on Linux is the following:
sudo apt purge libreoffice-common
The following command also works but misses some packages:
sudo apt purge libreoffice*
Thank you for your comment, I updated the article accordingly.
NOTE:- I found that Libre Office version 6.3.2.2 is extremely buggy, it has major dependency problems attempting to install on Linux Mint (Tina 19.2). I wasn’t able to resolve these problems so had to revert the install (remove 6.3.2.2-2) and return to previous version 6.3.1 which works fine.
**Windows 10 (1903) ALSO NOTE that LO 6.3.2.2 installs on W10 but also caused major performance issues and hung my system on reboot. My machine Borked badly so once again had to revert back to LO 6.3.1 which works fine.
Thanks for the Terminal codes. Newbies like me just want it to work and your codes provide the copy and paste necessities for Linux to do its magic.
(If it can’t be done in Linux (and LibreOffice) its not worth doing)
please help me with this error, newbee here
root@Anon:~/libreoffice# sudo dpkg -i *.deb
dpkg: error: dpkg status database is locked by another process
root@Anon:~/libreoffice# cd LibreOffice_6.0.2.1_Linux_x86_deb
root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# sudo dpkg -i *.deb
dpkg: error: dpkg status database is locked by another process
root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd debs
bash: cd: debs: No such file or directory
root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd DEBS
root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
dpkg: error: dpkg status database is locked by another process
root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
dpkg: error: dpkg status database is locked by another process
The last line says it all: check if you are running another instance of dpkg. In last resort, try to remove dpkg lock file:
sudo rm /var/lib/dpkg/lock
Then let dpkg fix itself:
sudo dpkg --configure -a
Note that this problem is not per se related to LibreOffice.
In Ubuntu, you could use this repository and LibreOffice will always be upgraded to the latest version:
sudo add-apt-repository ppa:libreoffice/ppa
Details here:
http://tipsonubuntu.com/2017/01/31/install-libreoffice-5-3-ubuntu/
Please mind that the mentioned PPA is only available on LTS and the latest non-LTS release.
Thank you Stefano, that was the info I was looking for. This method works even for LibreOffice 6.
Would be useful to know how to install such alongside the native repository install of LibreOffice – without conflict. Would be useful to be able to choose, say, LibreOffice Writer 5.2, vs just LibreOffice Writer. Migrations / new versions not always working as seamlessly as one might like with files one might already have. It can be very frustrating to have a new version munge (e.g. formatting) of a current document one depends on, and not being able to ‘un-munge’ it.
Install alacarte to manage the menu itens.
Thanks Ogalho. Alacarte is a great tool, though it has not been updated for a while. An alternative is MenuLibre, which is also not very often updated. Anyway, here is a tutorial for Alacarte:
https://www.howtoforge.com/tutorial/how-to-manage-main-menu-icons-in-gnome/
Alacarte for Linux Mate Edition is named Mozo.
All of them should be good enough to create menu shortcuts for LibreOffice!
Works well. The only problem I had is that the icons were not created. I created them manually by running Writer, Calc and Impress and the using the “Lock to Launcher” option. This is how to run them from the terminal:
Writer: /opt/libreoffice5.0/program/oosplash –writer
Calc: /opt/libreoffice5.0/program/oosplash –calc
Impress: /opt/libreoffice5.0/program/oosplash –impress