# Can't understand output

**URL:** <https://forum.ansible.com/t/cant-understand-output/16961>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [December 4, 2014, 4:37pm UTC](https://forum.ansible.com/t/cant-understand-output/16961 "2014-12-04T16:37:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Letskiy](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@Paul\_Letskiy](https://forum.ansible.com/u/Paul_Letskiy)\
**Post date:** [December 4, 2014, 4:37pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/1 "2014-12-04T16:37:08Z")

</div>

Hello,

I’m trying Ansible without playbooks. Just oneliner from console. Want to do ‘apt-get update’ on remote server.

Here is ansible.cfg:

[defaults]  
remote\_port = 2224  
remote\_user = che  
sudo\_user = che

Here is command:

> ansible [my.domain.com](http://my.domain.com) -vvvv -S -m apt -a update\_cache=yes

Che in sudo users on [my.domain.com](http://my.domain.com) machine and can perform commands without password.

Here is command output:

\<[my.domain.com](http://my.domain.com)\> ESTABLISH CONNECTION FOR USER: che  
\<[my.domain.com](http://my.domain.com)\> REMOTE\_MODULE apt update\_cache=yes  
\<[my.domain.com](http://my.domain.com)\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/che/.ansible/cp/ansible- ssh-%h-%p-%r” -o Port=2224 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased ,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 [my.domain.com](http://my.domain.com) /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1 417710259.52-145934245462641 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417710259.52-145934245462641 && echo $HOME/.ansible/t mp/ansible-tmp-1417710259.52-145934245462641’  
\<[my.domain.com](http://my.domain.com)\> PUT /var/folders/5t/3h0pmhsj0m1\_ry0kdwq9jg5h0000gn/T/tmpF2t29z TO /home/che/.ansible/tmp/ansible-tmp-1417710259. 52-145934245462641/apt  
\<[my.domain.com](http://my.domain.com)\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/che/.ansible/cp/ansible- ssh-%h-%p-%r” -o Port=2224 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased ,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 [my.domain.com](http://my.domain.com) /bin/sh -c ‘su root -c “/bin/sh -c '”’“‘echo SUDO-SUC CESS-mtfrixxottefdaxagqopjyeswrarmlxn; LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /home/che/.ansible/tmp/ansible-tmp- 1417710259.52-145934245462641/apt; rm -rf /home/che/.ansible/tmp/ansible-tmp-1417710259.52-145934245462641/ \>/dev/null 2\>&1’”‘"’ "’

And just get stuck. Is it normal, or I must find where is a problem?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [December 4, 2014, 6:10pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/2 "2014-12-04T18:10:30Z")

</div>

Hi Paul,

Looking at your options you’ve not specified any action for apt to take beyond updating the cache (the only -a option you show is “update\_cache=yes”), which itself should be an error. I believe you want to add “upgrade=safe”, so please let us know if it still hangs after adding that.

---

<div class="post-metadata">

**Author:** ![Paul\_Letskiy](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@Paul\_Letskiy](https://forum.ansible.com/u/Paul_Letskiy)\
**Post date:** [December 4, 2014, 7:00pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/3 "2014-12-04T19:00:02Z")

</div>

Thank you for your answer!

Looks like sudo problems:

“msg”: “‘/usr/bin/aptitude safe-upgrade’ failed: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)\nE: Unable to lock the administration directory (/var/lib/dpkg/), are you root?\n”,

But my user is sudo user with NOPASSWD. And I can do “apt-get update” or “apt-get safe-upgrade” on server without any problems.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [December 4, 2014, 7:08pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/4 "2014-12-04T19:08:50Z")

</div>

I see you’re using “-S”, which is --su. You will want to use -s or --sudo instead.

---

<div class="post-metadata">

**Author:** ![Paul\_Letskiy](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@Paul\_Letskiy](https://forum.ansible.com/u/Paul_Letskiy)\
**Post date:** [December 4, 2014, 7:13pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/5 "2014-12-04T19:13:04Z")

</div>

Sorry, it’s old command. I’ve tried -s already. Same thing.

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [December 4, 2014, 8:33pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/6 "2014-12-04T20:33:08Z")

</div>

from your first email I see that you have:

sudo\_user = che

in your defaults file. That’s likely the source of this portion of the issue. sudo\_user means “the user that you want to sudo to”. So you want it to be root (which is the default so you should be fine if you just get rid of that line).

You were probably thinking that you needed to specify the user to sudo from. In ansible the user that you sudo from is the user that ansible is ssh’ing into the box as. In your defaults you’re setting remote\_user=che so that’s the user that will be sudo’d from.

-Toshio

---

<div class="post-metadata">

**Author:** ![Paul\_Letskiy](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@Paul\_Letskiy](https://forum.ansible.com/u/Paul_Letskiy)\
**Post date:** [December 4, 2014, 8:58pm UTC](https://forum.ansible.com/t/cant-understand-output/16961/7 "2014-12-04T20:58:01Z")

</div>

I just found it too :))  
Thank you, Toshio, anyway!
