You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

执行supervisorctl reload时出现socket.error(Errno 2)错误求助

Fixing "socket.error [Errno 2] No such file or directory" when running supervisorctl reload

Hey there, that error usually pops up when supervisorctl can't reach the Unix socket that supervisord uses to communicate—either the socket file doesn't exist, the path in your config is wrong, or there's a permission issue blocking access. Let's walk through the fixes step by step:

1. Check if supervisord is running

First, confirm the supervisord daemon is actually active. Run this command:

ps aux | grep supervisord

If you don't see a running supervisord process, start it with the appropriate command for your system:

  • For systemd-based distros (Ubuntu 16.04+, CentOS 7+):
    sudo systemctl start supervisord
    
  • For SysV init systems:
    sudo service supervisord start
    

2. Verify the socket path in your config files

Supervisor uses a Unix socket for communication between supervisord and supervisorctl. Let's check if the paths match in both configs:

  1. Open the main supervisord config (typically /etc/supervisord.conf or /etc/supervisor/supervisord.conf) and look for the [unix_http_server] section. You'll see a line like:
    file=/var/run/supervisor.sock   ; the path to the socket file
    
  2. Now check the supervisorctl config (either in the same file under [supervisorctl] or ~/.supervisord.conf). Ensure the serverurl matches the socket path from above:
    serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
    
    Note: The unix:// prefix requires three slashes if using an absolute path.

3. Create the socket file if it's missing

If the socket file (e.g., /var/run/supervisor.sock) doesn't exist, even after starting supervisord, try these steps:

  1. Stop supervisord first:
    sudo systemctl stop supervisord
    # Or for SysV: sudo service supervisord stop
    
  2. Delete any leftover PID file (common cause of startup issues):
    sudo rm -f /var/run/supervisord.pid
    
  3. Restart supervisord with explicit config path to ensure it uses the right settings:
    sudo supervisord -c /etc/supervisord.conf
    
    This should recreate the socket file automatically.

4. Fix permission issues on the socket file

If the socket exists but supervisorctl can't access it, check the file permissions:

  1. Run this to see the current permissions:
    ls -l /var/run/supervisor.sock
    
  2. Adjust permissions to allow your user to access it. For example, if the socket is owned by root:supervisor, add your user to the supervisor group:
    sudo usermod -aG supervisor your_username
    
    Log out and back in for the group change to take effect.
  3. You can also tweak the socket's permissions directly (use cautiously):
    sudo chmod 770 /var/run/supervisor.sock
    

5. Test with explicit config path

If you're still having issues, try running supervisorctl with the explicit config file path to rule out default config mismatches:

sudo supervisorctl -c /etc/supervisord.conf reload

内容的提问来源于stack exchange,提问作者BillDavidup

火山引擎 最新活动