Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

md5sum command fails unusually with -K #5800

Closed
phy1729 opened this issue Jan 28, 2014 · 12 comments
Closed

md5sum command fails unusually with -K #5800

phy1729 opened this issue Jan 28, 2014 · 12 comments
Labels
bug This issue/PR relates to a bug.

Comments

@phy1729
Copy link
Contributor

phy1729 commented Jan 28, 2014

"ansible-playbook -i inventory lugbox.yml -CK" gives multiple warnings that md5sum failed unusually; however "ansible-playbook -i inventory lugbox.yml -C" does not. The remote box (lugbox) is Arch Linux. The error is on every copy command.

Playbooks are at https://github.com/utdlug/lug-config using 518ade2

% ansible --version
ansible 1.5 (devel 1584d8f) last updated 2014/01/28 10:03:38 (GMT -500)

-vvvv stdout with -C: https://gist.github.com/1cfea9a4539afd0af127
-vvvv stdout with -CK: https://gist.github.com/4504cb4f07df56ca4b76

warning: md5sum command failed unusually, please report this to the list so it can be fixed
command: [u'(/usr/bin/md5sum /etc/dhcpd.conf 2>/dev/null)', u'(/sbin/md5sum -q /etc/dhcpd.conf 2>/dev/null)', u'(/usr/bin/digest -a md5 /etc/dhcpd.conf 2>/dev/null)', u'(/sbin/md5 -q /etc/dhcpd.conf 2>/dev/null)', u'(/usr/bin/md5 -n /etc/dhcpd.conf 2>/dev/null)', u'(/bin/md5 -q /etc/dhcpd.conf 2>/dev/null)', u'(/usr/bin/csum -h MD5 /etc/dhcpd.conf 2>/dev/null)']
----
output: {'stdout': '', 'stderr': 'debug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to lugbox.utdallas.edu closed.\r\n', 'rc': 0}
----
changed: [lugbox] => {"changed": true, "item": ""}
@jctanner
Copy link
Contributor

@phy1729 can you please point out the exact lines in the second output which contain the problem.

@phy1729
Copy link
Contributor Author

phy1729 commented Jan 31, 2014

I'd had redirected the output but not stderr so I could see the sudo prompt. Here's just a copy paste from the terminal https://gist.github.com/phy1729/8739115 The first warning is at line 34.

@jctanner
Copy link
Contributor

@phy1729 please "vagrant ssh" to the host, "sudo su -" and then run these two commands:

[ -r "/etc/dhcpd.conf" ] || rc=2; [ -f "/etc/dhcpd.conf" ] || rc=1; [ -d "/etc/dhcpd.conf" ] && rc=3; (/usr/bin/md5sum /etc/dhcpd.conf 2>/dev/null) || (/sbin/md5sum -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/digest -a md5 /etc/dhcpd.conf 2>/dev/null) || (/sbin/md5 -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/md5 -n /etc/dhcpd.conf 2>/dev/null) || (/bin/md5 -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/csum -h MD5 /etc/dhcpd.conf 2>/dev/null) || (echo "${rc}  /etc/dhcpd.conf")

echo $?

I would like to see the full output.

@phy1729
Copy link
Contributor Author

phy1729 commented Jan 31, 2014

It's a actual server not a vagrant box.

$ sudo su -
A student asked the master for help... does this program run from the
Workbench? The master grabbed the mouse and pointed to an icon. "What is
this?" he asked. The student replied "That's the mouse". The master pressed
control-Amiga-Amiga and hit the student on the head with the Amiga ROM Kernel
Manual.
-- Amiga Zen Master Peter da Silva
20:03 root@lugbox ~>[ -r "/etc/dhcpd.conf" ] || rc=2; [ -f "/etc/dhcpd.conf" ] || rc=1; [ -d "/etc/dhcpd.conf" ] && rc=3; (/usr/bin/md5sum /etc/dhcpd.conf 2>/dev/null) || (/sbin/md5sum -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/digest -a md5 /etc/dhcpd.conf 2>/dev/null) || (/sbin/md5 -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/md5 -n /etc/dhcpd.conf 2>/dev/null) || (/bin/md5 -q /etc/dhcpd.conf 2>/dev/null) || (/usr/bin/csum -h MD5 /etc/dhcpd.conf 2>/dev/null) || (echo "${rc}  /etc/dhcpd.conf")
848eddf973dcff029db1160b2f3ba03d  /etc/dhcpd.conf
20:03 root@lugbox ~>echo $?
0

The quote changes each time.

@jctanner
Copy link
Contributor

@phy1729 so the md5sum is different? Can you run it a few times and show me the variations?

@phy1729
Copy link
Contributor Author

phy1729 commented Feb 1, 2014

The hash is always the same. The quote after the sudo command changes.

I also realized that sudo is setup to be passwordless.

@jctanner
Copy link
Contributor

jctanner commented Feb 3, 2014

@phy1729 what connection mode are you using? (ssh/paramiko/smart)

What OS/version is the control machine?

What version of openssh is on the control machine?

@phy1729
Copy link
Contributor Author

phy1729 commented Feb 3, 2014

ssh
OSX 10.7.5
OpenSSH_5.6p1, OpenSSL 0.9.8y 5 Feb 2013

@ludovicc
Copy link

I've got the same issue, I'm using a paramiko connection to a ScientificLinux 6.4 server from Ubuntu 13.10

@youam
Copy link
Contributor

youam commented Feb 26, 2014

I think I've found the bug. When ansible is called with --ask-sudo-pass, it runs on the remote like this:

sudo -k && sudo -H -S -p "[sudo via ansible, key=SOME_HASH_CANARY] password: " -u root /bin/sh -c "echo SUDO-SUCCESS_SOME_OTHER_CANARY; /usr/bin/python [...]"

Now, when sudo is configured to run passwordless, but ansible runs with --ask-sudo-pass, it expects sudo to ask for a password and expects sudo to actually show that prompt. sudo doens't do that, the output isn't what ansible expects, hence the warning

@jimi-c
Copy link
Member

jimi-c commented Feb 28, 2014

So as far as I can tell, this is not an error, but instead is happening because the SSH connection to the host is failing. The _remote_md5() function doesn't check the return code from the execution of the SSH connection to run the md5sum commands, and just tries to parse the data that is returned (which is an empty string because of the error). Oddly, in the original output, the rc=0 (when I reproduced this, it was 255).

Probably the best solution would be to detect an empty stdout from the execution of the md5sum commands and return "INVALIDMD5SUM" in that case. I think this is the course I'm going to take for now.

@jimi-c jimi-c closed this as completed in 7964553 Feb 28, 2014
@jimi-c
Copy link
Member

jimi-c commented Feb 28, 2014

This should now be resolved in the devel branch. Please let me know if you continue to have problems with this issue. Thanks!

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

7 participants