# [solved] /etc/init.d/sshd restart failed

## piratwww

Hey,

my server is starting up without problems. The daemon ssh start. After the command /etc/init.d/sshd status is displaying "status started [ok]". When I want to make a restart with /etc/init.d/sshd the messages say Stopping ... Starting sshd [ok]. But in /var/log/messages I read "Received signal 15; terminating.sshd: fatal: daemon() failed: No such device". After this the ssh connection is standing up, but when i log out and then I want log in, ssh is down.

piratwwwLast edited by piratwww on Mon Jan 11, 2010 6:40 pm; edited 1 time in total

----------

## honp

Try to switch logging on and then say to us what is wrong...

----------

## piratwww

Hey,

for 12 times the restart make no problems. The 13. restart failed again. Here is the logging nearly of moment from crash till reboot the server:

```
  

 1  sshd[5337]: debug3: monitor_read: checking request 25

  2  sshd[5337]: debug3: mm_answer_pty entering

  3  sshd[5337]: debug2: session_new: allocate (allocated 0 max 10)

  4  sshd[5337]: debug3: session_unused: session id 0 unused

  5  sshd[5337]: debug1: session_new: session 0

  6  sshd[5337]: debug3: mm_request_send entering: type 26

  7  sshd[5340]: debug1: session_pty_req: session 0 alloc /dev/pts/0

  8  sshd[5340]: debug1: server_input_channel_req: channel 0 request shell reply 1

  9  sshd[5340]: debug1: session_by_channel: session 0 channel 0

 10  sshd[5340]: debug1: session_input_channel_req: session 0 req shell

 11  sshd[5341]: debug1: Setting controlling tty using TIOCSCTTY.

 12  sshd[5341]: debug3: Copy environment: MAIL=/var/mail/XXX

 13  sshd[5341]: debug3: channel 0: close_fds r -1 w -1 e -1 c -1

 14  sshd[5340]: debug2: fd 3 setting TCP_NODELAY

 15  sshd[5340]: debug2: channel 0: rfd 9 isatty

 16  sshd[5340]: debug2: fd 9 setting O_NONBLOCK

 17  sshd[5340]: debug3: fd 7 is O_NONBLOCK

 18  sshd[5337]: debug3: mm_answer_pty: tty /dev/pts/0 ptyfd 4

 19  sshd[5337]: debug3: mm_request_receive entering

 20  sshd[3544]: Received signal 15; terminating.

 21  sshd[5425]: fatal: daemon() failed: No such device

 22  sshd[5340]: debug1: Received SIGCHLD.

 23  sshd[5340]: debug1: session_by_pid: pid 5341

 24  sshd[5340]: debug1: session_exit_message: session 0 channel 0 pid 5341

 25  sshd[5340]: debug2: channel 0: request exit-status confirm 0

 26  sshd[5340]: debug1: session_exit_message: release channel 0

 27  sshd[5340]: debug2: channel 0: write failed

 28  sshd[5340]: debug2: channel 0: close_write

 29  sshd[5340]: debug2: channel 0: send eow

 30  sshd[5340]: debug2: channel 0: output open -> closed

 31  sshd[5340]: debug3: mm_request_send entering: type 27

 32  sshd[5340]: debug2: channel 0: read<=0 rfd 9 len -1

 33  sshd[5340]: debug2: channel 0: read failed

 34  sshd[5340]: debug2: channel 0: close_read

 35  sshd[5340]: debug2: channel 0: input open -> drain

36  sshd[5340]: debug2: channel 0: ibuf empty

 37  sshd[5340]: debug2: channel 0: send eof

 38  sshd[5340]: debug2: channel 0: input drain -> closed

 39  sshd[5340]: debug2: channel 0: send close

 40  sshd[5340]: debug2: notify_done: reading

 41  sshd[5340]: debug3: channel 0: will not send data after close

 42  sshd[5337]: debug3: monitor_read: checking request 27

 43  sshd[5337]: debug3: mm_answer_pty_cleanup entering

 44  sshd[5337]: debug1: session_by_tty: session 0 tty /dev/pts/0

 45  sshd[5337]: debug3: mm_session_close: session 0 pid 5340

 46  sshd[5337]: debug3: mm_session_close: tty /dev/pts/0 ptyfd 4

 47  sshd[5337]: debug1: session_pty_cleanup: session 0 release /dev/pts/0

 48  sshd[5337]: debug3: session_unused: session id 0 unused

 49  sshd[5337]: debug3: mm_request_receive entering

 50  sshd[5340]: debug2: channel 0: rcvd close

 51  sshd[5340]: debug3: channel 0: will not send data after close

 52  sshd[5340]: debug2: channel 0: is dead

 53  sshd[5340]: debug2: channel 0: gc: notify user

 54  sshd[5340]: debug1: session_by_channel: session 0 channel 0

 55  sshd[5340]: debug1: session_close_by_channel: channel 0 child 0

 56  sshd[5340]: debug1: session_close: session 0 pid 0

 57  sshd[5340]: debug3: session_unused: session id 0 unused

 58  sshd[5340]: debug2: channel 0: gc: user detached

 59  sshd[5340]: debug2: channel 0: is dead

 60  sshd[5340]: debug2: channel 0: garbage collecting

 61  sshd[5340]: debug1: channel 0: free: server-session, nchannels 1

 62  sshd[5340]: debug3: channel 0: status: The following connections are open:\r\n  #0 server-session (t    4 r0 i3/0 o3/0 fd -1/-1 cfd -1)\r\n

 63  sshd[5340]: debug3: channel 0: close_fds r -1 w -1 e -1 c -1

 64  sshd[5340]: Connection closed by AA...199

 65  sshd[5340]: debug1: do_cleanup

 66  sshd[5340]: debug3: PAM: sshpam_thread_cleanup entering

 67  sshd[5340]: Transferred: sent 33288, received 6080 bytes

 68  sshd[5340]: Closing connection to AA...199 port XXX60199

 69  sshd[5340]: debug3: mm_request_send entering: type 62

70  sshd[5337]: debug3: monitor_read: checking request 62

 71  sshd[5337]: debug3: mm_answer_term: tearing down sessions

 72  sshd[5337]: debug1: PAM: cleanup

 73  sshd[5337]: debug1: PAM: deleting credentials

 74  sshd[5337]: debug1: PAM: closing session

 75  sshd[3547]: debug2: fd 3 setting O_NONBLOCK

 76  sshd[3547]: debug1: Bind to port Y on 0.0.0.0.

 77  sshd[3547]: Server listening on 0.0.0.0 port Y.

 78  sshd[3547]: socket: Address family not supported by protocol

 79  sshd[3547]: debug3: fd 4 is not O_NONBLOCK

 80  sshd[3695]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7

 81  sshd[3547]: debug1: Forked child 3695.

 82  sshd[3547]: debug3: send_rexec_state: entering fd = 7 config len 299

 83  sshd[3547]: debug3: ssh_msg_send: type 0

 84  sshd[3547]: debug3: send_rexec_state: done

 85  sshd[3695]: debug1: inetd sockets after dupping: 3, 3

 86  sshd[3695]: Connection from AA.BBB.CCC.199 port QQQQQ

 87  sshd[3695]: debug1: Client protocol version 2.0; client software version OpenSSH_5.2

 88  sshd[3695]: debug1: match: OpenSSH_5.2 pat OpenSSH*

 89  sshd[3695]: debug1: Enabling compatibility mode for protocol 2.0

 90  sshd[3695]: debug1: Local version string SSH-2.0-OpenSSH_5.2

 91  sshd[3695]: debug2: fd 3 setting O_NONBLOCK

 92  sshd[3695]: debug2: Network child is on pid 3696

 93  sshd[3695]: debug3: preauth child monitor started

 94  sshd[3695]: debug3: mm_request_receive entering

 95  sshd[3695]: debug3: monitor_read: checking request 0

 96  sshd[3695]: debug3: mm_answer_moduli: got parameters: 1024 1024 8192

 97  sshd[3695]: debug3: mm_request_send entering: type 1

 98  sshd[3695]: debug2: monitor_read: 0 used once, disabling now

 99  sshd[3695]: debug3: mm_request_receive entering

100  sshd[3695]: debug3: monitor_read: checking request 4

101  sshd[3695]: debug3: mm_answer_sign

102  sshd[3695]: debug3: mm_answer_sign: signature 0x80b8740(143)

103  sshd[3695]: debug3: mm_request_send entering: type 5

104  sshd[3695]: debug2: monitor_read: 4 used once, disabling now

105  sshd[3695]: debug3: mm_request_receive entering

106  sshd[3695]: debug3: monitor_read: checking request 6

107  sshd[3695]: debug3: mm_answer_pwnamallow

108  sshd[3695]: debug3: Trying to reverse map address AA.BBB.CCC.199.

109  sshd[3695]: debug2: parse_server_config: config reprocess config len 299

110  sshd[3695]: debug3: mm_answer_pwnamallow: sending MONITOR_ANS_PWNAM: 1

111  sshd[3695]: debug3: mm_request_send entering: type 7

112  sshd[3695]: debug2: monitor_read: 6 used once, disabling now

113  sshd[3695]: debug3: mm_request_receive entering

114  sshd[3695]: debug3: monitor_read: checking request 49

115  sshd[3695]: debug1: PAM: initializing for "      "

116  sshd[3695]: debug1: PAM: setting PAM_RHOST to "p54afeac7.dip.t-dialin.net"

117  sshd[3695]: debug1: PAM: setting PAM_TTY to "ssh"

118  sshd[3695]: debug2: monitor_read: 49 used once, disabling now

119  sshd[3695]: debug3: mm_request_receive entering

120  sshd[3695]: debug3: monitor_read: checking request 3

121  sshd[3695]: debug3: mm_answer_authserv: service=ssh-connection, style=

122  sshd[3695]: debug2: monitor_read: 3 used once, disabling now

123  sshd[3695]: debug3: mm_request_receive entering

124  sshd[3695]: debug3: monitor_read: checking request 52

125  sshd[3695]: debug3: mm_answer_pam_init_ctx

126  sshd[3695]: debug3: PAM: sshpam_init_ctx entering

127  sshd[3695]: debug3: mm_request_send entering: type 53

128  sshd[3695]: debug3: mm_request_receive entering

129  sshd[3695]: debug3: monitor_read: checking request 54

130  sshd[3695]: debug3: mm_answer_pam_query

131  sshd[3695]: debug3: PAM: sshpam_query entering

132  sshd[3695]: debug3: ssh_msg_recv entering

133  sshd[3697]: debug3: PAM: sshpam_thread_conv entering, 1 messages

134  sshd[3697]: debug3: ssh_msg_send: type 1

135  sshd[3697]: debug3: ssh_msg_recv entering

136  sshd[3695]: debug3: mm_request_send entering: type 55

137  sshd[3695]: debug3: mm_request_receive entering

138  sshd[3695]: debug3: monitor_read: checking request 56

139  sshd[3695]: debug3: mm_answer_pam_respond

140  sshd[3695]: debug2: PAM: sshpam_respond entering, 1 responses

141  sshd[3695]: debug3: ssh_msg_send: type 6

142  sshd[3695]: debug3: mm_request_send entering: type 57

143  sshd[3695]: debug3: mm_request_receive entering

144  sshd[3695]: debug3: monitor_read: checking request 54

145  sshd[3695]: debug3: mm_answer_pam_query

146  sshd[3695]: debug3: PAM: sshpam_query entering

147  sshd[3695]: debug3: ssh_msg_recv entering

148  sshd[3697]: debug1: do_pam_account: called

149  sshd[3697]: debug3: PAM: do_pam_account pam_acct_mgmt = 0 (Success)

150  sshd[3697]: debug3: ssh_msg_send: type 0

151  sshd[3695]: debug3: PAM: import_environments entering

152  sshd[3695]: debug3: sshpam_password_change_required 0

153  sshd[3695]: debug3: PAM: num env strings 0

154  sshd[3695]: debug1: PAM: num PAM env strings 0

155  sshd[3695]: debug3: mm_request_send entering: type 55

156  sshd[3695]: debug3: mm_request_receive entering

157  sshd[3695]: debug3: monitor_read: checking request 56

158  sshd[3695]: debug3: mm_answer_pam_respond

159  sshd[3695]: debug2: PAM: sshpam_respond entering, 0 responses

160  sshd[3695]: debug3: mm_request_send entering: type 57

161  sshd[3695]: debug3: mm_request_receive entering

162  sshd[3695]: debug3: monitor_read: checking request 58

163  sshd[3695]: debug3: mm_answer_pam_free_ctx

164  sshd[3695]: debug3: PAM: sshpam_free_ctx entering

165  sshd[3695]: debug3: PAM: sshpam_thread_cleanup entering

166  sshd[3695]: debug3: mm_request_send entering: type 59

167  sshd[3695]: debug2: monitor_read: 58 used once, disabling now

168  sshd[3695]: debug3: mm_request_receive_expect entering: type 50

169  sshd[3695]: debug3: mm_request_receive entering

170  sshd[3695]: debug1: do_pam_account: called

171  sshd[3695]: debug3: mm_request_send entering: type 51

172  sshd[3695]: Accepted keyboard-interactive/pam for  from 199 port  ssh2

173  sshd[3695]: debug1: monitor_child_preauth:  has been authenticated by privileged process

174  sshd[3695]: debug3: mm_get_keystate: Waiting for new keys

175  sshd[3695]: debug3: mm_request_receive_expect entering: type 24

176  sshd[3695]: debug3: mm_request_receive entering

177  sshd[3695]: debug3: mm_newkeys_from_blob: 0x80bb000(118)

178  sshd[3695]: debug2: mac_setup: found hmac-md5

179  sshd[3695]: debug3: mm_get_keystate: Waiting for second key

180  sshd[3695]: debug3: mm_newkeys_from_blob: 0x80bb000(118)

181  sshd[3695]: debug2: mac_setup: found hmac-md5

182  sshd[3695]: debug3: mm_get_keystate: Getting compression state

183  sshd[3695]: debug3: mm_get_keystate: Getting Network I/O buffers

184  sshd[3695]: debug3: mm_share_sync: Share sync

185  sshd[3695]: debug3: mm_share_sync: Share sync end

186  sshd[3695]: debug1: PAM: establishing credentials

187  sshd[3695]: debug3: PAM: opening session

188  sshd[3695]: debug3: PAM: sshpam_store_conv called with 1 messages

189  sshd[3695]: debug3: PAM: sshpam_store_conv called with 1 messages

190  sshd[3695]: User child is on pid 3775

191  sshd[3695]: debug3: mm_request_receive entering

192  sshd[3775]: debug1: PAM: establishing credentials

193  sshd[3775]: debug1: permanently_set_uid: 1000/1002

194  sshd[3775]: debug2: set_newkeys: mode 0

195  sshd[3775]: debug2: set_newkeys: mode 1

196  sshd[3775]: debug1: Entering interactive session for SSH2.

197  sshd[3775]: debug2: fd 5 setting O_NONBLOCK

198  sshd[3775]: debug2: fd 6 setting O_NONBLOCK

199  sshd[3775]: debug1: server_init_dispatch_20

200  sshd[3775]: debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384

201  sshd[3775]: debug1: input_session_request

202  sshd[3775]: debug1: channel 0: new [server-session]

203  sshd[3775]: debug2: session_new: allocate (allocated 0 max 10)

204  sshd[3775]: debug3: session_unused: session id 0 unused

205  sshd[3775]: debug1: session_new: session 0

206  sshd[3775]: debug1: session_open: channel 0

207  sshd[3775]: debug1: session_open: session 0: link with channel 0

208  sshd[3775]: debug1: server_input_channel_open: confirm session

209  sshd[3775]: debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0

210  sshd[3775]: debug1: server_input_channel_req: channel 0 request pty-req reply 1

211  sshd[3775]: debug1: session_by_channel: session 0 channel 0

212  sshd[3775]: debug1: session_input_channel_req: session 0 req pty-req

213  sshd[3775]: debug1: Allocating pty.

214  sshd[3775]: debug3: mm_request_send entering: type 25

215  sshd[3775]: debug3: mm_pty_allocate: waiting for MONITOR_ANS_PTY

216  sshd[3775]: debug3: mm_request_receive_expect entering: type 26

217  sshd[3775]: debug3: mm_request_receive entering

218  sshd[3695]: debug3: monitor_read: checking request 25

219  sshd[3695]: debug3: mm_answer_pty entering

220  sshd[3695]: debug2: session_new: allocate (allocated 0 max 10)

221  sshd[3695]: debug3: session_unused: session id 0 unused

222  sshd[3695]: debug1: session_new: session 0

223  sshd[3695]: debug3: mm_request_send entering: type 26

224  sshd[3775]: debug1: session_pty_req: session 0 alloc /dev/pts/0

225  sshd[3775]: debug1: server_input_channel_req: channel 0 request shell reply 1

226  sshd[3775]: debug1: session_by_channel: session 0 channel 0

227  sshd[3775]: debug1: session_input_channel_req: session 0 req shell

228  sshd[3778]: debug1: Setting controlling tty using TIOCSCTTY.

229  sshd[3778]: debug3: Copy environment: MAIL=/var/mail/

230  sshd[3778]: debug3: channel 0: close_fds r -1 w -1 e -1 c -1

231  sshd[3775]: debug2: fd 3 setting TCP_NODELAY

232  sshd[3775]: debug2: channel 0: rfd 9 isatty

233  sshd[3775]: debug2: fd 9 setting O_NONBLOCK

234  sshd[3775]: debug3: fd 7 is O_NONBLOCK

235  sshd[3695]: debug3: mm_answer_pty: tty /dev/pts/0 ptyfd 4

236  sshd[3695]: debug3: mm_request_receive entering

237  sshd[3775]: debug2: channel 0: rcvd adjust 49606

238  sshd[3775]: debug2: channel 0: rcvd adjust 49723

239  sshd[3775]: debug2: channel 0: rcvd adjust 49835

240  sshd[3775]: debug2: channel 0: rcvd adjust 49539

   
```

