最近よくラズパイであそんでるのですが、これもデフォルトのシェルは bash で、普段 Mac では zsh をつかっていたため、とにかく bash が使いにくい。
ということで、こいつも zsh に変えよう…とおもったんだけどせっかくなのでずっと気になっていて手が出せないでいた fish を入れてみようと思ったのでそのときのメモです。
試した環境
ハードウェア:Raspberry pi 4 Model B
OS:
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
インストールする
↓のページに従っていけばOK
https://software.opensuse.org/download.html?project=shells%3Afish%3Arelease%3A3&package=fish
Raspbian は Debian 系なので、Debian を選択すると…なんか Debian のバージョンによって更に選択肢があるな…
ということで、Raspbian の Debian バージョンも調べておく。一応ね。
$ cat /etc/debian_version
10.4
10.4 らしいので、「Debian 10 の場合は、 root で下記のコマンドを実行してください:」の手順に従って進めていく
$ sudo su
$ echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' > /etc/apt/sources.list.d/shells:fish:release:3.list
$ wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key -O Release.key
$ apt-key add - < Release.key
$ apt-get update
$ apt-get install fish
$ exit
インストールできなかった
Release.key のセットから apt-get update までは順調だったのですが、いざ fish をインストールしようとしたら…
$ sudo apt-get install fish
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
fish : Depends: fish-common (= 3.0.2-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
なんかうまくいかなかった。
こういうときは aptitude で試すと良いといなかのばーちゃんも言ってたので試します。
aptitude いれるところから。
$ sudo apt-get install aptitude
ということで改めて。
$ sudo aptitude install fish
Warning: Invalid locale (please review locale settings, this might lead to problems later):
locale::facet::_S_create_c_locale name not valid
The following NEW packages will be installed:
bc{a} fish{b} libpcre2-32-0{a}
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 822 kB of archives. After unpacking 4372 kB will be used.
The following packages have unmet dependencies:
fish : Depends: fish-common (= 3.0.2-2) but it is not going to be installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) fish [Not Installed]
Accept this solution? [Y/n/q/?]
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "en_US.UTF-8",
LC_TYPE = "ja_JP.UTF-8",
LC_MESSAGES = "en_US.UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
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
とりあえず、提案1はダメだった。まぁそんな気はしてた。
しかしじつは aptitude は Accept this solution? [Y/n/q/?] という質問に [no] と答えると別の提案をしてくれるらしいので、
今度は1回目の提案を no にしてみる。
$ sudo aptitude install fish
Warning: Invalid locale (please review locale settings, this might lead to problems later):
locale::facet::_S_create_c_locale name not valid
The following NEW packages will be installed:
bc{a} fish{b} libpcre2-32-0{a}
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 822 kB of archives. After unpacking 4372 kB will be used.
The following packages have unmet dependencies:
fish : Depends: fish-common (= 3.0.2-2) but it is not going to be installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) fish [Not Installed]
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:
Install the following packages:
1) fish-common [3.0.2-2 (stable)]
2) javascript-common [11 (stable)]
3) libjs-jquery [3.3.1~dfsg-3 (stable)]
Accept this solution? [Y/n/q/?]
最初の提案を蹴ったら、aptitude が今度はこのへんの依存関係は入ってないから入れるのはどうだ?って聞いてきた。
リストを見ると「fish-common」も入ってる。なんかさっきのエラーに依存関係でどうこうとか書いてあったやつか。
これは行けそうな感じがするので、提案を受けてみる(yを押してみる)
# さっきのつづき
Accept this solution? [Y/n/q/?]y
The following NEW packages will be installed:
bc{a} fish fish-common{a} javascript-common{a} libjs-jquery{a} libpcre2-32-0{a}
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 2251 kB of archives. After unpacking 11.7 MB will be used.
Do you want to continue? [Y/n/?]
Get: 1 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf bc armhf 1.07.1-2 [101 kB]
Get: 2 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libjs-jquery all 3.3.1~dfsg-3 [332 kB]
Get: 3 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf fish-common all 3.0.2-2 [1091 kB]
Get: 4 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libpcre2-32-0 armhf 10.32-5 [168 kB]
Get: 5 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf fish armhf 3.0.2-2 [553 kB]
Get: 6 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf javascript-common all 11 [6120 B]
Fetched 2251 kB in 3s (652 kB/s)
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "en_US.UTF-8",
LC_TYPE = "ja_JP.UTF-8",
LC_MESSAGES = "en_US.UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
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 bc.
(Reading database ... 42698 files and directories currently installed.)
Preparing to unpack .../0-bc_1.07.1-2_armhf.deb ...
Unpacking bc (1.07.1-2) ...
Selecting previously unselected package libjs-jquery.
Preparing to unpack .../1-libjs-jquery_3.3.1~dfsg-3_all.deb ...
Unpacking libjs-jquery (3.3.1~dfsg-3) ...
Selecting previously unselected package fish-common.
Preparing to unpack .../2-fish-common_3.0.2-2_all.deb ...
Unpacking fish-common (3.0.2-2) ...
Selecting previously unselected package libpcre2-32-0:armhf.
Preparing to unpack .../3-libpcre2-32-0_10.32-5_armhf.deb ...
Unpacking libpcre2-32-0:armhf (10.32-5) ...
Selecting previously unselected package fish.
Preparing to unpack .../4-fish_3.0.2-2_armhf.deb ...
Unpacking fish (3.0.2-2) ...
Selecting previously unselected package javascript-common.
Preparing to unpack .../5-javascript-common_11_all.deb ...
Unpacking javascript-common (11) ...
Setting up javascript-common (11) ...
Setting up bc (1.07.1-2) ...
Setting up libpcre2-32-0:armhf (10.32-5) ...
Setting up libjs-jquery (3.3.1~dfsg-3) ...
Setting up fish-common (3.0.2-2) ...
Setting up fish (3.0.2-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for install-info (6.5.0.dfsg.1-4+b1) ...
Current status: 1 (+1) upgradable.
お、うまくいったかな?
$ type fish
fish is hashed (/usr/bin/fish)
インストールされてるっぽい!
一応こっちも
$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/usr/bin/fish
はいってる!
起動してみる
$ fish
Welcome to fish, the friendly interactive shell
pi@masternode ~>
うごいた!
ログインシェルにする
$ chsh
Password:
Changing the login shell for pi
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]: /usr/bin/fish
このあとログインし直して、ちゃんとログイン直後から fish が起動してることを確認してインストール完了。
まとめ
スーパー牛さんパワーは無いけど(嘘)aptitude、できる子!