I am having problems with apt on my wsl installation of ubuntu 18.04. Whenever I try to install a package with apt I get this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required: [...]

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

I believe snapd/snappy is the culprit here, but I have not been able to find a way to solve this. Afaik snapd is not supported on wsl and I assume it's been installed in an update.

I am hoping to find a solution that won't require me to nuke the whole installation and having to spend hours setting everything up fresh.

Thanks in advance.

EDIT: original output from apt --version: apt 1.6.8 (amd64) an upgrade to 1.7.0 (amd64) did not seem to fix the issue.

  • 1
    Related: bugs.launchpad.net/ubuntu/+source/apt/+bug/1776218 Should be fixed already… – Melebius Mar 5 at 9:31
  • I've read that thread, but it doesn't really help me in any way. This problem appeared recently for me (after using the wsl installation for a good 4-5 months.) Is there any way to update apt itself (without apt upgrade)? – 173467321476C Mar 5 at 9:36
  • Yes, you could use dpkg. Download the required package from packages.ubuntu.com, then install it manually. You should also add the output of apt --version to your question. – Melebius Mar 5 at 9:49
  • 1
    Ok, it output apt 1.6.8 (amd64) so I downloaded and upgraded to apt 1.7.0 (amd64) after resolving dependencies I still have issues. – 173467321476C Mar 5 at 10:10

If you want a quick and dirty fix, you can remove the offending apt hook by typing:

sudo rm -rf /etc/apt/apt.conf.d/20snapd.conf
  • Quick and dirty, but it did the trick. – 173467321476C Mar 25 at 13:50

protected by Community Apr 28 at 10:02

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.