mongrel_rails command not found (all gems do it)

118 views
Skip to first unread message

viatropos

unread,
Jul 16, 2009, 9:37:37 PM7/16/09
to deprec - deployment recipes for capistrano
Hey,

After running:

cap deprec:rails:install_stack
cap deprec:db:install
cap deploy:setup

...when I run...

cap deploy

...I get an error because "sudo mongrel_rails" results in:

sudo: mongrel_rails: command not found

I have "set :use_sudo, false" in the deploy.rb script, and I tried
setting global PATH variables on my slice but that doesn't work. Any
ideas how to solve this? All gems installed through the deprec
commands do this. Their executables are in:

/opt/ruby-enterprise/bin

Thanks!

Lance

viatropos

unread,
Jul 16, 2009, 9:41:46 PM7/16/09
to deprec - deployment recipes for capistrano
btw, running the gem command without sudo works fine, but I think
deprec is placing 'sudo' before it.

Greg Pederson

unread,
Jul 16, 2009, 10:00:52 PM7/16/09
to deprec...@googlegroups.com
It might be possible that mongrel or mongrel_cluster gem got installed
by gem install vs sudo gem install. This causes the gem not to be in
the right load path...
I had this problem with one version of capstrano in my local user...I
had do remove that gem version by hand

Greg Pederson
Nsight Web Development
www.NsightDevelopment.com

viatropos

unread,
Jul 17, 2009, 3:05:30 AM7/17/09
to deprec - deployment recipes for capistrano
Thanks for the help Greg, I will do that. But just in case, do you
know if there is a way to just change my global environment PATH
settings to make it work? Or can I change some script inside deprec so
I will not have to do that in the future?

thanks again,

Lance

On Jul 16, 7:00 pm, Greg Pederson <greg.peder...@gmail.com> wrote:
> It might be possible that mongrel or mongrel_cluster gem got installed  
> by gem install vs sudo gem install. This causes the gem not to be in  
> the right load path...
> I had this problem with one version of capstrano in my local user...I  
> had do remove that gem version by hand
>
> Greg Pederson
> Nsight Web Developmentwww.NsightDevelopment.com
>

viatropos

unread,
Jul 17, 2009, 3:08:57 AM7/17/09
to deprec - deployment recipes for capistrano
So I just did 'sudo gem install mongrel' and 'sudo gem install
mongrel_cluster' and am running into the same error. Any ideas?

failed: "sh -c 'sudo -p '\\''sudo password: '\\'' mongrel_rails
cluster::restart --clean -C /etc/mongrel_cluster/sample_app.yml'" on
208.102.218.19

Greg Pederson

unread,
Jul 17, 2009, 11:41:45 AM7/17/09
to deprec...@googlegroups.com
Hi Lance,
I don't remember the exact commands I used to remove the gems  added without sudo, but I do remember that I had to remove them because they seemed to cause some sort of conflict with rubygems.  What happened was that I'd do sudo gem remove <gem> and that would work, but gem list would still show the gem that had been installed without sudo.

As mentioned previously I had a problem with deprec and capistrano.  After I was able to remove all versions from both the locations where sudo gem install and gem install had installed them...and verified that when gem list no longer returned any capistrano or deprec info, I was able to reinstall with sudo gem install and all worked fine.

I'm not saying that's what's going on with your problem, but just an idea.

Are other sudo commands working in your cap deploy?  I'm just curious if the user that being used for sudo mongrel_rails_cluster has sudo permission??  Have you logged into the server and manually tried that command from the server terminal?  If you do that and the command fails you should be able to get a little more info about why the command is failing.


Oh, wait, your below failed error says:
failed: "sh -c 'sudo -p '\\''sudo password: '\\'' mongrel_rails
cluster::restart --clean -C /etc/mongrel_cluster/sample_app.yml'" on 208.102.218.19

sample_app.yml needs to be your app.yml

Greg
--
Greg Pederson
Founder and Technical Director

