近日snap refresh总是提示 error: cannot communicate with server: timeout exceeded while waiting for response 开始也没当回事,以为又是上网姿势不科学导致的。后来纠正了上网姿势,依旧不能更新,还是提示这个。于是搜索了一下,在snap的官方社区找到了一个奇怪的解决方案:卸载所有老旧版本。 我看了一下,我的snap确实基本都是有两个版本,一新一旧
snap list --all 44.7s 2020年04月15日 星期三 13时22分13秒
Name Version Rev Tracking Publisher Notes
bluemail 1.1.12 20 latest/stable blix -
core 16-2.43.3 8689 latest/stable canonical✓ core,disabled
core 16-2.44.1 8935 latest/stable canonical✓ core
core18 20200124 1668 latest/stable canonical✓ base,disabled
core18 20200311 1705 latest/stable canonical✓ base
fkill 5.2.0 84 latest/stable snapcrafters disabled
fkill 6.0.1 102 latest/stable snapcrafters -
freeplane-mindmapping 1.8.0 19 latest/stable jibel -
freeplane-mindmapping 1.7.13 18 latest/stable jibel disabled
gitkraken 6.5.4 153 latest/stable gitkraken✓ -
gitkraken 6.5.2 152 latest/stable gitkraken✓ disabled
gnome-3-28-1804 3.28.0-16-g27c9498.27c9498 116 latest/stable canonical✓ -
gnome-3-28-1804 3.28.0-16-g27c9498.27c9498 110 latest/stable canonical✓ disabled
gotop 0.1.1 3 latest/stable ubuntu-dawndiy -
gtk-common-themes 0.1-28-g1503258 1440 latest/stable canonical✓ disabled
gtk-common-themes 0.1-29-g45e78c5 1474 latest/stable canonical✓ -
gtk2-common-themes 0.1 5 latest/stable canonical✓ disabled
gtk2-common-themes 0.1 9 latest/stable canonical✓ -
heimer 1.15.1 23 latest/stable jussi-lind -
insomnia 7.0.6 55 latest/stable gschier1990 disabled
insomnia 7.1.1 62 latest/stable gschier1990 -
lxd 4.0.0 14503 latest/stable canonical✓ -
lxd 4.0.0 14442 latest/stable canonical✓ disabled
mailspring 1.7.2 407 latest/stable foundry376✓ disabled
mailspring 1.7.4 440 latest/stable foundry376✓ -
micro 2.0.3 2027 latest/stable zy classic
micro 2.0.2 1913 latest/stable zy disabled,classic
postman 7.22.1 106 latest/stable postman-inc✓ -
postman 7.21.2 104 latest/stable postman-inc✓ disabled
redis-desktop-manager 2019.5-c57dd5f 335 latest/stable uglide -
redis-desktop-manager 2019.4-83abef8 332 latest/stable uglide disabled
scratux 1.2.0 5 latest/stable joancipria disabled
scratux 1.3.0 6 latest/stable joancipria -
sftpclient 3.4.1 88 latest/stable sftpclient -
sftpclient 3.3.20 83 latest/stable sftpclient disabled
snap-store 20191021.a9948d5 201 latest/stable canonical✓ disabled
snap-store 20191114.a9948d5 209 latest/stable canonical✓ -
termius-beta 5.9.1 90 latest/stable termius✓ -
termius-beta 5.9.0 89 latest/stable termius✓ disabled
waterfox-snap 2020.03.1 37 latest/edge yamiyukisenpai -
旧的都是disabled状态。 于是卸载掉旧版本,再refresh果然好了。原因不明。
批量卸载脚本如下:
#! /bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
sudo snap refresh
All snaps up to date.
snap list --all
Name Version Rev Tracking Publisher Notes
bluemail 1.1.12 20 latest/stable blix -
core 16-2.44.1 8935 latest/stable canonical✓ core
core18 20200311 1705 latest/stable canonical✓ base
fkill 6.0.1 102 latest/stable snapcrafters -
freeplane-mindmapping 1.8.0 19 latest/stable jibel -
gitkraken 6.5.4 153 latest/stable gitkraken✓ -
gnome-3-28-1804 3.28.0-16-g27c9498.27c9498 116 latest/stable canonical✓ -
gotop 0.1.1 3 latest/stable ubuntu-dawndiy -
gtk-common-themes 0.1-29-g45e78c5 1474 latest/stable canonical✓ -
gtk2-common-themes 0.1 9 latest/stable canonical✓ -
heimer 1.15.1 23 latest/stable jussi-lind -
insomnia 7.1.1 62 latest/stable gschier1990 -
lxd 4.0.0 14503 latest/stable canonical✓ -
mailspring 1.7.4 440 latest/stable foundry376✓ -
micro 2.0.3 2027 latest/stable zy classic
postman 7.22.1 106 latest/stable postman-inc✓ -
redis-desktop-manager 2019.5-c57dd5f 335 latest/stable uglide -
scratux 1.3.0 6 latest/stable joancipria -
sftpclient 3.4.1 88 latest/stable sftpclient -
snap-store 20191114.a9948d5 209 latest/stable canonical✓ -
termius-beta 5.9.1 90 latest/stable termius✓ -
waterfox-snap 2020.03.1 37 latest/edge yamiyukisenpai -