cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
568 stars 104 forks source link

cherokee-admin won't start on fresh install - [ERROR] - Could not figure environment variables #1220

Closed TheDcoder closed 5 years ago

TheDcoder commented 5 years ago

Cherokee Admin (cherokee-admin) won't start in my fresh unmodified installation of the cherokee package from the official Fedora repository.

This is the full output from the cherokee-admin-launcher:

TheDcoder@BeastLappy ~> cherokee-admin-launcher --debug
[ERROR] - Could not figure cherokee-admin environment variables

Not much to go on but I have not made any modifications before I started the launcher from my terminal, I have checked the documentation but it does not list anything about environmental variables so I am pretty confused about this one.

Hopefully not a bug, thanks for the help in advance!

skinkie commented 5 years ago

Could you check what the output is from cherokee-admin directly? Does your python binary point to python2?

TheDcoder commented 5 years ago

@skinkie I might have found the problem, cherokee-admin is not in my $PATH:

TheDcoder@BeastLappy ~> cherokee-admin --debug
fish: Unknown command cherokee-admin
TheDcoder@BeastLappy ~> which python
/usr/bin/python
TheDcoder@BeastLappy ~> python --version
Python 2.7.16
TheDcoder@BeastLappy ~> echo $PATH
/usr/local/bin /usr/bin /bin
skinkie commented 5 years ago

Typically 'sbin' should be in your path, hence /usr/local/sbin or /usr/sbin. It might be that everything is resolved once you do 'sudo' or 'su' first.

TheDcoder commented 5 years ago

@skinkie Sadly running as root has not fixed the issue:

TheDcoder@BeastLappy ~> sudo cherokee-admin-launcher
[ERROR] - Could not figure cherokee-admin environment variables

Typically 'sbin' should be in your path, hence /usr/local/sbin or /usr/sbin.

You are right, I can find the binaries inside /usr/sbin:

/usr/sbin/cherokee
/usr/sbin/cherokee-admin
/usr/sbin/cherokee-worker

I tried running cherokee-admin directly as root and it did the trick!

TheDcoder@BeastLappy /tmp> sudo cherokee-admin
Cherokee Web Server 1.2.104 (Jan 31 2019): Listening on port 127.0.0.1:9090,
TLS disabled, IPv6 enabled, using epoll, 4096 fds system limit, max. 2041
connections, 4 threads, 510 connections per thread, standard scheduling policy

Login:
  User:              admin
  One-time Password: <REDACTED>

Web Interface:
  URL:               http://127.0.0.1:9090/

So this seems like an issue more relevant to the package in Fedora's repository itself... since cherokee-admin-launcher is not properly functioning.

I have another unrelated question, isn't it dangerous to run the server with root privileges?

skinkie commented 5 years ago

I have another unrelated question, isn't it dangerous to run the server with root privileges?

cherokee-admin is bound to localhost, and it has username/password credentials. It is not the same server instance as you would run for your own website. If you configure cherokee the right way you have the option to specify a deligated user such as www-data or nobody. Cherokee would fork the cherokee-worker process running as this user.

http://cherokee-project.com/doc/config_general.html (Server Permissions)

TheDcoder commented 5 years ago

Thanks for clearing my doubts :smile: