Hi,

ssh exits because it wants to read the password from /dev/tty, but there is
no working /dev/tty. The problem was not related to ignored signals.
In the first call (haresources config), /dev/tty is available, allowing for
a successful connect.

Workaround:    screen -L -D -m <expect_cmd>

Now screen provides the /dev/tty to expect and ssh, ssh can read the
password, and I later grab the session output from the file "screenlog.0".

x=`${SCREEN} -L -D -m ${EXPECT} -c "set timeout 120;
spawn -noecho ${SSH_COMMAND} ${ipaddr} ${cmd};
match_max 100000;
expect password: { send -- ${passwd}\r;
                   interact timeout 10 return -output \\$spawn_id; }
"; cat screenlog.0`


Not very elegant, but it works.

Best regards
Matthias



--On Friday, May 21, 2010 18:50:10 +0200 Matthias Ferdinand <[email protected]>
wrote:

> Hi,
> 
> trying to use iLO1 (only accessible via ssh/password) for stonith.
> Modifying the external/ipmi and external/ssh stonith plugins, I tried to
> script the password dialogue using expect. It works from the command line,
> but not when invoked via crm or heartbeat.
> 
> Server is running Ubuntu 10.04, heartbeat 3.0.3, using haresources. I also
> checked on a VM-based test cluster with a CRM configuration (login then
> goes to the other node, not an iLO card) with the same result: ok from 
> cmd line, not ok from crm. This time it's not just haresources to blame
> :-)
> 
> Using the haresources configuration, the script does succeed, but only
> once. On startup, heartbeat calls it twice in short succession. The first
> invocation always succeeeds, but any later invocation will fail. Using
> CRM, no invocation ever succeeds.
> 
> ssh with pubkey authentication (no need for expect then) does not have
> this problem, so I think it must have to do with expect or my very
> limited expect knowledge.
> 
> One difference I found between successful and failing invocations are
> ignored signals. Among other things, the script logs output from
> /proc/self/status.
> 
> haresources, first call:     SigIgn:        0000000000000000
> haresources, later calls:    SigIgn:        0000000000301002
> CRM, all calls:              SigIgn:        0000000000003003
> 
> Ignoring SIGINT(2) and SIGPIPE(13) seems to be common between the failing
> calls from heartbeat and CRM. For testing, I would like to explicitly
> reset this SigIgn mask to all zeroes, but I don't know how.
> 
> Now my questions:
>  - is expect (or ssh using prompt) affected by SigIgn at all?
>  - how can I un-ignore signals that are currently ignored?
>  - why should signals be ignored in stonith invocations anyway?
> 
> More script details below.
> Thank you for any help or recommendations.
> 
> Best regards
> Matthias

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to