Site icon Mr. 沙先生

SSH locale 語系的問題解決

最近幾個月換筆電,然後開始在陸陸續續在 Server 上出現一些語系錯誤的訊息,然後不以為意了好一陣子,今天突然覺得很礙眼,準備解決這個問題

 

研究一下發現問題是如果 sshd_config 有開啟 SendEnv 的話就會將 Local 的 env 發送到 Remote Server,如果 Remote Server 沒有語系就會出現以下錯誤訊息

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = “en_US:”,
LC_ALL = (unset),
LC_CTYPE = “zh_TW.UTF-8”,
LANG = “en_US”
are supported and installed on your system.
perl: warning: Falling back to a fallback locale (“en_US”).

或是

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

 

然後查看一下 Server 目前的語系包,會發現不會有 zh_TW.UTF-8 這個語系

$ locale -a | grep zh_TW.UTF-8

 

然後你可以用 locale-gen 自行加入語系

$ sudo locale-gen zh_TW.UTF-8
Generating locales (this might take a while)...
  zh_TW.UTF-8... done
Generation complete.

 

再次執行,就搞定了。

 

Exit mobile version