unit.service 失败,因为控制进程退出,错误代码为“错误”。这个错误是什么意思?

unit.service 失败,因为控制进程退出,错误代码为“错误”。这个错误是什么意思?

我试图在 中启动一个脚本/etc/init.dubuntu 16.04但它给出了一个错误。我可以手动执行该 (scheduler_slave) 单元中的每个步骤。然而,它在执行脚本时失败了。

有人能解释一下以下错误的含义吗/

我是这个领域的新手,正在尝试弄清楚为什么会出现此错误。如果我遗漏了任何细节,请告诉我。

命令:

sudo /etc/init.d/scheduler_slave start

错误:

[....] Starting scheduler_slave (via systemctl): 
scheduler_slave.serviceJob for scheduler_slave.service failed because 
the control process exited with error code. See "systemctl status 
scheduler_slave.service" and "journalctl -xe" for details.
failed! 

systemctl status scheduler_slave.service

● scheduler_slave.service - LSB: Start scheduler slave at boot
     Loaded: loaded (/etc/init.d/scheduler_slave; bad; vendor preset: 
    enabled)
     Active: failed (Result: exit-code) since Mon 2018-03-12 13:03:39 IST; 
    1h 26min ago
     Docs: man:systemd-sysv-generator(8)
     Process: 7315 ExecStart=/etc/init.d/scheduler_slave start 
    (code=exited, status=203/EXEC)

sudo journalctl-xe

    -- A new session with the ID 80 has been created for the user ubuntu.
--
-- The leading process of the session is 7377.
Mar 12 14:29:24 ubuntu systemd[1]: Started Session 80 of user ubuntu.
-- Subject: Unit session-80.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-80.scope has finished starting up.
--
-- The start-up result is done.
Mar 12 14:32:56 ubuntu sudo[7547]:   ubuntu : TTY=pts/1 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/bin/journalctl -xe
Mar 12 14:32:56 ubuntu sudo[7547]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Mar 12 14:34:29 ubuntu sudo[7547]: pam_unix(sudo:session): session closed for user root
Mar 12 14:34:36 ubuntu sudo[7551]:   ubuntu : TTY=pts/1 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/etc/init.d/scheduler_slave start
Mar 12 14:34:36 ubuntu sudo[7551]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Mar 12 14:34:36 ubuntu systemd[1]: Starting LSB: Start scheduler slave at boot...
-- Subject: Unit scheduler_slave.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit scheduler_slave.service has begun starting up.
Mar 12 14:34:36 ubuntu systemd[7562]: scheduler_slave.service: Failed at step EXEC spawning /etc/init.d/scheduler_slave: Exec format error
-- Subject: Process /etc/init.d/scheduler_slave could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /etc/init.d/scheduler_slave could not be executed and failed.
--
-- The error number returned by this process is 8.
Mar 12 14:34:36 ubuntu systemd[1]: scheduler_slave.service: Control process exited, code=exited status=203
Mar 12 14:34:36 ubuntu systemd[1]: Failed to start LSB: Start scheduler slave at boot.
-- Subject: Unit scheduler_slave.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit scheduler_slave.service has failed.
--
-- The result is failed.
Mar 12 14:34:36 ubuntu systemd[1]: scheduler_slave.service: Unit entered failed state.
Mar 12 14:34:36 ubuntu systemd[1]: scheduler_slave.service: Failed with result 'exit-code'.
Mar 12 14:34:36 ubuntu sudo[7551]: pam_unix(sudo:session): session closed for user root
Mar 12 14:34:47 ubuntu sudo[7594]:   ubuntu : TTY=pts/1 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/bin/journalctl -xe
Mar 12 14:34:47 ubuntu sudo[7594]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)

答案1

您粘贴的错误是“Exec 格式错误”。

已经有一个“Exec 格式错误”的可能原因数Stack Exchange 网络中有记录。我建议查看该答案。

此外,如果可以的话,请避免将 systemd 配置文件与 /etc/init.d 中的旧版“sysVinit”scrypts 混合使用。它们可以协同工作,但会使问题更难调试。我建议systemd尽可能单独使用。

相关内容