Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 929 - /etc/init.d/sshd restart doesn't start sshd if one is running
Summary: /etc/init.d/sshd restart doesn't start sshd if one is running
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
: 1120 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-03-02 13:28 UTC by Jon Nelson (RETIRED)
Modified: 2003-02-04 19:42 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Nelson (RETIRED) 2002-03-02 13:28:47 UTC
Assume you are ssh'd into a machine, and you upgrade sshd or alter the config,
or whatever.  You type:
/etc/init.d/sshd restart

You get an OK, and then !!
Eeek!

If fact, you can't *get* /etc/init.d/sshd to start again!
Just how, exactly, is one supposed to properly use init scripts for sshd remotely?
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2002-03-05 13:02:43 UTC
Reason is that sshd do not stop cleanly after update of binary.  You usually
have to manually go "killall sshd && /etc/init.d/sshd zap start" after the
stop/restart.

Guess you can add this in a script and run it with "nohup" ?
Comment 2 Daniel Robbins (RETIRED) gentoo-dev 2002-03-06 12:43:31 UTC
can this be incorporated into the default init.d/sshd script so that it "just
works"?
Comment 3 Jon Nelson (RETIRED) 2002-03-06 12:53:30 UTC
I'm curious as to why this differs from every other Linux distribution I've ever
used.  Debian has *seamless* sshd updates/upgrades, and so does RedHat.
Additionally, despite the fact that I'm sure your proposed solution would work,
I find that it requires too much knowledge specific to Gentoo to pull off.
Comment 4 Bjarke Sørensen 2002-03-13 09:42:41 UTC
Actually this is Azarah solution :)

start() {
        checkconfig || return 1
        ebegin "Starting sshd"
        start-stop-daemon --start --quiet --exec /usr/sbin/sshd
  start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --startas
/usr/sbin/sshd
        eend $?
}

It's been tested on my server :)

Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2002-03-13 13:50:53 UTC
*** Bug 1120 has been marked as a duplicate of this bug. ***
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2002-03-13 14:06:18 UTC
Fixed.  Remerge -r1.
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2002-03-13 14:06:36 UTC
Fixed.  Remerge -r1.
Comment 8 Jon Nelson (RETIRED) 2002-03-13 19:38:38 UTC
Just for posterity sake:

The original init file called:
  start-stop-daemon --start --quiet --exec /usr/sbin/sshd
The new one calls:
  start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid \
    --startas /usr/sbin/sshd

Cool!