su works on Debian Lenny but not on Debian Wheezy

I have a strange problem with new wheezy machines

on lenny ist works

ansible backuppc -a ’ whoami’ -u seidenberg --su -k --ask-su-pass -vvvv
SSH password:
su password:
ESTABLISH CONNECTION FOR USER: seidenberg
REMOTE_MODULE command whoami
EXEC [‘sshpass’, ‘-d6’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=seidenberg’, ‘-o’, ‘ConnectTimeout=10’, ‘backuppc’, “/bin/bash -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621 && echo $HOME/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621’”]
PUT /tmp/tmpnf8Bgw TO /home/seidenberg/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621/command
EXEC [‘sshpass’, ‘-d6’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=seidenberg’, ‘-o’, ‘ConnectTimeout=10’, ‘backuppc’, u’/bin/sh -c 'su root -c “/bin/bash -c '”'“'echo SUDO-SUCCESS-fjzbciovcdglcnwocbbsllvqypcuhcrb; LC_CTYPE=C LANG=C /usr/bin/python /home/seidenberg/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621/command; rm -rf /home/seidenberg/.ansible/tmp/ansible-tmp-1403175163.97-279315252950621/ >/dev/null 2>&1'”'“'”'']
backuppc | success | rc=0 >>
root

on wheezy it hangs for a long time

ansible seidenberg1 -a ’ whoami’ -u seidenberg --su -k --ask-su-pass -vvvv
SSH password:
su password:
ESTABLISH CONNECTION FOR USER: seidenberg
REMOTE_MODULE command whoami
EXEC [‘sshpass’, ‘-d6’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=seidenberg’, ‘-o’, ‘ConnectTimeout=10’, ‘seidenberg1’, “/bin/bash -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768 && echo $HOME/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768’”]
PUT /tmp/tmpKbeTEM TO /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/command
EXEC [‘sshpass’, ‘-d6’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=seidenberg’, ‘-o’, ‘ConnectTimeout=10’, ‘seidenberg1’, u’/bin/sh -c 'su root -c “/bin/bash -c '”'“'echo SUDO-SUCCESS-piguunfptuenxfyxauqmavtunfzjnayk; LC_CTYPE=C LANG=C /usr/bin/python /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/command; rm -rf /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/ >/dev/null 2>&1'”'“'”'']

after ctrl c

^CTraceback (most recent call last):
File “/usr/local/bin/ansible”, line 5, in
pkg_resources.run_script(‘ansible==1.7’, ‘ansible’)
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 1235, in run_script
execfile(script_filename, namespace, namespace)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/EGG-INFO/scripts/ansible”, line 221, in
(runner, results) = cli.run(options, args)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/EGG-INFO/scripts/ansible”, line 195, in run
results = runner.run()
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 1246, in run
results = [ self._executor(h, None) for h in hosts ]
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 543, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 645, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 839, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/action_plugins/normal.py”, line 57, in run
return self.runner._execute_module(conn, tmp, module_name, module_args, inject=inject, complex_args=complex_args)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 506, in _execute_module
res = self._low_level_exec_command(conn, cmd, tmp, su=True, in_data=in_data)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 974, in _low_level_exec_command
in_data=in_data)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/ssh.py”, line 341, in exec_command
stdout = p.communicate()
File “/usr/lib/python2.7/subprocess.py”, line 754, in communicate
return self._communicate(input)
File “/usr/lib/python2.7/subprocess.py”, line 1322, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File “/usr/lib/python2.7/subprocess.py”, line 1376, in _communicate_with_poll
ready = poller.poll()
KeyboardInterrupt

please can you explain how to debug the wheezy problem

regards
Holger

It seems like it’s waiting for the password prompt, due to the format of the prompt not matching what we’re expecting. Could you execute the command via su on the system and report back what the password prompt is? We can open an issue for this as well and get the regex updated so it will match the password prompt going forward.

Ok the command via su on Lenny

seidenberg@backupPC:~$ su root -c /bin/bash -c echo SUDO-SUCCESS-piguunfptuenxfyxauqmavtunfzjnayk; LC_CTYPE=C LANG=C /usr/bin/python /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/command
Password:

and the command on wheezy

seidenberg@seidenberg1:~$ su root -c /bin/bash -c echo SUDO-SUCCESS-piguunfptuenxfyxauqmavtunfzjnayk; LC_CTYPE=C LANG=C /usr/bin/python /home/seidenberg/.ansible/tmp/ansible-tmp-1403175187.6-175350529956768/command
Password:

Interesting, no obvious difference there.

ok what else can i do to investigate the problem ?