LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 03-20-2010, 10:06 PM   #1
cheber
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Rep: Reputation: 0
OpenSSH server restarts twice when booting (Ubuntu 9.10)


Changes I've made to the config files:

/etc/pam.d/sshd
UsePAM no

/etc/ssh/ssh_config
AuthorizedKeysFile %h/.ssh/authorized_keys
PasswordAuthentication no

Connecting with PuTTy works fine with my public/private keys. But why does sshd start and then restart twice when booting? I tried looking in the logfiles under /var/log/ for anything with ssh/sshd but nothing shows up.

"Starting OpenBSD secure shell server sshd."
"Restarting OpenBSD secure shell server sshd."
"Restarting OpenBSD secure shell server sshd."

Ubuntu Server 9.10
 
Old 03-21-2010, 03:19 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
Did you look at the startup script in either /etc/init or /etc/init.d
I would be guessing this is the first place to look as it is a startup issue
 
Old 03-21-2010, 05:24 AM   #3
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
You could try having the daemon be the last to startup.

Location in boot-up sometimes is the culprit of problems such as these.

Whether it fails or succeeds, make sure you post back & let us know.
 
Old 03-21-2010, 05:30 AM   #4
cheber
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Original Poster
Rep: Reputation: 0
I removed a dead link for noip2 and now when I rebooted I only got one restart of sshd, though I somehow doubt it's the reason I had two restarts.
I've looked in /etc/rc2.d and I only got one link for sshd "S16ssh -> ../init.d/ssh"

Isn't it only the "start" section that should run at boot if only S16ssh exist under rc2.d?
Code:
case "$1" in
  start)
        check_privsep_dir
        check_for_no_start
        check_dev_null
        log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
        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
        ;;
 
Old 03-21-2010, 06:52 AM   #5
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
That would seem to be correct but for some reason, something is calling the restart.
Maybe if you grep -r "ssh restart" /etc/init.d/* might give us a clue if something else is calling it as well?
 
Old 03-21-2010, 02:31 PM   #6
cheber
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Original Poster
Rep: Reputation: 0
I changed S16ssh to S99ssh. SSH is still restarting at then end, sometimes once and sometimes twice.

grep -r "ssh restart" /etc/init.d/*
It gives me no hit at all.

Anyone know an easy way to log the script messages (e.g. "Starting OpenBSD secure shell server sshd.")? I've Googled a bit but I've found no solution. It's annoying that I have to go check the server when I've set up ssh.
 
Old 03-21-2010, 06:21 PM   #7
cheber
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Original Poster
Rep: Reputation: 0
I goggled a bit better and found this (I also have two network interfaces). If I understand it correctly he just makes it so the messages don't show up during boot, but ssh will still restart twice. I don't really see a reason to hide it.

Quote:
Originally Posted by sciburst
I am not sure if you are still looking for a solution. I was investigating the same issue and came across this bug:

https://bugs.launchpad.net/ubuntu/+s...cp/+bug/390556

It was suggested there that the script /etc/network/if-up.d/openssh-server is invoked to restart sshd when the network interface comes up. I did some tests and was able to confirm this. I have two interfaces on my server and my sshd was restarted twice during the boot-up sequence. The output redirection found in openssh-server unfortunately did not work as intended:

invoke-rc.d ssh restart >/dev/null 2>&1 || true

thanks to the log_daemon_msg BASH function used through out /etc/init.d/ssh. So my easy way out of this situation was to change line 117 of /etc/init.d/ssh from

log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"

to

echo "Restarting OpenBSD Secure Shell server sshd"

My server now boots up with no additional SSH-related messages in the console.
http://ubuntuforums.org/showthread.php?t=1122889

Last edited by cheber; 03-21-2010 at 06:46 PM.
 
  


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
ubuntu restarts for no reason Nolanz2 Linux - Newbie 10 06-03-2008 08:13 AM
Screensaver restarts ubuntu adanedhel728 Ubuntu 4 10-26-2007 01:45 PM
Ubuntu Randomly Restarts gibran Ubuntu 2 05-20-2007 12:08 PM
system restarts when booting SUsE LordMac Linux - Newbie 5 07-23-2004 10:38 PM
X server restarts jayakrishnan Linux - General 1 11-13-2003 07:02 AM


All times are GMT -5. The time now is 04:15 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration