rsh <hostname> -n -l <user> <command> hangs on Solaris 8

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by jbha.. » Wed, 13 Apr 2005 23:22:15



Hello Everybody,

    Can anyone help figuring out what the problem could be in executing
the following command on a Solaris 8 box (SunOS <hostname> 5.8
Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V240):

Thanks in advance for any help,
jbhamra

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# truss rsh <hostname> -n -l root su - sybase -c "/bin/csh -c \"exec
/usr/sybase/ASE-12_0/install/startserver -f
/usr/sybase/ASE-12_0/install/RUN_SYBASE >/dev/null\""
execve("/usr/bin/rsh", 0xFFBEFA94, 0xFFBEFAC0)  argc = 10
resolvepath("/usr/lib/ld.so.1", "/usr/lib/ld.so.1", 1023) = 16
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
stat("/usr/lib/libsocket.so.1", 0xFFBEF3B8)     = 0
open("/usr/lib/libsocket.so.1", O_RDONLY)       = 3
mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0xFF390000
mmap(0x00000000, 114688, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF370000
mmap(0xFF370000, 40558, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF370000
mmap(0xFF38A000, 4365, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 40960) = 0xFF38A000
munmap(0xFF37A000, 65536)                       = 0
memcntl(0xFF370000, 14496, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
stat("/usr/lib/libnsl.so.1", 0xFFBEF3B8)        = 0
open("/usr/lib/libnsl.so.1", O_RDONLY)          = 3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
mmap(0x00000000, 712704, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF280000
mmap(0xFF280000, 580118, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF280000
mmap(0xFF31E000, 33184, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 581632) = 0xFF31E000
mmap(0xFF328000, 23240, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFF328000
munmap(0xFF30E000, 65536)                       = 0
memcntl(0xFF280000, 83788, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
stat("/usr/lib/libsec.so.1", 0xFFBEF3B8)        = 0
open("/usr/lib/libsec.so.1", O_RDONLY)          = 3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
mmap(0x00000000, 90112, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF350000
mmap(0xFF350000, 8635, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF350000
mmap(0xFF364000, 906, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 16384) = 0xFF364000
munmap(0xFF354000, 65536)                       = 0
memcntl(0xFF350000, 2936, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
stat("/usr/lib/libc.so.1", 0xFFBEF3B8)          = 0
open("/usr/lib/libc.so.1", O_RDONLY)            = 3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
mmap(0x00000000, 802816, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF180000
mmap(0xFF180000, 702456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF180000
mmap(0xFF23C000, 24772, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 704512) = 0xFF23C000
munmap(0xFF22C000, 65536)                       = 0
memcntl(0xFF180000, 113528, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
stat("/usr/lib/libdl.so.1", 0xFFBEF3B8)         = 0
open("/usr/lib/libdl.so.1", O_RDONLY)           = 3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
mmap(0x00000000, 8192, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF340000
mmap(0xFF340000, 2302, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF340000
mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF270000
close(3)                                        = 0
stat("/usr/lib/libmp.so.2", 0xFFBEF3B8)         = 0
open("/usr/lib/libmp.so.2", O_RDONLY)           = 3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
mmap(0x00000000, 90112, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF250000
mmap(0xFF250000, 11316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF250000
mmap(0xFF264000, 865, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 16384) = 0xFF264000
munmap(0xFF254000, 65536)                       = 0
memcntl(0xFF250000, 3124, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(3)                                        = 0
stat("/usr/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1", 0xFFBEF1A0)
= 0
open("/usr/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1", O_RDONLY) =
3
mmap(0xFF390000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
0) = 0xFF390000
close(3)                                        = 0
brk(0x00021FA8)                                 = 0
brk(0x00023FA8)                                 = 0
close(0)                                        = 0
open("/dev/null", O_RDONLY)                     = 0
getuid()                                        = 0 [0]
open64("/etc/.name_service_door", O_RDONLY)     = 3
fcntl(3, F_SETFD, 0x00000001)                   = 0
door_info(3, 0xFF242748)                        = 0
door_call(3, 0xFFBEEF60)                        = 0
open("/etc/netconfig", O_RDONLY|O_LARGEFILE)    = 4
fcntl(4, F_DUPFD, 0x00000100)                   Err#22 EINVAL
read(4, " # p r a g m a   i d e n".., 1024)     = 1024
read(4, " t s           t p i _ c".., 1024)     = 215
read(4, 0x000236C0, 1024)                       = 0
lseek(4, 0, SEEK_SET)                           = 0
read(4, " # p r a g m a   i d e n".., 1024)     = 1024
brk(0x00023FA8)                                 = 0
brk(0x00025FA8)                                 = 0
read(4, " t s           t p i _ c".., 1024)     = 215
read(4, 0x000236C0, 1024)                       = 0
close(4)                                        = 0
open("/dev/udp", O_RDONLY)                      = 4
ioctl(4, 0xC00C6982, 0xFFBEF2DC)                = 0
close(4)                                        = 0
open("/etc/nsswitch.conf", O_RDONLY)            = 4
fcntl(4, F_DUPFD, 0x00000100)                   Err#22 EINVAL
read(4, " #\n #   / e t c / n s s".., 1024)     = 1024
read(4, " F O U N D = r e t u r n".., 1024)     = 422
read(4, 0x00024158, 1024)                       = 0
close(4)                                        = 0
stat("/usr/lib/nss_files.so.1", 0xFFBEECB8)     = 0
open("/usr/lib/nss_files.so.1", O_RDONLY)       = 4
mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) =
0xFF170000
mmap(0x00000000, 98304, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
-1, 0) = 0xFF150000
mmap(0xFF150000, 19978, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4,
0) = 0xFF150000
mmap(0xFF166000, 1760, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 4, 24576) = 0xFF166000
munmap(0xFF156000, 65536)                       = 0
memcntl(0xFF150000, 6884, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
close(4)                                        = 0
munmap(0xFF170000, 8192)                        = 0
open("/etc/services", O_RDONLY|O_LARGEFILE)     = 4
fcntl(4, F_DUPFD, 0x00000100)                   Err#22 EINVAL
read(4, " # i d e n t\t " @ ( # )".., 1024)     = 1024
read(4, " e i g h t   D i r e c t".., 1024)     = 1024
read(4, "     s l p              ".., 1024)     = 1024
close(4)                                        = 0
getpid()                                        = 6179 [6178]
brk(0x00025FA8)                                 = 0
brk(0x00027FA8)                                 = 0
open("/dev/udp", O_RDONLY)                      = 4
ioctl(4, 0xC00C6982, 0xFFBEF014)                = 0
ioctl(4, 0xC00C6982, 0xFFBEF014)                = 0
door_info(3, 0xFFBECE50)                        = 0
door_call(3, 0xFFBECE38)                        = 0
sigaction(SIGPIPE, 0xFFBEF408, 0xFFBEF3E8)      = 0
sigfillset(0xFF2428D0)                          = 0
sigprocmask(SIG_BLOCK, 0xFFBEF3D8, 0xFFBEF3C8)  = 0
so_socket(26, 2, 0, "", 1)                      = 5
setsockopt(5, 6, 33, 0xFFBEEF3C, 4, 1)          = 0
setsockopt(5, 6, 32, 0xFFBEEF3C, 4, 1)          = 0
bind(5, 0xFFBEEFA0, 32, 3)                      = 0
getsockname(5, 0xFFBEEFA0, 0xFFBEEF34, 1)       = 0
setsockopt(5, 6, 32, 0xFFBEEF38, 4, 1)          = 0
setsockopt(5, 6, 33, 0xFFBEEF38, 4, 1)          = 0
ioctl(5, FIOSETOWN, 0xFFBEF09C)                 = 0
connect(5, 0xFFBEF2C8, 32, 1)                   = 0
so_socket(26, 2, 0, "", 1)                      = 6
setsockopt(6, 6, 33, 0xFFBEEF3C, 4, 1)          = 0
setsockopt(6, 6, 32, 0xFFBEEF3C, 4, 1)          = 0
bind(6, 0xFFBEEFA0, 32, 3)                      = 0
getsockname(6, 0xFFBEEFA0, 0xFFBEEF34, 1)       = 0
setsockopt(6, 6, 32, 0xFFBEEF38, 4, 1)          = 0
setsockopt(6, 6, 33, 0xFFBEEF38, 4, 1)          = 0
listen(6, 1, 1)                                 = 0
write(5, " 8 2 6\0", 4)                         = 4
poll(0xFFBED080, 2, -1)                         = 1
accept(6, 0xFFBEF108, 0xFFBEF2C4, 1)            = 7
close(6)                                        = 0
write(5, " r o o t\0", 5)                       = 5
write(5, " r o o t\0", 5)                       = 5
write(5, " s u   -   s y b a s e  ".., 129)     = 129
read(5, "\0", 1)                                = 1
sigaction(SIGPIPE, 0xFFBEF3E8, 0x00000000)      = 0
sigprocmask(SIG_SETMASK, 0xFFBEF3C8, 0x00000000) = 0
getuid()                                        = 0 [0]
setuid(0)                                       = 0
sigprocmask(0, 0x00000000, 0xFFBEF420)          = 0
sigprocmask(SIG_BLOCK, 0xFFBEF420, 0xFFBEF410)  = 0
sigaction(SIGINT, 0xFFBEF350, 0xFFBEF3F0)       = 0
sigprocmask(SIG_UNBLOCK, 0xFFBEF420, 0xFFBEF410) = 0
sigaction(SIGINT, 0xFFBEF350, 0xFFBEF3F0)       = 0
sigprocmask(SIG_UNBLOCK, 0xFFBEF420, 0xFFBEF410) = 0
sigaction(SIGQUIT, 0xFFBEF350, 0xFFBEF3F0)      = 0
sigprocmask(SIG_UNBLOCK, 0xFFBEF420, 0xFFBEF410) = 0
sigaction(SIGQUIT, 0xFFBEF350, 0xFFBEF3F0)      = 0
sigprocmask(SIG_UNBLOCK, 0xFFBEF420, 0xFFBEF410) = 0 ...

read more »

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by tkev.. » Thu, 14 Apr 2005 00:51:22


Quote:> # truss rsh <hostname> -n -l root su - sybase -c "/bin/csh -c \"exec

There's probably something in the c-shell startup files that's looking
for interaction or for a terminal.

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by Robert Lawhea » Thu, 14 Apr 2005 01:16:12


Some suggestions to help understand the problem:

   - try using "truss -fa -texec ..." on the local host to
     minimize extraneous output, and see just what args are passed.

   - on the remote system, "truss -fa -texec -p `pgrep inetd|head -1`
     while attempting the rsh, to see what args actually are passed
     to commands started on the remote host.

I suspect that you've not redirected stdin from /dev/null on the local
host, and not dealt with stdout/strerr for the remote rsh.

xrsh (available from various sources, including:
     http://http.us.debian.org/debian/pool/main/x/xrsh/xrsh_5.92.orig.tar.gz
provided a good example of how to do this kind of thing.

- Bob


> Hello Everybody,

>     Can anyone help figuring out what the problem could be in executing
> the following command on a Solaris 8 box (SunOS <hostname> 5.8
> Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V240):

> Thanks in advance for any help,
> jbhamra

.
.
 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by jbha.. » Thu, 14 Apr 2005 01:17:46


I tried executing from root and it goes thro' fine:

# su - sybase -c "/bin/csh -c \"exec
/usr/sybase/ASE-12_0/install/startserver -f
/usr/sybase/ASE-12_0/install/RUN_SYBASE >/dev/null\""
Sun Microsystems Inc.   SunOS 5.8       Generic Patch   December 2002

# ps -ef | grep dataserver
    root  8846  8655  0 21:38:54 pts/2    0:00 grep dataserver
  sybase  8845  8844  4 21:38:45 ?        0:02
/usr/sybase/ASE-12_0/bin/dataserver -d/var/sybase/db/sybmaster.dat
-e/usr/sybas
#

. . . but when try executing thro' rsh it hangs

# rsh pun-sms-sun11 -n -l root su - sybase -c "/bin/csh -c \"exec
/usr/sybase/ASE-12_0/install/startserver -f
/usr/sybase/ASE-12_0/install/RUN_SYBASE >/dev/null\""
Sun Microsystems Inc.   SunOS 5.8       Generic Patch   December 2002

< command prompt doesn't return >

Just wanted to confirm, any bug that got fixed in this direction which
I need to download?

Thanks.


> > # truss rsh <hostname> -n -l root su - sybase -c "/bin/csh -c
\"exec

> There's probably something in the c-shell startup files that's
looking
> for interaction or for a terminal.

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by jbha.. » Thu, 14 Apr 2005 02:03:58


The following worked !

# rsh <hostname> -n -l root su - sybase -c "/bin/csh -c \"exec
/usr/sybase/ASE-12_0/install/startserver -f
/usr/sybase/ASE-12_0/install/RUN_SYBASE </dev/null >& /dev/null\""
</dev/null >/dev/null 2>&1
#

Thanks. Appreciate much for your help!
jbhamra

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by Neil W Ricker » Thu, 14 Apr 2005 03:18:40



>    Can anyone help figuring out what the problem could be in executing
>the following command on a Solaris 8 box (SunOS <hostname> 5.8
>Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V240):

To simplify, you are doing something like

        rsh remote -n csh -c '"exec command > /dev/null"'

What you need (again, in oversimplified form) is

        rsh remote csh -c '"exec command < /dev/null >& /dev/null"'

That is, you need to redirect stdin and stderr to "/dev/null",
not just stdout.

Your rsh process won't terminate until the connection is
closed.  Therefore you must force it closed at the remote
host by redirection all three stdio files.

The "-n" redirects "stdin" at the source site (where you are running
"rsh").  It doesn't redirect at the remote site, and won't do
anything to force the connection to close.

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by Michael Tosc » Thu, 14 Apr 2005 05:30:38




>>   Can anyone help figuring out what the problem could be in executing
>>the following command on a Solaris 8 box (SunOS <hostname> 5.8
>>Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V240):

> To simplify, you are doing something like

>    rsh remote -n csh -c '"exec command > /dev/null"'

> What you need (again, in oversimplified form) is

>    rsh remote csh -c '"exec command < /dev/null >& /dev/null"'

> That is, you need to redirect stdin and stderr to "/dev/null",
> not just stdout.

> Your rsh process won't terminate until the connection is
> closed.  Therefore you must force it closed at the remote
> host by redirection all three stdio files.

> The "-n" redirects "stdin" at the source site (where you are running
> "rsh").  It doesn't redirect at the remote site, and won't do
> anything to force the connection to close.

IMHO -n closes stdin at the source site, which in turn will close stdin at the
remote site and in turn will close stdin in the sub-C-shell.
Assuming implementation is okay, the result should be the same.

So
rsh remote -n csh -c '"exec command >& /dev/null"'
should work as well.

--

 
 
 

rsh <hostname> -n -l <user> <command> hangs on Solaris 8

Post by Neil W Ricker » Thu, 14 Apr 2005 07:30:33




>> The "-n" redirects "stdin" at the source site (where you are running
>> "rsh").  It doesn't redirect at the remote site, and won't do
>> anything to force the connection to close.
>IMHO -n closes stdin at the source site, which in turn will close stdin at the
>remote site and in turn will close stdin in the sub-C-shell.
>Assuming implementation is okay, the result should be the same.

Rather than depending on MHO, I checked with

        rsh -n remote lsof -u $user

and could see that stdin was still open at the remote site,
and connected to the rshell socket.

I checked that before my earlier post.  Thus "-n" does not do what
the OP was expecting.