How to fix daemon reload access dined issue? - nginx

"systemctl enable openresty"
What I get
Synchronizing state of openresty.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable openresty
Failed to reload daemon: Access denied
Failed to reload daemon: Access denied
Failed to enable unit: Access denied
This the the screenshot
systemctl status openresty
openresty.service - The NGINX HTTP and reverse proxy server
Loaded: loaded (/lib/systemd/system/openresty.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-08-11 17:01:13 UTC; 2h 37min ago
Process: 8875 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=203/EXEC)
Aug 11 17:01:13 instance-2 systemd{1]: Starting The NGINX HTTP and reverse proxy server...
Aug 11 17:01:13 instance-2 systemd[8875]: openresty.service: Failed to execute command: No such file or directory
Aug 11 17:01:13 instance-2 systemd[8875]: openresty.service: Failed at step EXEC spawning /usr/sbin/nginx: No such file or directory
Aug 11 17:01:13 instance-2 systemd(1]: openresty.service: Control process exited, code=exited, status=203/EXEC
Aug 11 17:01:13 instance-2 systemd(1]: openresty.service: Failed with result 'exit-code'.
Aug 11 17:01:13 instance-2 systemd(1]: Failed to start The NGINX HTTP and reverse proxy server.
This is screenshot
journalctl -u openresty
-- Logs begin at Tue 2021-08-10 17:42:07 UTC, end at Wed 2021-08-11 19:20:05 UTC. --
Aug 10 19:14:22 instance-2 systemd(1]: Starting The OpenResty Application Platform...
Aug 10 19:14:22 instance-2 systemd(1]: Started The OpenResty Application Platform.
Aug 10 22:00:10 instance-2 systemd(1]: Stopping The OpenResty Application Platform...
Aug 10 22:00:10 instance-2 systemd(1]: openresty.service: Succeeded.
Aug 10 22:00:10 instance-2 systemd(1]: Stopped The OpenResty Application Platform.
Aug 10 22:00:10 instance-2 systemd(1]: Starting The OpenResty Application Platform...
Aug 10 22:00:10 instance-2 nginx[4012]: nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/openresty/sites-enabled/m.facebook.com.conf:7
Aug 10 22:00:10 instance-2 nginx[4012]: nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
Aug 10 22:00:10 instance-2 systemd(1]: openresty.service: Control process exited, code=exited, status=1/FAILURE
Aug 10 22:00:10 instance-2 systemd(1]: openresty.service: Failed with result 'exit-code'.
Aug 10 22:00:10 instance-2 systemd(1]: Failed to start The OpenResty Application Platform.
Aug 10 22:01:15 instance-2 systemd(1]: Starting The OpenResty Application Platform...
Aug 10 22:01:15 instance-2 nginx[4034]: nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/openresty/sites-enabled/m.facebook.com.conf:7
Aug 10 22:01:15 instance-2 nginx[4034]: nginx: configuration file /usr/local/openresty/nginx/conf/nginx. conf test failed
Aug 10 22:01:15 instance-2 systemd(1]: openresty. service: Control process exited, code=exited, status=1/FAILURE
Aug 10 22:01:15 instance-2 systemd(1]: openresty.service: Failed with result 'exit-code'.
Aug 10 22:01:15 instance-2 systemd(1]: Failed to start The OpenResty Application Platform.
Aug 11 17:01:13 instance-2 systemd(1]: Starting The NGINX HTTP and reverse proxy server...
Aug 11 17:01:13 instance-2 systemd[8875]: openresty.service: Failed to execute command: No such file or directory
Aug 11 17:01:13 instance-2 systemd[8875]: openresty.service: Failed at step EXEC spawning / usr /sbin / nginx : No such file or directory
Aug 11 17:01:13 instance-2 systemd(1]: openresty.service: Control process exited, code=exited, status=203/EXEC
Aug 11 17:01:13 instance-2 systemd(1]: openresty.service: Failed with result 'exit-code'.
Aug 11 17:01:13 instance-2 systemd(1]: Failed to start The NGINX HTTP and reverse proxy server.
This is screenshot

Sounds like you are trying to enable a service, from an account that is not privileged.
You may be able to use sudo, if the system is configured to allow this:
sudo systemctl enable openresty
If not, you would have to login as root:
su
[enter your root password]
systemctl enable openresty

Related

Issues starting up nginx with conf files

