• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] TFTP-Server und Leap 15.0

admine

Ultimate Guru
Hallo,

hab mir nun auch das Update gegönnt - und könnt gleich wieder zurück :/
Ich brauche dringend einen TFTP-Server im Büro (in Verbindung mit Cisco-Switchen zum Config sichern etc.)
Gestartet bekommen habe ich ihn inzwischen, aber erst als ich mir das YaSTModul installiert habe :???: Warum das? Warum geht kein systemctl enable tftp.service?

Ok, jetzt sagt mir der tftp.service folgendes:
Code:
systemctl status tftp.service
● tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; static; vendor preset: disabled)
   Active: active (running) since Fri 2018-06-29 12:37:40 CEST; 25min ago
 Main PID: 11063 (in.tftpd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/tftp.service
           └─11063 /usr/sbin/in.tftpd -u tftp -s /daten/tftpboot
Ich kann mir aber nichts vom Switch uploaden :irre:
Die Rechte auf dem Verzeichnis "/daten/tftpboot":
Code:
drwxrwxrwx  2 tftp     tftp      4096 26. Jun 10:41 tftpboot
Mehr geht ja nicht.
Mein Switch sagt aber:
Code:
TFTP put operation failed:File not found
Was übersehe ich? :???:

Vielen Dank vorab.
 
Ich verwende zwar ein debian aber bei mir sind die Rechte auf "nobody" und "nogroup" gesetzt. Ich meine mich zu erinnern das das auch so sein muß weil tftp keine Authentifizierung kennt und damit immer als nobody rein kommt. Bei mir ist atftpd im Einsatz, keine Ahnung was suse da nimmt...
 
OP
A

admine

Ultimate Guru
Mir wäre es ja am Liebsten (und früher konnte ich das auch so konfigurieren), dass mein User in der Option -u steht, aber ich finde keine Möglichkeit, dass so einzurichten.
Wie schon erwähnt, konnte ich das mal im xinetd konfigurieren. :???:

Ich teste mal mit "nobody" und "nogroup". Danke :)

EDIT: Auch damit funzt es nicht :(
 
OP
A

admine

Ultimate Guru
Hat zufällig mal jemand eine tftp.service zum Ansehen für mich?
Vermutlich fehlt in dem neuen Service etwas, weil ich das bekomme, wenn ich den Service aktivieren will:
Code:
 systemctl enable tftp.service 
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
 

Sauerland

Ultimate Guru
Aus Leap 42.3, tftp Version 5.2-19.1:
tftp.service
Code:
[Unit]
Description=Tftp Server
Requires=tftp.socket
Wants=network.target
After=network.target

[Service]
EnvironmentFile=/etc/sysconfig/tftp
ExecStart=/usr/sbin/in.tftpd -u $TFTP_USER -s $TFTP_DIRECTORY $TFTP_OPTIONS
StandardInput=socket
PrivateDevices=yes

tftp.socket
Code:
[Unit]
Description=Tftp Server Activation Socket

[Socket]
ListenDatagram=69

[Install]
WantedBy=sockets.target

/etc/sysconfig/tftp
Code:
## Description: TFTP Configuration
## Type:    string
## Default: "tftp"
#
#  daemon user (tftp)
#
TFTP_USER="tftp"

## Type:    string
## Default: ""
##
## INFO:
#
# tftp options
#
TFTP_OPTIONS=""

## Type:    string
## Default: "/srv/tftpboot"
## was "/tftpboot" but
## "/tftpboot" is not allowed anymore in FHS 2.2.
#
#  TFTP directory must be a world readable/writable directory.
#  By default /srv/tftpboot is assumed.
#
TFTP_DIRECTORY="/srv/tftpboot"
 
OP
A

admine

Ultimate Guru
Danke :)
und bei mir fehlte die Zeile "Requires=tftp.socket" im Service-File.

Das hab ich ergänzt und so fast alles schon mehrfach restartet, aber bislang keine Änderung.
Ich mach jetzt mal einen Reboot, kann ja sein es hilft ;)
 
OP
A

admine

