GordonWei's Blog

[Linux]ipv6使用apt功能卡住


今天在做某些設備軟體更新時發現會卡很久

看他的的狀態猜測為ipv6的問題

只好去餵狗啦

root@hostname:~# apt update
Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
0% [Connecting to archive.raspberrypi.org (2a00:1098:0:82:1000:13:0:9)]

大多數都是直接教你關掉的方法

一介資男的做法比較好一點,是以ipv4的權重為優先,避免未來會發生異常

作法:編輯/etc/gai.conf

找到下面這行

#precedence ::ffff:0:0/96 100

把註解拿掉之後再下apt update

Get:3 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Hit:4 https://download.docker.com/linux/raspbian stretch InRelease
Hit:1 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Get:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
Fetched 40.3 kB in 21s (1,864 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
122 packages can be upgraded. Run 'apt list --upgradable' to see them.

結束

以上文章皆是原創(廣告文除外),轉載前請先來信通知,本人同意後方可轉載,謝謝!

文章分類:Linux


blog comments powered by Disqus