Unicorn service failing to start on Ubuntu 16.10

394 Views Asked by At

I'm working on a project which requires Unicorn to run. I have set up a service which will start on boot. However, it fails to start. Here is an excerpt from the log with the errors:

jul 05 08:21:04 ubuntu3 su[1255]: pam_systemd(su:session): Failed to create session: Connection timed out
jul 05 08:21:06 ubuntu3 unicorn_consul[1116]: ruby-2.3.2 is not installed.
jul 05 08:21:06 ubuntu3 unicorn_consul[1116]: To install do: 'rvm install ruby-2.3.2'

I do have Ruby installed, if I run ruby -v it returns ruby 2.3.2p217 (2016-11-15 revision 56796) [i686-linux]. Is it maybe because I installed Ruby via rbenv instead of rvm? If so, how can I make it use my Ruby installation?

Here I pasted the contents of my service's bash file.

Then I'd start Nginx. Here are the contents of its config file.

UPDATE 1:

I fixed the Ruby problem when I uninstalled rvm from my computer. Now the only problem left is the timeout problem.

1

There are 1 best solutions below

0
On BEST ANSWER

I finally managed to run the service. Here is what I did:

The first problem was the service timeout. I edited my config/unicorn.rb file and I changed the timeout from 30 to 120.

The second problem was Ruby not being found despite having it installed. I solved it by uninstalling rvm (aside from running rvm implode I had to delete some files, folders and references in other files).