Weird error message whenever I run the "snap" command

Ok, so the bug is in the file /etc/apt/apt.conf.d/20snapd.conf. It isn’t redirecting standard error as it should.
It looks like this:

AptCli::Hooks::Install { "[ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap || true"; };

and you want it to look like this:

AptCli::Hooks::Install { "[ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true"; };

the best way would be to just edit that file and add the needed redirection. If that seems too arcane, you could also run

sudo perl -pi~ -we 's|from-apt|from-apt 2>/dev/null|' /etc/apt/apt.conf.d/20snapd.conf

which should do the edit for you (and leave a backup of the old file in /etc/apt/apt.conf.d/20snapd.conf~ just in case). But you probably shouldn’t be running arbitrary commands from some rando on an internet forum. I hear it’s bad for your teeth.

2 Likes