The sudo command runs the command that follows it as the root user. So the question to ask is this: is the shell at hand being run by the root user already? If so, there’s no need to use sudo. If not, then you need sudo so the process becomes root before running the command. That’s true whether the system is native or running inside a VM.
$ snap install hello-world
hello-world 6.3 from ‘canonical’ installed
It gets installed without sudo. Is that supposed to happen? I hope I did not do intrusive changes to the system that somehow does not require sudo in snap install.
That implies you are running it as root, which perhaps means you are running your whole session as root, which is generally not advised. Running the command whoami will confirm which user is running the shell at the moment.
$ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),129(vboxusers),130(lxd),135(libvirtd)
On your system (non-virtualized), does it work when you run snap install hello-world as a non-root user?
Once you authenticate yourself to the store (i.e. sudo snap login) you can then install snaps on your system without needing root privileges.
You can check your current authenticated user with snap whoami and it will show the email address associated with your device. An unauthenticated user would see an empty email, like:
email: -
and will then need root privileges to install a snap.
All of this is true if you’re installing snaps on bare metal, KVM or a LXD container.
Such information are essential to even simple snap usage. I searched around the Internet and did not find something that mentioned this. Such info is important to get out there if snaps are to become core to Ubuntu.
the path entry is set by /etc/profile.d/apps-bin-path.sh which is shipped by snapd and should be executed on fresh login … what you did there is to not spawn the bash you call as login shell, so it wont process any global profile.d defaults “multipass exec go bash -l” should have worked …