Ultimate Guru
Ich komm irgendwie nicht weiter :(
So sieht es nach einen Neustart aus:
Code:
WKS-0025:~ # systemctl status tftp.service
● tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; static; vendor preset: disabled)
   Active: inactive (dead)
WKS-0025:~ # systemctl status tftp.socket 
● tftp.socket - Tftp Server Activation Socket
   Loaded: loaded (/usr/lib/systemd/system/tftp.socket; enabled; vendor preset: disabled)
   Active: active (listening) since Mon 2018-07-02 11:27:27 CEST; 4min 17s ago
   Listen: [::]:69 (Datagram)

Jul 02 11:27:27 WKS-0025 systemd[1]: Listening on Tftp Server Activation Socket.
Code:
WKS-0025:~ # systemctl enable tftp.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
Aber starten kann ich den Dienst:
Code:
WKS-0025:~ # systemctl start tftp.service                                                                                                                              
WKS-0025:~ # systemctl status tftp.service                                                                                                                                 
● tftp.service - Tftp Server                                                                                                                                                   
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; static; vendor preset: disabled)                                                                                      
   Active: active (running) since Mon 2018-07-02 11:34:26 CEST; 3s ago                                                                                                         
 Main PID: 2063 (in.tftpd)                                                                                                                                                     
    Tasks: 1 (limit: 4915)                                                                                                                                                     
   CGroup: /system.slice/tftp.service                                                                                                                                          
           └─2063 /usr/sbin/in.tftpd -u tftp -s /daten/tftpboot                                                                                                                
                                                                                                                                                                               
Jul 02 11:34:26 WKS-0025 systemd[1]: Started Tftp Server.
Aber ich komm nicht am TFTP-Server an:
Code:
%Error opening tftp://<IP-Adresse>/20180702_switch_207 (No such file or directory)
Vom gleichen Switch auf einen anderen TFTP-Server (Win-PC) funzt das.

Hat noch jemand eine Idee?
 
Mir fallen noch zwei Sachen ein: Guck mal unter /etc/default ob Du da noch was zu tftpd hast. Und als zweites installier dir mal atftp. Das ist ein Client für tftp, mit dem kannst Du dann mal auf localhost gucken ob es überhaupt geht. Möglicherweise fällt dabei ja per "journalctl -u tfptd.service" noch eine Info ab was da schief geht.
 
OP
A

admine

Ultimate Guru
Danke erst einmal für deine Tipps - war aber leider nix - doch der Reihe nach:
1. unter /etc/defaults gibts nichs zu tftp
2. atftp installiert => löscht mir dabei aber tftp
Code:
Problem: tftp-5.2-lp150.3.4.x86_64 conflicts with atftp provided by atftp-0.7.0-lp150.3.5.x86_64
 Solution 1: deinstallation of tftp-5.2-lp150.3.4.x86_64
Aber gut, hab ich mal so gemacht.
Jetzt der Versuch irgendetwas zu starten zu atftp:
Code:
systemctl enable atftpd.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
Code:
systemctl start atftpd.service 
Job for atftpd.service failed because of unavailable resources or another system error.
See "systemctl  status atftpd.service" and "journalctl  -xe" for details
Code:
systemctl  status atftpd.service
● atftpd.service - Advanced TFTP Server
   Loaded: loaded (/usr/lib/systemd/system/atftpd.service; static; vendor preset: disabled)
   Active: failed (Result: resources)

Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Got no socket.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Failed to run 'start' task: Invalid argument
Jul 02 14:36:19 WKS-0025 systemd[1]: Failed to start Advanced TFTP Server.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Unit entered failed state.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Failed with result 'resources'.
Code:
journalctl  -xe
...
Jul 02 14:36:08 WKS-0025 systemd[1]: Reloading.
Jul 02 14:36:08 WKS-0025 systemd[1]: nss-lookup.target: Dependency Before=nss-lookup.target dropped
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Got no socket.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Failed to run 'start' task: Invalid argument
Jul 02 14:36:19 WKS-0025 systemd[1]: Failed to start Advanced TFTP Server.
-- Subject: Unit atftpd.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit atftpd.service has failed.
-- 
-- The result is failed.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Unit entered failed state.
Jul 02 14:36:19 WKS-0025 systemd[1]: atftpd.service: Failed with result 'resources'.
Bin also auch nicht weiter, als zuvor :(
 

drcux

Hacker
systemctl enable atftp.socket

atftp.service wird dann automatisch ausgeführt, wenn jemand auf Port 69 klopft...
 
OP
A

admine

Ultimate Guru
drcux schrieb:
systemctl enable atftp.socket

atftp.service wird dann automatisch ausgeführt, wenn jemand auf Port 69 klopft...
Ok, Danke - das war es :)
So funzt es:
Code:
WKS-0025:~ # systemctl enable atftpd.socket
Created symlink /etc/systemd/system/sockets.target.wants/atftpd.socket → /usr/lib/systemd/system/atftpd.socket.
WKS-0025:~ # systemctl start atftpd.socket
Und ich bekomme die Daten vom Switch :) :thumbs:

