Incorrect command suggestion on installing classic snaps

I’m not sure if this is a strictly snapd issue, or one for Ubuntu itself, but I thought to post it here anyway.
When you attempt to launch an application from the command line that isn’t installed, ubuntu provides a helpful list of possible commands to instll it. These commands now include a an entry to get the snap (if one exists).

The issue is that if that snap is setup with classic confinement, the command provided doesn’t reflect that, and you end up with an error when trying to install the snap with the command provided.
See example below

muyiscoi@Muyiwa-XPS13:~/Downloads$ go 

Command 'go' not found, but can be installed with:

sudo snap install go         # version 1.11.2, or
sudo apt  install golang-go
sudo apt  install gccgo-go 

See 'snap info go' for additional versions.

muyiscoi@Muyiwa-XPS13:~/Downloads$ sudo snap install go
[sudo] password for muyiscoi: 
error: This revision of snap "go" was published using classic confinement and thus may perform
   arbitrary system changes outside of the security sandbox that snaps are usually confined to,
   which may put your system at risk.

   If you understand and want to proceed, repeat the command including --classic.

I believe this belongs to the command-not-found package:

Also: Bug #1763507 “command-not-found does not tell users they need to…” : Bugs : command-not-found package : Ubuntu

This is by design: read the error, and add the flag if you’re comfortable with its implications.

3 Likes

Ah, I see. Thanks for pointing me in the right direction. I can see that the bug is marked as “Won’t Fix”, so I guess that’s that