本文讨论的是locale,内容和我的另一篇有一定关联:http://blog.csdn.net/sheismylife/article/details/7635767
今天远程登录到一台UBuntu12.04 server,用locale一看,出现警告信息:
root@s15438266:~# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_CA.UTF-8
LANGUAGE=
LC_CTYPE="en_CA.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_CA.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_CA.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
这篇帖子解释的比较清楚,大意是ssh远程登录时想将我客户端的locale用在server上。结果server段没有en_US,就报了错。
http://askubuntu.com/questions/144235/locale-variables-have-no-effect-in-remote-shell-perl-warning-setting-locale-f
那就安装一下所有的en语言包:
root@s15438266:~# apt-get --reinstall install language-pack-en
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
firefox-locale-en language-pack-en-base
The following NEW packages will be installed:
firefox-locale-en language-pack-en language-pack-en-base
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1361 kB of archives.
After this operation, 4956 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main language-pack-en-base all 1:12.04+20120801 [878 kB]
Get:2 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main language-pack-en all 1:12.04+20120801 [1994 B]
Get:3 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main firefox-locale-en amd64 16.0.1+build1-0ubuntu0.12.04.1 [480 kB]
Fetched 1361 kB in 0s (4264 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "zh_CN.UTF-8",
LC_MONETARY = "zh_CN.UTF-8",
LC_ADDRESS = "zh_CN.UTF-8",
LC_TELEPHONE = "zh_CN.UTF-8",
LC_NAME = "zh_CN.UTF-8",
LC_MEASUREMENT = "zh_CN.UTF-8",
LC_IDENTIFICATION = "zh_CN.UTF-8",
LC_NUMERIC = "zh_CN.UTF-8",
LC_PAPER = "zh_CN.UTF-8",
LANG = "en_CA.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package language-pack-en-base.
(Reading database ... 27043 files and directories currently installed.)
Unpacking language-pack-en-base (from .../language-pack-en-base_1%3a12.04+20120801_all.deb) ...
Selecting previously unselected package language-pack-en.
Unpacking language-pack-en (from .../language-pack-en_1%3a12.04+20120801_all.deb) ...
Selecting previously unselected package firefox-locale-en.
Unpacking firefox-locale-en (from .../firefox-locale-en_16.0.1+build1-0ubuntu0.12.04.1_amd64.deb) ...
Setting up firefox-locale-en (16.0.1+build1-0ubuntu0.12.04.1) ...
Setting up language-pack-en (1:12.04+20120801) ...
Setting up language-pack-en-base (1:12.04+20120801) ...
Generating locales...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
Generation complete.
root@s15438266:~# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_CA.UTF-8
LANGUAGE=
LC_CTYPE="en_CA.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="en_CA.UTF-8"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="en_CA.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
root@s15438266:~# update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "zh_CN.UTF-8",
LC_ADDRESS = "zh_CN.UTF-8",
LC_MONETARY = "zh_CN.UTF-8",
LC_NUMERIC = "zh_CN.UTF-8",
LC_TELEPHONE = "zh_CN.UTF-8",
LC_IDENTIFICATION = "zh_CN.UTF-8",
LC_MEASUREMENT = "zh_CN.UTF-8",
LC_TIME = "zh_CN.UTF-8",
LC_NAME = "zh_CN.UTF-8",
LANG = "en_CA.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
root@s15438266:~# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
apt-get --reinstall install language-pack-en
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
似乎比前一篇我的博客中修改/etc/environment的方法更简单。