Could not start uwsgi process

Beyond the main socket there could be also a stats socket. :) The error log actually could be more specific abouth the path that isn't mentioned.


I was running into a very similar issue, except it still wouldn't work even after deleting the socket file. Turns out it was because uWSGI couldn't create a new one (it only existed because I ran uwsgi myself). The infuriatingly simple solution was to chmod the directory containing the socket file, allowing the www user to create and modify files there. Obvious now, but maybe this will help a future poor sap bashing their head against a wall, as I have been for too many hours today.

root@srv16:/var/run/uwsgi> ls -la
total 0
drwxr-xr-x  2 root    root      60 Jul 16 07:11 .          #<-- problem
drwxr-xr-x 25 root    root     880 Jul 19 09:14 ..
srw-rw----  1 www-app www-data   0 Jul 16 07:11 app.socket 
               #^-- no idea how www-app managed to create that file

root@simsrv16:/var/run/uwsgi> chmod 777 .                  #<-- fix

The key is:

error removing unix socket, unlink(): Permission denied [core/socket.c  line 198]

You (very probably) previously run a uwsgi instance as root creating the unix socket file with root permissions.

Now your instance (running instead as www) is not able to re-bind() that socket as it is not able to unlink it (no permissions)

Just remove the socket file and retry.