使用 apt 或 apt-get 时出现错误消息

使用 apt 或 apt-get 时出现错误消息

我在 WSL 上使用 ubuntu 18。

apt例如使用sudo apt autoremove我收到错误消息:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dns-root-data dnsmasq-base ebtables libdumbnet1 libllvm9 liblxc-common liblxc1 libyaml-0-2 linux-headers-4.15.0-88
  linux-headers-4.15.0-88-generic lxcfs squashfs-tools uidmap xdelta3
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  python-doc python-tk
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success

同样的事情使用sudo apt install python例如:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dns-root-data dnsmasq-base ebtables libdumbnet1 libllvm9 liblxc-common liblxc1 libyaml-0-2 linux-headers-4.15.0-88
  linux-headers-4.15.0-88-generic lxcfs squashfs-tools uidmap xdelta3
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  python-doc python-tk
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success

我应该怎么办?

答案1

有一种快速但粗糙的解决方案有时太方便了,那就是重命名一个文件:

sudo mv /etc/apt/apt.conf.d/20snapd.conf /etc/apt/apt.conf.d/20snapd.old

然后您可以对它做任何您需要做的事情apt,然后将文件重命名为原来的名称。

相关内容