Le démarrage du service SystemD Centos 7 n'est pas capable de lire le file sur le lecteur réseau

J'ai lu un tas de dependencies système liées sur le Web, mais je ne pourrais toujours pas find une fonction qui fonctionne. Je ne sais pas quel est le problème. Le travail est supposé démarrer lors du redémarrage. Cela dépend du réseau, autofs, rpc, et j'ai ajouté un RequiresMountsFor, mais toujours pas de chance. L'unité n'a toujours pas trouvé de file sur le lecteur réseau. Toutes les idées ont été appréciées.

$ systemd-analyze critical-chain hello.service The time after the unit is active or started is printed after the "@" character. The time the unit takes to start is printed after the "+" character. hello.service @11.520s └─autofs.service @11.429s +88ms └─network.target @11.425s └─network.service @10.751s +674ms └─NetworkManager.service @1.326s +123ms └─basic.target @1.274s └─sockets.target @1.274s └─rpcbind.socket @1.274s └─sysinit.target @1.273s └─systemd-update-utmp.service @1.269s +2ms └─auditd.service @1.204s +62ms └─systemd-tmpfiles-setup.service @1.120s +82ms └─rhel-import-state.service @1.111s +8ms └─local-fs.target @1.109s └─home.mount @734ms +261ms └─dev-mapper-centos\x2dhome.device @734ms 

C'est le file de l'unité:

 $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target $ chat hello.service $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target Description = Hello Tester $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target Nécessite = network-online.target autofs.service $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target Après = network-online.target autofs.service $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target RequiresMountsFor = / path / to / file $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target ExecStart = / usr / bin / ls -l / path / to / file / on_nfs> /tmp/hello_tester.log $ cat hello.service [Unit] Description=Hello Tester Requires=network-online.target autofs.service After=network-online.target autofs.service RequiresMountsFor=/path/to/file [Service] ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log [Install] WantedBy=multi-user.target 

Voici l'erreur. Je suppose que je ne peux pas spécifier cette ligne cmd avec plusieurs args comme ça. Mais il est évident qu'il ne peut pas voir le file sur le réseau lors du démarrage.

 $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. $ systemctl status hello.service $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. ● hello.service - Hello Tester $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. Chargé: chargé (/etc/systemd/system/hello.service; enabled; Preset du fournisseur: désactivé) $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. Actif: échec (Résultat: code de sortie) depuis sam. 2016-07-30 02:18:02 HKT; $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. Processus: 1760 ExecStart = / usr / bin / ls -l / path / to / file / on_nfs> /tmp/hello_tester.log (code = exited, status = 2) $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. PID principal: 1760 (code = sorté, état = 2) $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:17:56 localhost.localdomain systemd [1]: Démarré Hello Tester. $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:17:56 localhost.localdomain systemd [1]: Démarrage de Hello Tester ... $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:18:02 localhost.localdomain ls [1760]: / usr / bin / ls: impossible d'accéder / path / to / file / on_nfs: Aucun file ou directory de ce type $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:18:02 localhost.localdomain ls [1760]: / usr / bin / ls: ne peut pas accéder>: Aucun file ou directory de ce type $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:18:02 localhost.localdomain ls [1760]: / usr / bin / ls: impossible d'accéder /tmp/hello_tester.log: Aucun file ou directory de ce type $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:18:02 localhost.localdomain systemd [1]: hello.service: process principal terminé, code = sorté, statut = 2 / INVALIDARGUMENT $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 30 juillet 02:18:02 localhost.localdomain systemd [1]: Unité hello.service a entré dans l'état échoué. $ systemctl status hello.service ● hello.service - Hello Tester Loaded: loaded (/etc/systemd/system/hello.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sat 2016-07-30 02:18:02 HKT; 2 days ago Process: 1760 ExecStart=/usr/bin/ls -l /path/to/file/on_nfs > /tmp/hello_tester.log (code=exited, status=2) Main PID: 1760 (code=exited, status=2) Jul 30 02:17:56 localhost.localdomain systemd[1]: Started Hello Tester. Jul 30 02:17:56 localhost.localdomain systemd[1]: Starting Hello Tester... Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /path/to/file/on_nfs: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access >: No such file or directory Jul 30 02:18:02 localhost.localdomain ls[1760]: /usr/bin/ls: cannot access /tmp/hello_tester.log: No such file or directory Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service: main process exited, code=exited, status=2/INVALIDARGUMENT Jul 30 02:18:02 localhost.localdomain systemd[1]: Unit hello.service entered failed state. Jul 30 02:18:02 localhost.localdomain systemd[1]: hello.service failed. 

Juste pour la paranoïa, avez-vous essayé d'accéder à ce file lorsque vous êtes connecté en tant que root user? L'user root n'a pas les droits de Dieu lorsqu'il est sur une partition NFS à less que la machine de service ne les ait accordés.