fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] err: bash: sudo: command not found


From: Ruslan Spivak
Subject: Re: [Fab-user] err: bash: sudo: command not found
Date: Thu, 17 Dec 2009 22:31:47 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

Jeff Forcier <address@hidden> writes:

> Hi Ruslan,

Hi Jeff,

>
> On Thu, Dec 17, 2009 at 7:12 PM, Ruslan Spivak <address@hidden> wrote:
>
>> When I add a different user to ~/.fabricrc:
>> user = testuser
>>
>> $ fab test
>> fails with
>> --------------------------------------------------------------------
>> ...
>> [testdev] sudo: dpkg -i testpackage.deb
>> [testdev] err: bash: sudo: command not found
>>
>> Fatal error: sudo() encountered an error (return code 127) while executing
>> 'dpkg -i testpackage.deb'
>
> First, thanks for the thorough debugging efforts, it's greatly appreciated!
>
> I can't think of any obvious causes for this offhand given what you've
> already eliminated, so here's a few more things to try/check out,
> though they're long shots:
>
> * Give the --show=debug flag, to see the exact command string Fabric
> is sending down the line, in case there's something extra or incorrect
> being added (this will modify the "[host] sudo:" output to include the
> literal string being sent across)
> * Try aping what Fabric is doing by manually issuing "ssh testdev
> <full command including /bin/bash -l -c <etc>>" from a local shell, in
> case it's somehow related to ssh versus local shell invocation;

Thanks a lot for pointing out --show=debug flag, a very useful one.

My problem is solved now. Here is a description of what happened.

Following your advice on ssh versus local shell invocation
I tried the following commands:

1) logged into 'testdev' with ssh address@hidden
   and ran the same command as Fabric sent to the remote host:
   $ sudo -S -p 'sudo password:'  /bin/bash -l -c 'dpkg -i testpackage.deb'

   Worked fine.

2) Then from my local host I ran:
   $ ssh address@hidden "type -a sudo"
   Password:
   bash: line 0: type: sudo: not found


That was the problem and I remembered that when invoking
a command on a remote host through SSH only ~/.bashrc is executed.

So I checked both ~/.bash_profile and ~/.bashrc of 'testuser' and
they were different -  ~/.bash_profile set PATH to contain
system directory which in turn contained 'sudo' binary and at the 
same time ~/.bashrc file was empty.

So the problem was fixed by setting PATH in ~/.bashrc file.

Once again thanks for your suggestions.
Now I know more about Fabric and love it even more :)


Ruslan
-- 
Those who make the worst use of their time are the first to complain of its 
shortness
      -- Jean de la Bruyere




reply via email to

[Prev in Thread] Current Thread [Next in Thread]