... I just had the same problem and it turned out I had a path set in 
/etc/environment on that host that didn't include /sbin. Once I added the 
path there, the apt module worked fine again.

On Monday, May 4, 2015 at 11:13:09 PM UTC+10, Alex Peters wrote:
>
> I'm trying to install a package on a system running a Debian Jessie-based 
> distribution called OSMC <https://osmc.tv/>.
>
> This task (run with ansible_sudo == true):
>
> - name: ensure Vim is installed
>   apt: name=vim state=present
>
>
> causes this to happen:
>
> TASK: [vim | ensure Vim is installed] 
> ***************************************** 
> failed: [XXX] => {"failed": true}
> stderr: E: Sub-process /usr/bin/dpkg returned an error code (2)
>
> stdout: Reading package lists...
> ...
> dpkg: warning: 'ldconfig' not found in PATH or not executable
> dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
> dpkg: error: 2 expected programs not found in PATH or not executable
> Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and 
> /sbin
>
> msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o 
> "Dpkg::Options::=--force-confold"   install 'vim'' failed: E: Sub-process 
> /usr/bin/dpkg returned an error code (2)
>
>
> It seems that something is mangling the PATH before apt-get is called, 
> because if I SSH manually into this system:
>
> $ which ldconfig start-stop-daemon
> /sbin/ldconfig
> /sbin/start-stop-daemon
> $ echo $PATH
>
> /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
> $ sudo sh -c 'echo $PATH'
>
> /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
>
>
> the PATH is correct and I have no problem installing the package manually.
>
> What can I do to improve this situation?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4456bca7-8777-471a-8b20-146105fdf267%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to