Trotzdem würde es mich ja trotzdem interessieren, warum tftp nicht funzt.
Ich hab das Selbe wie oben, gleich noch einmal mit tftp getestet - leider kein Erfolg.
Nun könnte es an der fehlenden Zeile "Requires=tftp.socket" liegen? Die hatte ich jetzt in meinem Test nicht wieder ergänzt.
@drcux: Weißt du dazu auch etwas?
 

drcux

Hacker
Nein, daran kann es nicht liegen, xyz.socket nutzt immer automatisch ein xyz.service. Aber versuche mal das PrivateDevice zu entfernen.
 
OP
A

admine

Ultimate Guru
drcux schrieb:
Aber versuche mal das PrivateDevice zu entfernen.
Leider kein Erfolg.
1. tftp installiert
2. PrivateDevice auskommentiert
3. tftp.socket enable und gestartet
4. alle Einstellungen belassen auf default (User und Directory)
5. copy run to tftp vom Switch getestet:
Der Switch meint:
Code:
%Error opening tftp://<IP-Adresse>/20180702_switch_207 (No such file or directory)

Irgendwie sieht aber auf Linux alles gut aus, der tftp.service wurde auch gestartet.
Auch suggeriert mir die Meldung so bisschen, dass der TFTP-Server gefunden, aber nicht in das Verzeichnis geschrieben werden konnte :???:
Allerdings wird /srv/tftpboot/ bei Installaton ja angelegt und an den Rechten hab ich nichts gedreht.

Und atftp kann ja auch in dieses Verzeichnis ohne Probleme schreiben.
Den hab ich inzwischen sogar so angepasst, dass er in ein anderes Verzeichnis schreibt - klappt super. Da werde ich nun vorerst bei dem bleiben.

Aber ist schon schade, tftp funzte immer recht problemlos und ist für meine Zwecke völlig ausreichend.
 

drcux

Hacker
"man tftpd":
Code:
--create, -c
Allow new files to be created. By default, tftpd will only allow upload of files
that already exist. Files are created with default permissions allowing anyone to
read or write them, unless the --permissive or --umask options are specified.

Dein tftpd wird nur mit -u und -s gestartet....
 
OP
A

admine

Ultimate Guru
drcux schrieb:
"man tftpd":
Code:
--create, -c
Allow new files to be created. By default, tftpd will only allow upload of files
that already exist. Files are created with default permissions allowing anyone to
read or write them, unless the --permissive or --umask options are specified.

Dein tftpd wird nur mit -u und -s gestartet....
Oh weh ... genau das war es :eek:ps:
Aber kann es sein, dass die explizite Konfiguration für das -c neu ist?
Ich kann mich nicht erinnern, dass ich es schon einmal tun musste ... :???:
Egal, jetzt tut es, wie ich es mag und alles schick.

Vielen Dank, drcux :thumbs:
 

drcux

Hacker
Vorher wurde er via xinetd gestartet, vielleicht hattest du noch ne alte "/etc/xinetd.d/tftp" mit der -c Option...
 
Oben