407-641-0327 office

@gregpederson twitter
Nsight Development, LLC.
www.NsightDevelopment.com

Quis custodiet ipsos custodes

viatropos

unread,
Jul 17, 2009, 2:08:07 PM7/17/09
to deprec - deployment recipes for capistrano
Yeah, when I login to the slice and try "sudo spec" or "sudo mongrel",
those don't work either. I'll try removing everything and starting
from scratch.

viatropos

unread,
Jul 17, 2009, 2:08:29 PM7/17/09
to deprec - deployment recipes for capistrano
even as the root user.

On Jul 17, 8:41 am, Greg Pederson <greg.peder...@gmail.com> wrote:

Greg Pederson

unread,
Jul 17, 2009, 2:25:10 PM7/17/09
to deprec...@googlegroups.com
well, before deleting and restarting maybe just try adding sudo privileges to your user
Log in to your slice as root, or get to root once logged in and do
> adduser <user>
>visudo
and at the end of that file add <user> ALL=(ALL) ALL

This should give your that user sudo abilities.

When I set up a new slice for a client I use http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-1 and http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-2
Of course you can select the setup that matches your OS

And then follow the instructions from http://deprec.failmode.com/documentation/

I just did this same thing last week and the server was up and running with an initial deploy in about 2 hours.

The only variation I did was after
cap deprec:rails:install_stack

I created a git repo on my server and pushed the new app master info to the repo on the server.

Greg

viatropos

unread,
Jul 17, 2009, 2:31:38 PM7/17/09
to deprec - deployment recipes for capistrano
man Greg, thanks for all your help, I really appreciate it.

Those 3 documents are the ones I followed to set up my sample_app, and
I have created a sample user "deploy" who has sudo privileges via
visudo. Still, nothing. There isn't a way to just modify the
environment path variables? That seems strange...

I'm also hosting my project on github and have that info in the
deploy.rb script.

hmm...

On Jul 17, 11:25 am, Greg Pederson <greg.peder...@gmail.com> wrote:
> well, before deleting and restarting maybe just try adding sudo privileges
> to your user
> Log in to your slice as root, or get to root once logged in and do> adduser <user>
> >visudo
>
> and at the end of that file add <user> ALL=(ALL) ALL
>
> This should give your that user sudo abilities.
>
> When I set up a new slice for a client I usehttp://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-1andhttp://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-2
> Of course you can select the setup that matches your OS
>
> And then follow the instructions fromhttp://deprec.failmode.com/documentation/

Greg Pederson

unread,
Jul 17, 2009, 2:43:43 PM7/17/09
to deprec...@googlegroups.com
I'm sure you can create your own ln -s for path stuff, but I think it's probably better to just use the sudo gem install stuff and remove anything that was added with out sudo gem install.
IMHO, that will just eliminate potentially unpredictable behaviors.

I guess getting the user that you have in your deploy.rb file to be able to sudo is your first obstacle.

When I configure a slice and app I change out all the 'sample' stuff to names that I use for that slice/project.

Good luck,
Greg

viatropos

unread,
Jul 17, 2009, 3:20:37 PM7/17/09
to deprec - deployment recipes for capistrano
Here's what everything looks like. I have uninstalled the gems, run
'gem list', made sure there aren't any references to them, reinstalled
using 'sudo gem install ...', but still it doesn't work. If anyone
else has any ideas, please let me know.

ssh ro...@208.102.218.19
root@viatropos:~# mongrel_rails
Usage: mongrel_rails <command> [options]
Available commands are:

- cluster::configure
- cluster::restart
- cluster::start
- cluster::status
- cluster::stop
- restart
- start
- stop
root@viatropos:~# sudo mongrel_rails
sudo: spec: command not found
root@viatropos:~# spec .
root@viatropos:~# sudo spec .
sudo: spec: command not found
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
%sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
deploy ALL=(ALL) ALL