I had setup my nginx server fine last week until I noticed I was receiving DOSS attacks against it. I then noticed at this point my Nginx server was failing to start. I have tried everything else and unsure what to do to resolve the issue apart from reading documentation which does not help.
Documentation on Nginx
main nginx.conf appears to be empty and I cannot save to it for some reason.
root#ubuntu-vpc-do-moon:~# /etc/init.d/nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-11-04 10:54:44 UTC; 1min 43s ago
Docs: man:nginx(8)
Process: 2550 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 04 10:54:44 ubuntu-vpc-do-moon nginx[2550]: nginx: [emerg] open() "/etc/nginx/sites-enabled/nginx.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
Nov 04 10:54:44 ubuntu-vpc-do-moon nginx[2550]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: nginx.service: Control process exited, code=exited status=1
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: nginx.service: Failed with result 'exit-code'.
Nov 04 10:54:44 ubuntu-vpc-do-moon systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Removed Nginx from ubuntu and done a clean installation onto server. Managed to sort the server blocks out this time so all good.

OpenStack Keystone Identity Service Httpd Failed (rocky version)

Hello and thanks for taking some of your time to check my problem
i'm following the detailed steps by openstack to install openstack in no avail (https://docs.openstack.org/keystone/rocky/install/keystone-install-rdo.html)
I've tried to change the 5000 port for the service but the result is the same
any insights are most welcomed
[root#localhost i-openstack]# systemctl enable httpd.service
[root#localhost i-openstack]# systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root#localhost i-openstack]# journalctl -xe
Oct 08 05:12:39 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Oct 08 05:12:39 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Oct 08 05:12:39 localhost.localdomain systemd[1]: httpd.service failed.
Oct 08 05:12:39 localhost.localdomain polkitd[1824]: Unregistered Authentication Agent for unix-process:4229:106865 (system bus name :1.42, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Oct 08 05:27:21 localhost.localdomain polkitd[1824]: Registered Authentication Agent for unix-process:4930:195069 (system bus name :1.43 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale
Oct 08 05:27:21 localhost.localdomain systemd[1]: Reloading.
Oct 08 05:27:21 localhost.localdomain polkitd[1824]: Unregistered Authentication Agent for unix-process:4930:195069 (system bus name :1.43, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Oct 08 05:27:26 localhost.localdomain polkitd[1824]: Registered Authentication Agent for unix-process:4950:195568 (system bus name :1.44 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale
Oct 08 05:27:26 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Oct 08 05:27:26 localhost.localdomain httpd[4956]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:5000
Oct 08 05:27:26 localhost.localdomain httpd[4956]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:5000
Oct 08 05:27:26 localhost.localdomain httpd[4956]: no listening sockets available, shutting down
Oct 08 05:27:26 localhost.localdomain httpd[4956]: AH00015: Unable to open logs
Oct 08 05:27:26 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 08 05:27:26 localhost.localdomain kill[4958]: kill: cannot find process ""
Oct 08 05:27:26 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Oct 08 05:27:26 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Oct 08 05:27:26 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Oct 08 05:27:26 localhost.localdomain systemd[1]: httpd.service failed.
Oct 08 05:27:26 localhost.localdomain polkitd[1824]: Unregistered Authentication Agent for unix-process:4950:195568 (system bus name :1.44, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Oct 08 05:34:01 localhost.localdomain polkitd[1824]: Registered Authentication Agent for unix-process:5222:235020 (system bus name :1.45 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale
Oct 08 05:34:01 localhost.localdomain systemd[1]: Reloading.
Oct 08 05:34:01 localhost.localdomain polkitd[1824]: Unregistered Authentication Agent for unix-process:5222:235020 (system bus name :1.45, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Oct 08 05:34:03 localhost.localdomain polkitd[1824]: Registered Authentication Agent for unix-process:5240:235248 (system bus name :1.46 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale
Oct 08 05:34:03 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
SOLUTION : It seemed i had to disable SELinux
Disable temporaliy
sudo setenforce 0
Restart httpd service
service httpd restart
Disable SELinux persistently (reboot required)
nano /etc/selinux/config
SELINUX=disabled

Error installing Apache Cloudstack management on Ubuntu 16.0.4

I am installing Apache cloudstack on ubuntu 16.0.4, but after installing cloudstack setup when I start services of cloudstack management service it displayed the following errors. (I have installed tomcat7, but tomcat 6 is not installed)
Warning: cloudstack-management.service changed on disk. Run 'systemctl daemon-reload' to reload units. Job for
cloudstack-management.service failed because the control process
exited with error code. See "systemctl status
cloudstack-management.service" and "journalctl -xe" for details.
I have checked systemctl status cloudstack-management.service command and it displays the following:
cloudstack-management.service - LSB: Start Tomcat (CloudStack).
Loaded: loaded (/etc/init.d/cloudstack-management; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-08-25 21:53:07 IST; 1min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 26684 ExecStart=/etc/init.d/cloudstack-management start (code=exited, status=1/FAILURE)
Aug 25 21:53:07 dhaval-pc systemd[1]: Starting LSB: Start Tomcat (CloudStack)....
Aug 25 21:53:07 dhaval-pc cloudstack-management[26684]: * cloudstack-management is not installed
Aug 25 21:53:07 dhaval-pc systemd[1]: cloudstack-management.service: Control process exited, code=exited status=1
Aug 25 21:53:07 dhaval-pc systemd[1]: Failed to start LSB: Start Tomcat (CloudStack)..
Aug 25 21:53:07 dhaval-pc systemd[1]: cloudstack-management.service: Unit entered failed state.
Aug 25 21:53:07 dhaval-pc systemd[1]: cloudstack-management.service: Failed with result 'exit-code'.
Warning: cloudstack-management.service changed on disk. Run 'systemctl daemon-reload' to reload units.
What change can I make in vi /etc/init.d/cloudstack-management file?

Kibana - process not starting- log not clear

Running on Ubuntu 16.4
Elastic version: 6.2.4
Kibana version: 6.2.4
Elastic is up and running on port 9200.
Kibana suddenly stopped working, I am trying to run the start command: sudo systemctl start kibana.service and I get the following error in the service stdout(journalctl -fu kibana.service):
Started Kibana.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Unit entered failed state.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Failed with result 'exit-code'.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Service hold-off time over, scheduling restart.
Aug 27 12:54:33 ubuntuserver systemd[1]: Stopped Kibana.
No details on this log.
My yaml configuration has only this props:
server.port: 5601
server.host: "0.0.0.0"
I also have tried writing to a log file(hoping for more info there), I tried adding this configurations:
logging.dest: /var/log/kibana/kibana.log
logging.verbose: true
I gave the folder/file full access control but nothing is being written there(still writing to the stdout)

502 Bad Gateway and failed to read PID from file /run/nginx.pid: Invalid argument using nginx and gunicorn

I already successfully deployed nginx and gunicorn in my centos 7 server but got 502 Bad Gateway error message. I'm using nginx/1.12.2. I already check both status for gunicorn and nginx.
gunicorn status
● deepagi.service - Gunicorn instance to serve deepagi
Loaded: loaded (/etc/systemd/system/deepagi.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2017-12-02 10:49:30 UTC; 41min ago
Main PID: 1829 (gunicorn)
CGroup: /system.slice/deepagi.service
├─1829 /root/deepagi/deepagienv/bin/python2 /root/deepagi/deepagienv/bin/gunicorn --workers 3 --bind unix:deepagi.sock -m 007 wsgi
├─1834 /root/deepagi/deepagienv/bin/python2 /root/deepagi/deepagienv/bin/gunicorn --workers 3 --bind unix:deepagi.sock -m 007 wsgi
├─1839 /root/deepagi/deepagienv/bin/python2 /root/deepagi/deepagienv/bin/gunicorn --workers 3 --bind unix:deepagi.sock -m 007 wsgi
└─1840 /root/deepagi/deepagienv/bin/python2 /root/deepagi/deepagienv/bin/gunicorn --workers 3 --bind unix:deepagi.sock -m 007 wsgi
Dec 02 10:49:30 DeepAGI systemd[1]: Started Gunicorn instance to serve deepagi.
Dec 02 10:49:30 DeepAGI systemd[1]: Starting Gunicorn instance to serve deepagi...
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1829] [INFO] Starting gunicorn 19.7.1
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1829] [INFO] Listening at: unix:deepagi.sock (1829)
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1829] [INFO] Using worker: sync
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1834] [INFO] Booting worker with pid: 1834
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1839] [INFO] Booting worker with pid: 1839
Dec 02 10:49:30 DeepAGI gunicorn[1829]: [2017-12-02 10:49:30 +0000] [1840] [INFO] Booting worker with pid: 1840
nginx status
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2017-12-02 11:16:18 UTC; 14min ago
Main PID: 2317 (nginx)
CGroup: /system.slice/nginx.service
├─2317 nginx: master process /usr/sbin/nginx
└─2318 nginx: worker process
Dec 02 11:16:18 DeepAGI systemd[1]: Starting The nginx HTTP and reverse proxy server...
Dec 02 11:16:18 DeepAGI nginx[2312]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Dec 02 11:16:18 DeepAGI nginx[2312]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Dec 02 11:16:18 DeepAGI systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
Dec 02 11:16:18 DeepAGI systemd[1]: Started The nginx HTTP and reverse proxy server.
But I saw in nginx status got this kind of error message
Dec 02 11:16:18 DeepAGI systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument
How to solve this?

Resources