Banana Pi でOMV : ロケール設定

昨日、Banana Pi M1 Classic に OpenMediaVault を導入しました
デフォルトでロケールが混在しているため、apt コマンド等で警告が表示されます。

$ sudo apt install file
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  file
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 63.7 kB of archives.
After this operation, 93.2 kB of additional disk space will be used.
Get:1 http://cdn-fastly.deb.debian.org/debian stretch/main armhf file armhf 1:5.30-1+deb9u1 [63.7 kB]
Fetched 63.7 kB in 0s (64.2 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.UTF-8",
    LC_ALL = (unset),
    LC_TIME = "ja_JP.UTF-8",
    LC_MONETARY = "ja_JP.UTF-8",
    LC_ADDRESS = "ja_JP.UTF-8",
    LC_TELEPHONE = "ja_JP.UTF-8",
    LC_MESSAGES = "en_US.UTF-8",
    LC_NAME = "ja_JP.UTF-8",
    LC_MEASUREMENT = "ja_JP.UTF-8",
    LC_IDENTIFICATION = "ja_JP.UTF-8",
    LC_NUMERIC = "ja_JP.UTF-8",
    LC_PAPER = "ja_JP.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.

ロケール設定

素直に、設定します。

以下、言語設定を ja_JP.UTF-8 に変更(生成・設定)する場合です。

設定ファイル編集

locale.gen ファイルの「ja_JP.UTF-8 UTF-8」のコメントを外します。

$ sudo vi /etc/locale.gen 

ロケール生成

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

システム全体のロケールを設定

作業中のターミナルで即時反映する際は、source コマンドでシェルを実行し設定を反映させます。

$ sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
$ source /etc/default/locale 

設定確認

$ echo $LANG
ja_JP.UTF-8

確認

コマンド locale でも確認できます。
全て「ja_JP.UTF-8」に設定されていることを確認できます。
※警告メッセージも表示されなくなります。

$ locale
LANG=ja_JP.UTF-8
LANGUAGE=ja_JP:ja
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC=ja_JP.UTF-8
LC_TIME=ja_JP.UTF-8
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY=ja_JP.UTF-8
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER=ja_JP.UTF-8
LC_NAME=ja_JP.UTF-8
LC_ADDRESS=ja_JP.UTF-8
LC_TELEPHONE=ja_JP.UTF-8
LC_MEASUREMENT=ja_JP.UTF-8
LC_IDENTIFICATION=ja_JP.UTF-8
LC_ALL=