piratwww

www

----------

## Bircoph

Does /dev/pts/0 exist? Does it have right permissions?

How is you kernel configured concerning pty? (Please show CONFIG_UNIX98_PTYS, CONFIG_DEVPTS_MULTIPLE_INSTANCES, CONFIG_LEGACY_PTYS.)

----------

## piratwww

Hey,

```
ls /dev/pts/0 -hasl 0 crw--w----  1 useri tty  136, 0 11. Jan 16:34 0
```

```
CONFIG_UNIX98_PTYS=y

#CONFIG_DEVPTS_MULTIPLE_INSTANCES => ist not set

CONFIG_LEGACY_PTYS=y
```

I don't change the kernel. I have this problem since one of the latest updates. Before the updates openssh works fine. I just try the hold time to restart openssh, sometime open ssh crashes after 4 restarts after I restart the server and other times openssh crashes after 20 times.

piratwww

----------

## piratwww

Hey,

thank you for your ideas!!  :Laughing: 

The problems does exist under a grsecurity kernel-2.6.31.5. Now i installed a normal kernel in version 2.6.32.2 and the problems are blowing away. I tested for 55 times in very short intervals !(Prior openssh crashed in this situation.)  I have a stable openssh. I restared the server and try for several times more, no problems. I do  not understand, wy the problems are going away.   :Embarassed: 

Further is the behavior odd to me, because now after a call ssh root@87.124.12.12 ask to the password immediately. With the grsecurity kernel I must wait even a few seconds for the prompt.

Thanks for help!

piratwww

----------

## dimonic

"I had exactly the same problem:

the solution is in the /dev/null file. it should now be a regular file, which is not recommended

some install script probably replaced the /dev/null with a file of the same name...

do the following:

remove /dev/null

and then: "mknod /dev/null c 1 3"

this will create the /dev/null and sshd should start as normal.

I also run slackware linux with the latest upgrade."

----------

