LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-29-2010, 02:05 AM   #1
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
ssh restart gives error in auth.log


When ever I restart ssh
Quote:
/etc/init.d/ssh restart
I see
following line in auth.log
Quote:
sshd[5678]: error: Bind to port 22 on :: failed: Address already in use.
That is a headless server.
What does the above line signify or tell and why am I seeing that?
Ubuntu 10.04 64 bit server edition

Last edited by tkmsr; 10-29-2010 at 02:08 AM.
 
Old 10-29-2010, 02:15 AM   #2
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

This:
Quote:
sshd[5678]: error: Bind to port 22 on :: failed: Address already in use.
tells you that the ssh daemon (or possibly some other program) is still listening on port 22 (the :: tells you it is ipv6) when ssh tries to start.

What does the following command show (after a restart _and_ after a stop):
$ netstat -plan | grep ssh

BTW: Does a /etc/init.d/ssh stop and then /etc/init.d/ssh start work without errors?

Hope this helps.
 
Old 10-29-2010, 02:34 AM   #3
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Quote:
Originally Posted by druuna View Post
Hi,

This:tells you that the ssh daemon (or possibly some other program) is still listening on port 22 (the :: tells you it is ipv6) when ssh tries to start.
Ok
Quote:
Originally Posted by druuna View Post
What does the following command show (after a restart _and_ after a stop):
$ netstat -plan | grep ssh
Here it is
Quote:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5637/sshd
tcp6 0 0 :::22 :::* LISTEN 5637/sshd
Quote:
Originally Posted by druuna View Post
BTW: Does a /etc/init.d/ssh stop and then /etc/init.d/ssh start work without errors?
Yes this happens without errors.

Last edited by tkmsr; 10-29-2010 at 02:35 AM.
 
Old 10-29-2010, 02:46 AM   #4
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Is the output shown from after a restart?
I'm asking because the output shown seems correct, both ipv4 and ipv6 listen on port 22 and both are started by the same PID (5637). If not: do a restart and repost the output.

Just to make sure, could you post the restart part from the /etc/init.d/ssh script? (all from restart) to the ;;).
 
Old 10-29-2010, 04:34 AM   #5
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Quote:
Originally Posted by druuna View Post
Just to make sure, could you post the restart part from the /etc/init.d/ssh script? (all from restart) to the ;;).
here it is (that is Ubuntu 10.04 server) I have not modified that script.
Quote:
restart)
check_privsep_dir
check_config
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
here is one more part I think you may be interested in this
Quote:
try-restart)
check_privsep_dir
check_config
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
set +e
start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid
RET="$?"
set -e
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
1)
# daemon not running
log_progress_msg "(not running)"
log_end_msg 0
;;
*)
# failed to stop
log_progress_msg "(failed to stop)"
log_end_msg 1
;;
esac
;;
Quote:
Originally Posted by druuna View Post

Is the output shown from after a restart?
Yes the above outputs were from restart.
Quote:
Originally Posted by druuna View Post
If not: do a restart and repost the output.
I did it again for the sake of this thread just now
surprisingly I do not see that error message which I reported above with this restart
Code:
Received signal 15; terminating.
Oct 29 14:51:04  sshd[28576]: Server listening on 0.0.0.0 port 22.
Oct 29 14:51:04  sshd[28576]: Server listening on :: port 22.
and here is the output of netstat
Code:
netstat -pal | grep ssh
tcp        0      0 *:ssh                   *:*                     LISTEN      28576/sshd      
tcp        0      0 somedomain.com:ssh         tk.local:36020        ESTABLISHED 25383/2         
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      28576/sshd
also
Code:
 netstat -plan | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      28576/sshd      
tcp6       0      0 :::22                   :::*                    LISTEN      28576/sshd

Last edited by tkmsr; 10-29-2010 at 04:35 AM.
 
Old 10-29-2010, 05:06 AM   #6
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

It looks like there is nothing wrong. Maybe the time between the stop and start when executing the restart was too short (still stopping while the start was already initiated), but there is a retry mechanism in place that seems to solve that (although you do see an error when this happens).

Both the output you posted in post #3 and #5 show that all is initiated from the same pid (5637 and 28576).

I wouldn't worry about it, if you see that error again, check to see if both the tcp and tcp6 have the same pid (with the netstat command I supplied).

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh logged port in auth.log is different than 22 tkmsr Linux - Networking 5 10-22-2010 07:28 AM
ssh error and keep restart every 5 min wackolacko Linux - Server 4 02-01-2009 11:39 AM
Failing to log into ssh via ldap auth. Pam Problem? cehlers Linux - Security 1 10-10-2004 07:55 AM
PAM auth error with empty passphrase over SSH angrybeaver Linux - Software 0 09-12-2004 10:35 PM
about qmail, how could i get the auth error log? Freewind Linux - Newbie 0 01-24-2004 03:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration