buckyos / CYFS

CYFS is the next-generation technology to build real Web3 by upgrading the basic protocol of Web (TCP/IP+DNS+HTTP),is short for CYberFileSystem. https://www.cyfs.com/, cyfs://cyfs/index_en.html.
https://www.cyfs.com/
BSD 2-Clause "Simplified" License
1.99k stars 276 forks source link

Systemctl status of ood-daemon.service is error #251

Open lizhihongTest opened 1 year ago

lizhihongTest commented 1 year ago

I install Linux DIY-OOD, then find that : Systemctl status of ood-daemon.service is error

root :/ood_test# ps -ef | grep -E cyfs/services
root      969956       1  0 20:38 ?        00:00:00 /cyfs/services/ood-daemon/7jMmeXZck8eSjPSkX2FB5LKWvNqMYco3ti4m4mxihssb/bin/ood-daemon --as-monitor
root      970030  969956  8 20:39 ?        00:00:04 /cyfs/services/ood-daemon/7jMmeXZck8eSjPSkX2FB5LKWvNqMYco3ti4m4mxihssb/bin/ood-daemon --start
root      970122  967403  0 20:40 pts/16   00:00:00 grep --color=auto -E cyfs/services
root :/ood_test# 
root :/ood_test# systemctl status ood-daemon.service 
× ood-daemon.service
     Loaded: loaded (/etc/init.d/ood-daemon; generated)
     Active: failed (Result: exit-code) since Thu 2023-05-04 20:34:02 CST; 6min ago
       Docs: man:systemd-sysv-generator(8)
        CPU: 470us

May 04 20:34:02 filecoin2 systemd[1]: Starting ood-daemon.service...
May 04 20:34:02 filecoin2 systemd[969200]: ood-daemon.service: Failed to execute /etc/init.d/ood-daemon: No such file or directory
May 04 20:34:02 filecoin2 systemd[969200]: ood-daemon.service: Failed at step EXEC spawning /etc/init.d/ood-daemon: No such file or directory
May 04 20:34:02 filecoin2 systemd[1]: ood-daemon.service: Control process exited, code=exited, status=203/EXEC
May 04 20:34:02 filecoin2 systemd[1]: ood-daemon.service: Failed with result 'exit-code'.
May 04 20:34:02 filecoin2 systemd[1]: Failed to start ood-daemon.service.
lurenpluto commented 1 year ago

What is the version of your linux, probably related to the specific operating system environment?

weiqiushi commented 1 year ago

This is not a bug, but can be considered for improvement:

ood-daemon takes a monitor dual process mode to keep the ood-daemon service running.

This startup sequence is as follows:

This pattern is not very common in linux services. Moreover, ood-installer is started using the traditional init.rc script mode, which does not require monitoring process status

On some systems that support systemd (ubuntu in this case? Am I right?), it tries to do a compatibility with the traditional init script, but apparently it does so incorrectly here ......

Here you can consider replacing the current init script-based startup with a systemd-based one. But considering that init scripts are more widely supported. I'm still hesitant to replace it

weiqiushi commented 1 year ago

Which popular linux distributions that do not yet support systemd? I think if systemd is a popular choice around popular linux distributions , switching the startup script to systemd is a better choice.

@lizhihongTest

lizhihongTest commented 1 year ago

@weiqiushi This is caused by your script error: /etc/init.d/ood-daemon

/etc/init.d/ood-daemon
-bash: /etc/init.d/ood-daemon: /bin/sh^M: bad interpreter: No such file or directory

This error message means that the interpreter that is specified in the first line of the file ("/bin/sh") cannot be found. The "^M" at the end of the error message is a carriage return character, which is a remnant of Windows-style line endings (which use a combination of carriage return and line feed characters to indicate the end of a line).

To fix this issue, you can remove the carriage return characters from the file

weiqiushi commented 1 year ago

@weiqiushi This is caused by your script error: /etc/init.d/ood-daemon

/etc/init.d/ood-daemon
-bash: /etc/init.d/ood-daemon: /bin/sh^M: bad interpreter: No such file or directory

This error message means that the interpreter that is specified in the first line of the file ("/bin/sh") cannot be found. The "^M" at the end of the error message is a carriage return character, which is a remnant of Windows-style line endings (which use a combination of carriage return and line feed characters to indicate the end of a line).

To fix this issue, you can remove the carriage return characters from the file The /etc/init.d/ood-daemon.sh file, released via ood-installer, is already has unix line endings from long time ago. You can check this by yourself. https://github.com/buckyos/CYFS/blob/main/src/tools/ood-installer/res/default/ood-daemon.sh

weiqiushi commented 1 year ago

Also, if the file /etc/init.d/ood-daemon is invalid, then ood-daemon should not start.

This does not explain the fact that the ood-daemon process exists in your process list.

@lizhihongTest

lizhihongTest commented 1 year ago

The "ood-daemon" process may have been started by "ood-installer" because I ran a DIY-OOD installation package. The error is just caused by the erroneous "^M" character in the script file "/etc/init.d/ood-daemon", and it has no direct relationship with whether the "ood-daemon" process was successfully launched or not.

Pelase you see this error log ,And check your shell code for /etc/init.d/ood-daemon

May 04 20:34:02 filecoin2 systemd[969200]: ood-daemon.service: Failed to execute /etc/init.d/ood-daemon: No such file or directory
May 04 20:34:02 filecoin2 systemd[969200]: ood-daemon.service: Failed at step EXEC spawning /etc/init.d/ood-daemon: No such file or directory
weiqiushi commented 1 year ago

The DIY OOD installation package on the official website is generated by the internal two Windows CI Agent where the linux version is generated by wsl compilation on Windows.

On the two Agents, one of them has not modified the autocrlf configuration of git to false (on Windows, this option is true by default)

The ood-installer compiled by this machine will release the ood-daemon.sh file with the wrong line end when installed

it will be fixed after DIY OOD Installer 1.0.1.33