[wpkg-users] winexe and EPOLL_CTL_ADD error
Malte Starostik
malte at malte.homeip.net
Tue Mar 15 20:11:37 CET 2011
Am Dienstag, 15. März 2011, 18:53:30 schrieb Maurizio Marini Gmail:
> i can run winexe interactively without any problem and then i can exec
> wpkg.js, but as i run it into a shell script as this one:
> http://wpkg.org/WPKG_with_winexe
> i get tevent: EPOLL_CTL_ADD failed (Operation not permitted) - falling
> back to select()
>
> this is a very small script that runs winexe:
> cat lancia.sh
> #! /bin/bash -xv
> /usr/local/bin/winexe -U "DOMAIN\Administrator%password"
> //192.168.20.50 cmd.exe <<EOF
> exit
> EOF
> if i run it by shell:
> tevent: EPOLL_CTL_ADD failed (Operation not permitted) - falling back
> to select()
>
>
> Aborting...
For whatever (annoying) reason, winexe doesn't work with a pipe on stdin
(maybe also stdout, sorry, I'm writing this from memory now). In your case,
the here document causes the shell to use such a pipe. I run into this time
and again when trying to do things like
command_that_outputs_a_list_of_hostnames | \
while read host; do
winexe //$host ...;
done
This similar loop works:
for host in $(command_that...); do \
winexe //$host ...; \
done
But the former version is nicer when command_that_... is something complex.
Redirecting winexe's stdin/out from/to a tty solves the problem. To feed
input into whatever you run on the remote machine, you'd need to allocate a
pty somehow and get your input through it. I guess socat (http://www.dest-
unreach.org/socat/) can help you with this.
A simpler alternative might be to get your input onto the target machine e.g.
by dynamically creating a .cmd file and upload it via the admin$ share and
then just execute that .cmd file, leaving stdin/out alone. I never tried to
use winexe from a cron job or a similar call site, but in that case - no tty -
you could possibly get away with explicitly redirecting from/to *any* tty you
have permission to access. Again, socat comes to mind.
>
> if i run it interactively:
>
> 17:11:20 root at fisico: ~/scripts # /usr/local/bin/winexe -U
> "DOMAIN\Administrator%password" //192.168.20.50 cmd.exe
> Microsoft Windows XP [Versione 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\WINDOWS\system32>
In this case, winexe's stdin/out are connected to a tty.
> I think that this is something analogue to this link:
> http://fixunix.com/samba/192081-re-samba-4-can-smbd-run-non-interactively.h
> tml
FWIW, I don't really think it's related apart from a similar error message,
but I'm too lazy right now to check what the fix is about.
Good luck,
Malte
More information about the wpkg-users
mailing list