ssh in rc.local stalls

Steve Brueckner steve at
Thu Dec 15 19:01:39 UTC 2005

Mike McGrath wrote:
> Steve Brueckner wrote:
>> I need to create an ssh port forwarding tunnel to another machine
>> when my Xen VM starts up, so I added this to the VM's
>> /etc/rc.d/rc.local: 
>> ssh -f -L 5500:localhost:5501 remote_host_ip tail -f /dev/null
>> This causes my VM to pause for about 3 minutes during boot right
>> after "Starting HAL daemon: [  OK  ]"
>> Furthermore, the ssh tunnel never gets created.
>> I have null-passphrase authentication keys working, so I can execute
>> the tunnel manually after I log in.  So why won't the tunnel work
>> before I log in? 
>> I don't get any errors in /var/log/messages, just a 3-minute gap
>> between entries.  Is there anywhere else I can look to find
>> potential error messages? 
>> When I try the same trick on the bare-metal host machine, it works
>> fine: no 3-minute stall and the ssh tunnel is created fine.  So I
>> suppose what I need is a way to find or create error messages so I
>> can diagnose further.  Maybe then I can take this to the Xen list.
>> Stephen Brueckner, ATC-NY
> I use the following method to create ssh tunnels on startup: (in
> inittab) 
> log1:3:respawn:/usr/bin/ssh -nNtx -R 5500:localhost:5501
> remote_host_ip > /dev/null 2>&1 
> This, however, may not solve your problem.  Are you sure you're
> public and private keys are in the right spot and have the correct
> permissions?  
> 	-Mike

My permissions are OK, since I can run the command manually after
login.  I just tried adding -vvv to the ssh command, and it's hanging 

"Debug1: Connecting to (remote_IP) port 22."

So I also tried adding a wget into rc.local, and wget fails with:

"Resolving Failed: Host not found."

So my guess is that Xen isn't bringing up the network for the VM until 
after login.  

More information about the fedora-list mailing list