Reply To: kusanagi restartに失敗する

TOP Forums バグ報告と提案(Requests and Feedback) kusanagi restartに失敗する Reply To: kusanagi restartに失敗する

#1673
Hodokami
Participant

    hideishi さん
    ありがとうございます。結論から申し上げると私の方の問題は解消いたしました。

    systemctl restart kusanagi では解消しませんでした。その際の /var/opt/kusanagi/log/kusanagi/backend.log は以下のようになっておりました。

    
    Traceback (most recent call last):
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/executor.py", line 180, in async_execute_command
        process = await asyncio.create_subprocess_exec(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec
        transport, protocol = await loop.subprocess_exec(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/asyncio/base_events.py", line 1756, in subprocess_exec
        transport = await self._make_subprocess_transport(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/asyncio/unix_events.py", line 211, in _make_subprocess_transport
        transp = _UnixSubprocessTransport(self, protocol, args, shell,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/asyncio/base_subprocess.py", line 36, in __init__
        self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
      File "/opt/kusanagi/python312/lib64/python3.12/asyncio/unix_events.py", line 820, in _start
        self._proc = subprocess.Popen(
                     ^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/subprocess.py", line 1026, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/opt/kusanagi/python312/lib64/python3.12/subprocess.py", line 1955, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/opt/kusanagi/nginx/sbin/nginx'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/importer.py", line 284, in async_dispatch_stream
        await self._dispatcher.async_action(
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/decorators.py", line 225, in wrapper
        returncode = await func(
                     ^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/dispatchers/restart.py", line 55, in async_action
        returncode = await super().async_action(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/dispatchers/restart.py", line 61, in async_action
        returncode = await service.async_test(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/service/mixins/group.py", line 216, in async_test
        await unit.async_test(
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/service/units/nginx.py", line 151, in async_test
        return await async_execute_command(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/kusanagi/python312/lib64/python3.12/site-packages/kusanagi/_k10/executor.py", line 210, in async_execute_command
        raise KusanagiExecutionError(
    kusanagi._k10.errors.KusanagiExecutionError: '/opt/kusanagi/nginx/sbin/nginx -t -c /etc/opt/kusanagi/nginx/nginx.conf' returned 2
    

    そこで /etc/systemd/system/multi-user.target.wants/ を確認したところリンク切れの nginx.service が確かに存在しました。

    
    $ ls -la /etc/systemd/system/multi-user.target.wants/ | grep nginx
    lrwxrwxrwx.  1 root root   37 12月 19  2023 nginx.service -> /usr/lib/systemd/system/nginx.service
    lrwxrwxrwx.  1 root root   40  6月 11 10:54 nginx131.service -> /usr/lib/systemd/system/nginx131.service
    

    こちらのシンボリックリンクを削除したところ kusanagi restart が完走するようになりました。ありがとうございました。

    
    $ kusanagi restart
    nginx: the configuration file /etc/opt/kusanagi/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/opt/kusanagi/nginx/nginx.conf test is successful
    [29-Jul-2026 09:59:09] NOTICE: configuration file /etc/opt/kusanagi/php-fpm.conf test is successful
    restart completed.