root@viatropos:~# exit
ssh dep...@208.102.218.19
deploy@viatropos:~$ mongrel_rails
Usage: mongrel_rails <command> [options]
Available commands are:

- cluster::configure
- cluster::restart
- cluster::start
- cluster::status
- cluster::stop
- restart
- start
- stop

Each command takes -h as an option to get help.
deploy@viatropos:~$ sudo mongrel_rails
sudo: mongrel_rails: command not found
deploy@viatropos:~$

Thanks,
Lance

Greg Pederson

unread,
Jul 17, 2009, 3:32:17 PM7/17/09
to deprec...@googlegroups.com
sudo monral_rails should be found.  Here is what I get on my server:

nsight ~: mongrel_rails

Usage: mongrel_rails <command> [options]
Available commands are:

 - cluster::configure
 - cluster::restart
 - cluster::start
 - cluster::status
 - cluster::stop
 - restart
 - start
 - stop

Each command takes -h as an option to get help.
nsight ~: sudo mongrel_rails
[sudo] password for gspederson:
Usage: mongrel_rails <command> [options]
Available commands are:

 - cluster::configure
 - cluster::restart
 - cluster::start
 - cluster::status
 - cluster::stop
 - restart
 - start
 - stop

Each command takes -h as an option to get help.

I'm not sure why it doesn't find that command, but it does appear that your sudo works for deploy, otherwise the error would be something about permission/password rather than command not found.

Not sure if this will help, but here is what I get for which and locate:

nsight ~: which mongrel_rails
/usr/local/bin/mongrel_rails
nsight ~: locate mongrel_rails
/usr/bin/mongrel_rails
/usr/local/bin/mongrel_rails
/usr/local/bin/swiftiply_mongrel_rails
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails
/usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/mongrel_rails
/usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/swiftiply_mongrel_rails
nsight ~:


Greg

viatropos

unread,
Jul 17, 2009, 4:01:46 PM7/17/09
to deprec - deployment recipes for capistrano
root@viatropos:~# which mongrel_rails
/opt/ruby-enterprise/bin/mongrel_rails
root@viatropos:~# locate mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/bin/swiftiply_mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
mongrel-1.1.5/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
swiftiply-0.6.1.1/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
swiftiply-0.6.1.1/bin/swiftiply_mongrel_rails
/usr/bin/mongrel_rails

If I 'sudo gem uninstall mongrel' and 'sudo gem uninstall
mongrel_cluster', I still get this:

root@viatropos:~# locate mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/bin/swiftiply_mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
mongrel-1.1.5/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
swiftiply-0.6.1.1/bin/mongrel_rails
/opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/
swiftiply-0.6.1.1/bin/swiftiply_mongrel_rails
/usr/bin/mongrel_rails

I guess its not removing that one? How do I remove that one?
> On Fri, Jul 17, 2009 at 3:20 PM, viatropos <lancejpoll...@gmail.com> wrote:
>
> > Here's what everything looks like.  I have uninstalled the gems, run
> > 'gem list', made sure there aren't any references to them, reinstalled
> > using 'sudo gem install ...', but still it doesn't work.  If anyone
> > else has any ideas, please let me know.
>
> > ssh r...@208.102.218.19
> read more »

Greg Pederson

unread,
Jul 17, 2009, 4:22:25 PM7/17/09
to deprec...@googlegroups.com
Ya, it seems that gems not installed with sudo gem install aren't really manageable/reachable by ruby_gems system.  I can't remember how I removed them, but I did it manually.  I either just rm -rf'd the stuff or found some other command to flush those 'rogue' gems out of the system. 

I'd try googling around for something like 'remove gems not installed with sudo gem install' or some variation.  I know that I found the 'fix' online somewhere.

Greg
Message has been deleted

viatropos

unread,
Jul 20, 2009, 1:42:15 AM7/20/09
to deprec - deployment recipes for capistrano
Still nothing... Maybe Mike knows? Mike do you know a workaround for
this?
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages