problem starting unicorn, says unicorn not installed but it is

Logfile is: ben@whatnow:~/eventpuddle/eventpuddle/rails/eventpuddle$ systemctl status unicorn_eventpuddle.service ● unicorn_eventpuddle.service - LSB: starts the unicorn app server Loaded: loaded (/etc/init.d/unicorn_eventpuddle; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2017-09-13 02:03:19 BST; 3min 2s ago Docs: man:systemd-sysv-generator(8) Process: 5386 ExecStart=/etc/init.d/unicorn_eventpuddle start (code=exited, status=127) Sep 13 02:03:19 whatnow unicorn_eventpuddle[5386]: Starting eventpuddle Sep 13 02:03:19 whatnow su[5388]: Successful su for ben by root Sep 13 02:03:19 whatnow su[5388]: + ??? root:ben Sep 13 02:03:19 whatnow su[5388]: pam_unix(su:session): session opened for user ben by (uid=0) Sep 13 02:03:19 whatnow unicorn_eventpuddle[5386]: bundler: command not found: unicorn Sep 13 02:03:19 whatnow unicorn_eventpuddle[5386]: Install missing gem executables with bundle install Sep 13 02:03:19 whatnow systemd[1]: unicorn_eventpuddle.service: Control process exited, code=exited status=127 Sep 13 02:03:19 whatnow systemd[1]: Failed to start LSB: starts the unicorn app server. Sep 13 02:03:19 whatnow systemd[1]: unicorn_eventpuddle.service: Unit entered failed state. Sep 13 02:03:19 whatnow systemd[1]: unicorn_eventpuddle.service: Failed with result ‘exit-code’. ben@whatnow:~/eventpuddle/eventpuddle/rails/eventpuddle$

It says unicorn not found but it is. I have it in my Gemfile and I also installed it with ‘gem install unicorn’.

Have you installed it for the correct user? Or locally to your current?

User in unicorn.rb is ben. When I am logged in as ben I can type unicorn and it finds/runs it. Ime using rbenv. I did have this working and reinstlled rbenv localy in the user. sould of mentioned ths buy it was a 2PAM post just before I caled it a day. Will post config files later when I get home.

I’m not a user of rbenv, but when I still used ruby and RVM I had to load rvm manually in startup scripts. RVM even had a function to create shims which did this for you.

This is necessary, because RVM (and probably RBenv) are only loaded in a log in shell through its bash/zsh/whatever-rc files. The various init-systems do not use login-shells but start their stuff in very minimal environments, therefore you have to do lot of the setup on your own.