向 Ubuntu 社区问好!
我正在运行一个较旧版本的 Ubuntu 16.04,这是我之前设置的,以便可以运行我自己的个人 Nextcloud 服务器。我尝试使用 verbose 提供的多个搜索词来研究我遇到的 snap 错误,但没有成功,所以我想我会来这里。似乎 snap 的链接问题导致了错误抛出。每当我尝试使用例如sudo apt upgrade
等时sudo apt install <package>
,它都会给我这个错误:
sudo apt install openssh-server
[sudo] password for sysadmin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libicu64 libllvm7 libllvm8
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
ncurses-term openssh-sftp-server ssh-import-id
Suggested packages:
molly-guard monkeysphere rssh ssh-askpass
E: Waited for [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true but it wasn't there
E: Failure running hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true
E: Waited for [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true but it wasn't there
E: Failure running hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true
答案1
该消息看起来很奇怪,但我们可以通过创建临时替代方案来解决它/usr/bin/snap
:
cat <<EOF | sudo tee /usr/bin/snap
#!/bin/bash
exit 0
EOF
sudo chmod +x /usr/bin/snap
然后使用 安装您的应用程序sudo apt install openssh-server
。
最后重新安装 Snap 守护程序来替换我们的临时脚本:
sudo apt-get install --reinstall snapd
答案2
假设您确实打算删除snapd
,那么您还可以删除在卸载时导致此错误的有缺陷的 APT 钩子:
sudo rm /etc/apt/apt.conf.d/20snapd.conf