moshに繋がらなくなった(localeが不足していた)

リモートのmoshに繋がらなくなってしまいました.sshの認証後に失敗しています.
sshでは繋がります.

以下はmoshでssh認証以降のメッセージです.接続元で ja_JP.UTF-8 を使っているのでmoshサーバでもそれを使おうとして見つからずに失敗していそうです.

Authenticated to 192.0.2.5 (via proxy) using "publickey".
bash: warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)
The locale requested by LC_ALL=ja_JP.UTF-8 isn't available here.
Running `locale-gen ja_JP.UTF-8' may be necessary.

The locale requested by LC_ALL=ja_JP.UTF-8 isn't available here.
Running `locale-gen ja_JP.UTF-8' may be necessary.

mosh-server needs a UTF-8 native locale to run.

Unfortunately, the local environment (LC_ALL=ja_JP.UTF-8) specifies
the character set "US-ASCII",

The client-supplied environment (LC_ALL=ja_JP.UTF-8) specifies
the character set "US-ASCII".

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=ja_JP.UTF-8
LANGUAGE=
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=ja_JP.UTF-8
Connection to 192.0.2.5 closed.
Transferred: sent 3232, received 4688 bytes, in 3.3 seconds
Bytes per second: sent 975.2, received 1414.6
/usr/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)

試しに LC_ALL=en_US.UTF-8 を渡すと接続できました.

$ LC_ALL=en_US.UTF-8 mosh $SERVER

sshで接続して確認すると en_US.UTF-8 しか設定されていません.

$ grep -v ^# /etc/locale.gen


en_US.UTF-8 UTF-8

ja_JP.UTF-8 とついでに ja_JP.EUC-JP を追加して, locale-gen コマンドでlocaleを生成しました.

$ sudo vi /etc/locale.gen
$ sudo git diff /etc/locale.gen
diff --git a/locale.gen b/locale.gen
index afb6141..0f91c36 100644
--- a/locale.gen
+++ b/locale.gen
@@ -286,7 +286,7 @@ en_US.UTF-8 UTF-8
 # it_IT.UTF-8 UTF-8
 # it_IT@euro ISO-8859-15
 # iu_CA UTF-8
-# ja_JP.EUC-JP EUC-JP
-#  ja_JP.UTF-8 UTF-8
+ja_JP.EUC-JP EUC-JP
+ja_JP.UTF-8 UTF-8
 # ka_GE GEORGIAN-PS
 # ka_GE.UTF-8 UTF-8
 # kab_DZ UTF-8
$ sudo locale-gen
Generating locales (this might take a while)...
  en_US.UTF-8... done
  ja_JP.EUC-JP... done
  ja_JP.UTF-8... done
Generation complete.

この状態で再度 LC_ALL=ja_JP.UTF-8 の状態でmoshで接続してみるとうまく接続できるようになりました :)
以前は繋げていたのでいつの間にか /etc/locale.gen を書き換えてしまっていた?

/etc はetckeeperでgit管理しているので探してみると,locales 2.28-10locales 2.28-10+deb10u1 の更新時に ja_JP.UTF-8 UTF-8 がコメントアウトされていました.確認不足ですね><

環境
$ dpkg-query -W mosh locales
locales 2.28-10+deb10u1
mosh    1.3.2-2.1+b1
$ lsb_release -dr
Description:    Debian GNU/Linux 10 (buster)
Release:        10
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です