rc.localが起動時に起動しない

rc.localが起動時に起動しない
● rc-local.service - /etc/rc.local Compatibility
     Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/rc-local.service.d
             └─debian.conf
             /etc/systemd/system/rc-local.service.d
             └─ttyoutput.conf
     Active: failed (Result: exit-code) since Thu 2023-02-09 22:15:36 PST; 13min ago
       Docs: man:systemd-rc-local-generator(8)
    Process: 513 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)
        CPU: 9ms

Feb 09 22:15:36 raspberrypi systemd[1]: Starting /etc/rc.local Compatibility...
Feb 09 22:15:36 raspberrypi systemd[513]: rc-local.service: Failed to execute /etc/rc.local: Exec format error
Feb 09 22:15:36 raspberrypi systemd[513]: rc-local.service: Failed at step EXEC spawning /etc/rc.local: Exec format>
Feb 09 22:15:36 raspberrypi systemd[1]: rc-local.service: Control process exited, code=exited, status=203/EXEC
Feb 09 22:15:36 raspberrypi systemd[1]: rc-local.service: Failed with result 'exit-code'.
Feb 09 22:15:36 raspberrypi systemd[1]: Failed to start /etc/rc.local Compatibility.

~~~~~

これはrc.localファイルです。

python3 /home/sheepify/Desktop/main.py &
exit 0

私はパイ4モデルb 8GBラムにラズベリーパイOSを使用しています。

ベストアンサー1

/etc/rc.localの上部にあることを確認してください。

#!/bin/sh -e

/etc/rc.localの最後にこれがあることを確認してください。

exit 0

おすすめ記事