# xinetd & sshd problems

## Jacobs

Hi, I'm running a Gentoo server with xinetd (serving pop3(s)-qpopper, smtp(s)-postfix, FTP-proftpd) and ssh daemon.

The problem is, that the system sometimes (unprecitably) stops reacting for sshd and xinetd services (I can't login via ssh - after entering password it "freezes") and while restarting xinetd [!!] happens

```
/etc/init.d/xinetd start

* Starting xinetd...                      [ !! ]

```

Is there some log where I can see why xinetd refuses to start?

I'm able to restart sshd, but it's behaviour is still the same.

I tried to connect to SMTP via telnet, but after EHLO it freezes just like the ssh.

Only thing that helps is restarting the whole server several times (not kidding).   :Crying or Very sad: 

I've been experiencing some problems with DNS server in past 2 weeks (apache refused to start due to this, but it's solved now) - can there be some connection with this?

Thanx

----------

## neilhwatson

Check your logs:

/var/log/daemon*

/var/log/messages

There are other logs there that may also be useful.

----------

## Jacobs

 *neilhwatson wrote:*   

> /var/log/daemon*
> 
> /var/log/messages

 

I don't have such logs there - what's wrong? I'm using metalog and in /etc/xinetd.conf I have

```
log_type = SYSLOG auth info
```

while in /etc/metalog/metalog.conf I have

```
Auth messages :

  facility = "auth"

  logdir   = "/var/log/auth"

```

so I suppose all xinetd messages should be logged in /var/log/auth, but I can't see there any logs about why it refuses to start...

----------

## neilhwatson

Poke around in /var/logs and see what you can find.

```
grep -ir xinet /var/log
```

That should tell you what files log for xinet.

----------

## Jacobs

OK, logs work great - also I found somewhere that it's good idea to run xinetd with "-d" parameter for debugging info and this is what I got:

```
...

...

03/4/30@18:55:39: ERROR: {activate_normal} bind failed (Address already in use (errno = 98)). service = pop-3

03/4/30@18:55:39: ERROR: {activate_normal} bind failed (Address already in use (errno = 98)). service = pop3s

03/4/30@18:55:39: ERROR: {activate_normal} bind failed (Address already in use (errno = 98)). service = ftp

03/4/30@18:55:39: DEBUG: {cnf_start_services} mask_max = 0, services_started = 0

03/4/30@18:55:39: CRITICAL: {init_services} no services. Exiting...

```

any suggestions?

----------

## adumare

Are you running another ftp daemon or pop daemon that don't use xinet?

----------

## Jacobs

nope

But I found out something else - these messages mean that the server is already running (which means that "/etc/init.d/xinetd stop" didn't stop it properly) so to restart xinetd I have to do now

```
/etc/init.d/xinetd stop

killall -9 xinetd

/etc/init.d/xinetd start

```

But it doesn't solve anything - still whenever I try to telnet to port 25, after EHLO I got no response from my server. The same for SSH, pop3, etc...

When I do

```
/etc/init.d/sshd stop

sshd -d
```

I got

```
debug1: Bind to port 22 on 0.0.0.0.

Bind to port 22 on 0.0.0.0 failed: Address already in use.

Cannot bind any address.
```

I really can't do "killall -9 sshd", cuz I'd lost my connection to that computer (I can't reach it locally).

----------

## adumare

You shouldn't have to manually kill it.   I don't know what is going on here maybe unmerge xinetd reboot and emerge it again.  Maybe someone else has an idea   :Very Happy: 

----------

## Jacobs

Do you think that re-emerging xinetd would solve my problem with sshd? I think that there should be no relation between xinetd and sshd, right?

----------

## adumare

My system as no xinietd on it but it does run sshd so no there is not relation unless you've done something interesting with sshd to make it work from xinietd.  

I assume you have started sshd  by doing:

```
/etc/init.d/sshd start
```

If you have then it should work.  I've never had any trouble with ssh in gentoo or any other linux distro for that matter.  It even works most of the time in tru64.

----------

## Jacobs

I have started it the way you say. But when I stoped it and then tried to start it again - I got

```
# /etc/init.d/sshd start

 * Starting sshd...              [!!]

# sshd -d

debug1: sshd version OpenSSH_3.5p1

debug1: read PEM private key done: type RSA

debug1: private host key: #0 type 1 RSA

debug1: read PEM private key done: type DSA

debug1: private host key: #1 type 2 DSA

debug1: Bind to port 22 on 0.0.0.0.

Bind to port 22 on 0.0.0.0 failed: Address already in use.

Cannot bind any address.

```

So it looks to me, that everything related with binding to ports isn't working now. I can't check samba, since it's running now, but xinetd (pop,smtp,ftp), sshd and apache refuses to start again after stop without being killed manualy.

----------

## adumare

Well that's pretty strange, have you tried rebooting (does it clear up)  when you get that error you should try doing a netstat to see what else is listening.

[code]netstat -tlp[/code]

you may have to install netstat to get that command to work.

It bothers me that ssh doesn't seem to be deing I think you have some pretty wacky things going on here.  Just out of instest type

[code]emerge info[/code]

and lets see what you have for USE CFLAGS and ACCEPT_KEYWORDS

----------

## Jacobs

```

# netstat -tlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 *:mysql                 *:*                     LISTEN      4325/

tcp        0      0 *:netbios-ssn           *:*                     LISTEN      4684/smbd

tcp        0      0 *:webcache              *:*                     LISTEN      4740/

tcp        0      0 *:www                   *:*                     LISTEN      4329/apache

tcp        0      0 *:ssh                   *:*                     LISTEN      4787/sshd

tcp        0      0 *:smtp                  *:*                     LISTEN      4636/

tcp        0      0 *:https                 *:*                     LISTEN      4329/apache

```

and what is strange is that smtp line - process 4636

```
# ps -lax

...

4     0  4636     1   9   0  3932 1280 schedu S    ?          0:00 [master]

```

 - what does that mean?

```
USE="oss avi crypt encode gif imlib jpeg libg++ mikmod mmx motif mpeg ncurses nls oggvorbis pdflib quicktime sdl svga truetype xmms xv zlib gdbm berkdb slang readline gpm libwww python -3dfx -3dnow aalib acpi -afs -alsa -apache2 apm -cjk -cups -esd -evo fbcon -freewnn -gb gd -ggz -gnome -gphoto2 -gtk -java -kde -lcms -leim -mozilla mysql -opengl pam -pcmcia -pda perl png postgres -qt -qtmt samba usb -scanner -spell ssl sse tcpd -xml -xml2 -X x86 -arts"

CFLAGS="-march=pentium4 -O3 -pipe"

ACCEPT_KEYWORDS="x86"
```

please help me someone - I really need this thing to get to work  :Sad: Last edited by Jacobs on Wed Apr 30, 2003 6:09 pm; edited 1 time in total

----------

## Jacobs

btw I can't restart that computer now, because I don't have physical access to it and I have no guarantee that it'll work after restart. But I tried to restart it several times before and so far it is the only way to get it working again for a while.

----------

