# xinetd starting a simple service - why doesn't it work?

## bahadir

Hi,

I'm trying to run the simplest tftp daemon via xinetd and I couldn't get it to work so far. Could you please help.

here's my /etc/xinetd.d/tftp

```

service tftp

{

    protocol    = udp

    socket_type = dgram

    wait        = yes

    user        = nobody

    group       = nobody

    server      = /usr/sbin/in.tftpd

    server_args = /tftpboot

    log_type        = SYSLOG authpriv info

    log_on_success  = HOST PID USERID

    log_on_failure  = HOST

    disable     = no

}

```

and here's my /etc/xinetd.conf

```

defaults

{

   only_from       = localhost

   instances       = 60

   log_type        = SYSLOG authpriv info

#    log_type        = FILE /var/log/servicelog

    log_on_success  = HOST PID

   log_on_failure  = HOST

   cps             = 25 30

}

includedir /etc/xinetd.d

```

Here's /var/log/daemon.log when I start xinetd:

```

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/chargen-tcp [file=/etc/xinetd.conf] [line=18]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/chargen-udp [file=/etc/xinetd.d/chargen-udp] [line=13]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/cups-lpd [file=/etc/xinetd.d/cups-lpd] [line=14]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/cvspserver [file=/etc/xinetd.d/cvspserver] [line=13]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/daytime-tcp [file=/etc/xinetd.d/daytime-tcp] [line=14]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/daytime-udp [file=/etc/xinetd.d/daytime-udp] [line=13]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/echo-tcp [file=/etc/xinetd.d/echo-tcp] [line=14]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/echo-udp [file=/etc/xinetd.d/echo-udp] [line=13]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/swat [file=/etc/xinetd.d/swat] [line=14]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/tftp [file=/etc/xinetd.d/tftp] [line=17]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/time-tcp [file=/etc/xinetd.d/time-tcp] [line=14]

May 11 15:36:16 gentoo xinetd[7578]: Reading included configuration file: /etc/xinetd.d/time-udp [file=/etc/xinetd.d/time-udp] [line=13]

May 11 15:36:16 gentoo xinetd[7578]: removing chargen

May 11 15:36:16 gentoo xinetd[7578]: removing chargen

May 11 15:36:16 gentoo xinetd[7578]: removing printer

May 11 15:36:16 gentoo xinetd[7578]: removing cvspserver

May 11 15:36:16 gentoo xinetd[7578]: removing daytime

May 11 15:36:16 gentoo xinetd[7578]: removing daytime

May 11 15:36:16 gentoo xinetd[7578]: removing echo

May 11 15:36:16 gentoo xinetd[7578]: removing echo

May 11 15:36:16 gentoo xinetd[7578]: removing swat

May 11 15:36:16 gentoo xinetd[7578]: removing time

May 11 15:36:16 gentoo xinetd[7578]: removing time

May 11 15:36:16 gentoo xinetd[7578]: xinetd Version 2.3.13 started with libwrap loadavg options compiled in.

May 11 15:36:16 gentoo xinetd[7578]: Started working: 1 available service

```

I use netkit-tftp. xinetd starts ok. but when I do 

```
 

% ps aux 
```

 tftp daemon doesn't show up (i.e. no name like tftp). Is each daemon started as connections are made? Don't they start as xinetd starts? What is the best way to get evidence that a daemon has started? I tried to use these log_on_success and log_on_failure in tftp configuration to see if they made any difference in terms of tftp-specific output in the logfile above. But nothing shows up for tftp. All I can see is this logfile, I tried using server_args=-d for debug/verbose output but it didn't work (it counts as a parse error in config file). How do I get verbose messages?

I also tried the commented out: 

```
#    log_type        = FILE /var/log/servicelog 
```

 option in xinetd.conf, in that case only a /var/log/servicelog is created but when you cat it there's nothing in it. 

I'm really out of ideas. Hope you can help.

Thanks,

Bahadir

----------

## MrPyro

xinetd doesn't start a service until it recieves a connection on the port that service is supposed to run on. So you won't see an ftp service running unless you actually have an ftp client attached at the time.

From the log you've posted, I'd say that the ftp service was detected correctly by xinetd: I can see it closing down every service except the ftp one, then saying that it has one service running.

Have you tried telneting to the FTP port and seeing what error message you get?

----------

## bahadir

OK. I got it working. I want to let people know, just in case anyone wants to use a simple tftp and doesn't want to go through the hassle I had. Use tftp-hpa. Very easy to use.

All I did was:

```
 

% emerge tftp-hpa

% mkdir /tftpboot

% cp linux-image /tftpboot

% chown -R nobody:nobody /tftpboot

% /sbin/in.tftp -l -p /tftpboot

```

Thats it. Also to test it, as simple as the previous

```

% tftp

% connect hostname

% get /tftpboot/linux-image

```

I think this is really how things should be.

----------

## adaptr

No, it's not.

You're starting an xinetd service as a standalone, which is overkill for a service that gets called once every blue moon.

Also, you have never shown that xinetd doesn't work - although I can virtually guarantee you that it wouldn't have, because you have:

```
only_from       = localhost 
```

set as the default in xinetd.conf.

Meaning it won't respond to network calls.

Read the xinetd(.conf) manpages to figure out what to do next time.

----------

## kashani

 *adaptr wrote:*   

> No, it's not.
> 
> You're starting an xinetd service as a standalone, which is overkill for a service that gets called once every blue moon.
> 
> 

 

Running a 39k standalone binary, atftp in my case, instead of a 143k super daemon makes perfect sense to me.  :Smile:  I never got xinetd to work properly with tftp so I ended installing atftp and running it standalone when I needed it.

kashani

----------

## adaptr

Sure - that's absolutely true if it's the only service you run through xinetd.

----------

