Flask, Nginx, Gunicorn Stack Launching Selenium instance

The chrome startup script /usr/bin/google-chrome has a problem, as indicated by the /usr/bin/google-chrome: line 24: XXX: command not found:

[1563464973.354][INFO]: Launching chrome: /usr/bin/google-chrome [...]
/usr/bin/google-chrome: line 8: readlink: command not found
/usr/bin/google-chrome: line 24: mkdir: command not found
/usr/bin/google-chrome: line 45: exec: cat: not found
/usr/bin/google-chrome: line 46: exec: cat: not found

It might be a simple $PATH problem, meaning that the uWSGI server does not find all the mentioned commands readlink etc. because of it does not have these commands within the $PATH variable.

Warning: I would not allow www-data to access all the command XXX by changing their permissions, these would be a major security issue on a production server!

Instead, I suggest to look at the following SO question: How to fix "usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed" error in Linux?

Alternative: Can you somehow solve your job without using Chrome? What are your reasons for starting an Chrome as a service on a webserver?


Add :/bin to your PATH as shown below:

Environment="PATH=/home/artem/env/bin:/usr/bin:/bin"

mkdir, readlink etc are in /bin path which is not in the modified PATH