说实话,我不记得 snap 安装是否在 18.04 之前起作用,我只是在升级到 20.04 后才注意到这个问题。
我已经尝试了在这里和其他地方读到的所有建议,但仍然出现错误......
错误:无法安装“hello-world”:发布 https://api.snapcraft.io/v2/snaps/refresh:拨号 tcp:查找 api.snapcraft.io:没有这样的主机
更新:这是尝试 snap install 后的相关日志。有什么问题吗?
3/16/23 7:00 PM systemd Starting Snap Daemon...
3/16/23 7:00 PM snapd overlord.go:268: Acquiring state lock file
3/16/23 7:00 PM snapd overlord.go:273: Acquired state lock file
3/16/23 7:00 PM snapd daemon.go:247: started snapd/2.58+20.04 (series 16; classic) ubuntu/20.04 (amd64) linux/5.4.0-144-generic.
3/16/23 7:00 PM systemd tmp-syscheck\x2dmountpoint\x2d215737467.mount: Succeeded.
3/16/23 7:00 PM systemd tmp-syscheck\x2dmountpoint\x2d215737467.mount: Succeeded.
3/16/23 7:00 PM snapd daemon.go:340: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
3/16/23 7:00 PM snapd backends.go:58: AppArmor status: apparmor is enabled and all features are available
3/16/23 7:00 PM systemd Started Snap Daemon.
3/16/23 7:00 PM dbus-daemon [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.180' (uid=0 pid=5965 comm="/usr/lib/snapd/snapd " label="unconfined")
3/16/23 7:00 PM systemd Starting Time & Date Service...
3/16/23 7:00 PM dbus-daemon [system] Successfully activated service 'org.freedesktop.timedate1'
3/16/23 7:00 PM systemd Started Time & Date Service.
3/16/23 7:00 PM snapd api_snaps.go:366: Installing snap "hello-world" revision unset
3/16/23 7:00 PM snapd store_download.go:142: no host system xdelta3 available to use deltas
3/16/23 7:00 PM /usr/lib/gdm3/gdm-x-session qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 61909, resource id: 39846192, major code: 3 (GetWindowAttributes), minor code: 0
3/16/23 7:00 PM sudo pam_unix(sudo:session): session closed for user root
3/16/23 7:00 PM /usr/lib/gdm3/gdm-x-session qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 62084, resource id: 39846194, major code: 3 (GetWindowAttributes), minor code: 0
3/16/23 7:00 PM snapd daemon.go:521: gracefully waiting for running hooks
3/16/23 7:00 PM snapd daemon.go:523: done waiting for running hooks
3/16/23 7:00 PM snapd overlord.go:512: Released state lock file
3/16/23 7:00 PM snapd daemon stop requested to wait for socket activation
3/16/23 7:00 PM systemd snapd.service: Succeeded.
3/16/23 7:00 PM systemd systemd-timedated.service: Succeeded.
答案1
这解决了问题。这是一个 DNS 问题。
sudo systemd-resolve --set-dns=8.8.8.8 --interface=<interface name>
取自该帖子...