Cannot set LC_CTYPE/LC_ALL to default locale: No such file or directory
Error description
Below error repeatly appears when run apt upgrade
.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "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").
Scanning processes...
Scanning candidates...
Scanning linux images...
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Check /etc/default/locale
file,
# File generated by update-locale
LANG=en_US.UTF-8
it doesn't contain following lines
LC_CTYPE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Tried but failed
Tried to run following commands, the errors are still there.
locale-gen "en_US.UTF-8"
dpkg-reconfigure locales
Also added following lines in /etc/environment
and /etc/default/locale
, still failed
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8