######Gitでsetsockopt IPV6_TCLASS 8: Operation not permitted:
の表示を消す。
開発環境
Ubuntu 18.04 LTS, WSL 1, Git 2.17.1
問題
git pullをした際に以下の表示が出る。
$ git pull
setsockopt IPV6_TCLASS 8: Operation not permitted:
[こちら][link-1]の記事において同様な表示が出ていることが確認された。Gitのバージョンをアップデートすることにより解決されていたのでアップデートを行う。(アップデート手順は[こちら][link-2]を参照した。)
$ git version
git version 2.17.1
$ sudo add-apt-repository ppa:git-core/ppa
The most current stable version of Git for Ubuntu.
For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
More info: https://launchpad.net/~git-core/+archive/ubuntu/ppa
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Get:1 https://dlm.mariadb.com/repo/mariadb-server/10.4/repo/ubuntu bionic InRelease [6265 B]
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease [20.8 kB]
Get:6 https://dbeaver.io/debs/dbeaver-ce InRelease [2086 B]
Hit:7 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 https://downloads.mariadb.com/MaxScale/6.2.0/apt bionic InRelease [6385 B]
Get:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 https://downloads.mariadb.com/Tools/ubuntu bionic InRelease [2165 B]
Get:10 https://dbeaver.io/debs/dbeaver-ce Packages [458 B]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1958 kB]
Get:12 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main amd64 Packages [4188 B]
Get:13 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main Translation-en [2252 B]
Get:14 https://downloads.mariadb.com/MaxScale/6.2.0/apt bionic/main amd64 Packages [1397 B]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2303 kB]
Get:16 https://downloads.mariadb.com/Tools/ubuntu bionic/main amd64 Packages [2742 B]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1150 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1767 kB]
Get:19 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [264 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [381 kB]
Fetched 8124 kB in 43s (187 kB/s)
Reading package lists... Done
$ sudo apt update
Get:1 https://dlm.mariadb.com/repo/mariadb-server/10.4/repo/ubuntu bionic InRelease [6265 B]
Hit:4 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:7 https://dbeaver.io/debs/dbeaver-ce InRelease
Hit:8 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:2 https://downloads.mariadb.com/MaxScale/6.2.0/apt bionic InRelease
Hit:3 https://downloads.mariadb.com/Tools/ubuntu bionic InRelease
Fetched 6265 B in 14s (432 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
11 packages can be upgraded. Run 'apt list --upgradable' to see them.
$ sudo apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
git-man libpcre2-8-0
Suggested packages:
git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki
git-svn
The following NEW packages will be installed:
libpcre2-8-0
The following packages will be upgraded:
git git-man
2 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 7790 kB of archives.
After this operation, 6681 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main amd64 git amd64 1:2.34.1-0ppa1~ubuntu18.Preparing to unpack .../libpcre2-8-0_10.31-2_amd64.deb ...Unpacking libpcre2-8-0:amd64 (10.31-2) ...Setting up git-man (1:2.34.1-0ppa1~ubuntu18.04.1) ...Setting up libpcre2-8-0:amd64 (10.31-2) ...
Setting up git (1:2.34.1-0ppa1~ubuntu18.04.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
$ git version
git version 2.34.1
結果、変わらず。
$ git pull
setsockopt IPV6_TCLASS 8: Operation not permitted:
Already up to date.
調べていると、[こちら][link-3]の記事を見つけたので試してみる。
$ cd ~/.ssh
$ touch config
$ sudo vi config
$ cat config
AddressFamily inet
setsockopt IPV6_TCLASS 8: Operation not permitted:
が消えたか確認してみる。
$ git pull
Already up to date.
表示されなくなりました。
##まとめ
今回の解決方法は単にIPV4のみ接続するように変更しただけなので、IPV6の操作が許可されていないという根本的解決には至っていないのですが、とりあえずこのままにしておきます。(configの設定の参考:[sshdで「IPv4」「IPv6」のどちらかのプロトコルのみ接続させる方法][link-4])
##参考
・[bitbucket ssh error setsockopt IPV6_TCLASS 8 Operation][link-1]
・[Ubuntu で git のバージョンを最新版にする][link-2]
・[WSLではじめてgitつかうとダメだった][link-3]
・[sshdで「IPv4」「IPv6」のどちらかのプロトコルのみ接続させる方法][link-4]
[link-1]:https://stackoverflow.com/questions/53355901/bitbucket-ssh-error-setsockopt-ipv6-tclass-8-operation)
[link-2]:https://loumo.jp/archives/23149)
[link-3]:https://kounetsuman.online/blog/post/vdc31s26r)
[link-4]:https://www.server-memo.net/server-setting/ssh/addressfamily.html)