12

I just tried to used snap for the first time and followed the tutorial Getting started | Snapcraft documentation.

I installed the hello world example sudo snap install hello but the hello command is not found. I noticed that the command is in /snap/bin but it seems that it missed it's way to my PATH.

When I installed snap (sudo apt install snapd) I got some error message the first time, but on the 2nd try it worked. (Removing and installing snapd did also not help.)

Do I have to add the path manually?

Any idea?

Edit:

  • the shout irc web app did work immediately
Eliah Kagan
  • 117,780
Peter T.
  • 223
  • I know this question is old but are you sure the app is named hello instead of hello-world? – knocte Apr 19 '19 at 07:45

4 Answers4

22

If you've just installed snapd, try starting a fresh terminal window to pick up the new $PATH. You'll only need to do this once.

If your shell doesn't read from /etc/profile.d you'll need to add PATH=$PATH:/snap/bin to your shell configuration (e.g. ~/.zshrc for zsh)

Evan
  • 5,048
  • Thanks opening a new terminal solved it .... one could think this was quite obvious ;-) (However, the rocketchat -server is still not working, but I guess this is a different story / question) – Peter T. May 21 '17 at 19:27
  • Cool! I'd take the RocketChat question to their Stackoverflow tag: http://stackoverflow.com/questions/tagged/rocket.chat – Evan May 21 '17 at 20:29
  • I also found the reason for rocket.chat - one of the required ports was already used on this machine. – Peter T. May 22 '17 at 15:09
1

If you are installing zsh then you can easily configure just open your terminal and type

sudo gedit /etc/zsh/zprofile

If you use vim, vscode or anything just add this instead of gedit. And then add these two lines.

emulate sh -c 'source /etc/profile'
emulate sh -c 'source /etc/profile.d/apps-bin-path.sh'

Then save it and close. Now time to restart your PC hopefully it will work.

msjahid
  • 11
0

This problem still occurs with Ubuntu 18.04 with Wayland, zsh and snapd. See posts #18 and #19 in https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1640514 for more details.

stucki
  • 36
0

On debian 9, I had to add /snap/bin to the root PATH manually. Do the following:

In /etc/login.defs, you will find the following line:

ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Add the path so that it will be:

ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Exit the session, and login again.