Fix: supervisor.sock no such file
How to fix an obscure error from supervisor with the .sock file.
By. Jacob
Edited: 2022-10-31 10:18
unix:///var/run/supervisor.sock no such file
This error message can probably occur in response to numerous of circumstances, but there is one particularly stupid reason as to why this happens: an invalid process configuration file.
Having an invalid process configuration means that the supervisor service will not start properly, and hence the .sock file is never created. The fix is, probably not surprisingly, simple: make sure your process configuration is valid.
Another symptom of this error can be seen when running supervisorctl reload. E.g:
error: <class 'FileNotFoundError'>, [Errno 2] No such file or directory: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560
Supervisor typically stores the process configuration in /etc/supervisor/conf.d/, you should make sure that each file in this location has a valid configuration. A valid configuration looks like this:
[program:scheduled-task-run]
command=php /var/www/shopware/bin/console scheduled-task:run -n --memory-limit=256M
user=www-data
numprocs=1
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d
Supervisor is particularly sensitive to invalid configuration files, and does not have a super helpful error message for errors in the configuration.
After fixing your configuration, you should be able to restart the supervisor service:
sudo systemctl stop supervisor
sudo systemctl start supervisor
sudo systemctl restart supervisor
This will fix the supervisorctl command as well:
sudo supervisorctl status
sudo supervisorctl reload
sudo supervisorctl restart all
Tell us what you think: