I have service which was working fine with RHEL 7.5, now I have upgraded to RHEL 8 and same service is failing with below status:
Service.service - LSB: Web Server
Loaded: loaded (/etc/rc.d/init.d/Service; generated)
Active: failed (Result: protocol) since Mon 2020-04-06 12:02:21 IST; 38min ago
Docs: man:systemd-sysv-generator(8)
Process: 403 ExecStart=/etc/rc.d/init.d/Service start (code=exited, status=0/SUCCESS)
Apr 06 12:02:21 localhost.localdomain systemd[1]: Starting LSB: Web Server...
Apr 06 12:02:21 localhost.localdomain Service[403]: httpd (pid 29434) already running
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain:
/usr/local/apache/logs/Service.pid
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain:
/usr/local/apache/logs/Service.pid
Apr 06 12:02:21 localhost.localdomain systemd[1]: Service.service: Failed with result 'protocol'.
Apr 06 12:02:21 localhost.localdomain systemd[1]: Failed to start LSB: Web Server
THis is my Service unit placed under /etc/init.d/Service, same is done for RHEL 7.5 but there this service is working and in RHEL 8 it is not. One more thing here to note is web server is working as expected although giving me this error.
#!/bin/sh
#
# chkconfig: 345 97 03
# description:Web Server
# processname: httpd
# config: /usr/local/Test/apache/conf/httpd.conf
# pidfile: /usr/local/Test/apache/logs/httpd.pid
### BEGIN INIT INFO
# Provides: Service
# Required-Start: $remote_fs $network $syslog
# Should-Start:
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6`enter code here`
# Short-Description: Web Server
# Description: Web Server
### END INIT INFO
LANG=en_US.iso88591
export LANG
BASEDIR=/usr/local/Test/apache
PATH=$BASEDIR/bin:/usr/bin:/bin
export PATH
LD_LIBRARY_PATH=$BASEDIR/lib
export LD_LIBRARY_PATH
inst=/usr/local/Test
MIBDIRS=$inst/mibs
export MIBDIRS
case $1 in
start)
apachectl start
;;
stop)
apachectl stop
;;
restart)
apachectl restart
;;
*)
echo "usage: $0 { start | stop | restart }"
;;
esac
Plz help me into this.
Related
I am a bit puzzled about this... Apache status is showing information from 12 days ago. It's running fine and website is working. Is the status command not supposed to show current state of Apache?
# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-01-05 05:19:24 CET; 1 weeks 5 days ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 514 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jan 05 05:19:24 serverX systemd[1]: Starting The Apache HTTP Server...
Jan 05 05:19:24 serverX apachectl[532]: AH00112: Warning: DocumentRoot [/some/dir] does not exist
Jan 05 05:19:24 serverX apachectl[532]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 10.42.24.6:80
Jan 05 05:19:24 serverX apachectl[532]: no listening sockets available, shutting down
Jan 05 05:19:24 serverX apachectl[532]: AH00015: Unable to open logs
Jan 05 05:19:24 serverX apachectl[514]: Action 'start' failed.
Jan 05 05:19:24 serverX apachectl[514]: The Apache error log may have more information.
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jan 05 05:19:24 serverX systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 05 05:19:24 serverX systemd[1]: Failed to start The Apache HTTP Server.
OS: Ubuntu 20
netstat shows that port 80 is actually listening on 10.42.24.6
# netstat -tulpn | grep apache
tcp 0 0 10.42.24.6:80 0.0.0.0:* LISTEN 1557/apache2
tcp 0 0 10.42.24.6:443 0.0.0.0:* LISTEN 1557/apache2
Also Apache is logging requests to the access logs
I noticed this problem, because I am using systemctl status apache2 to check apache status in a new shell script I wrote... But the way this command is working, makes it useless.
Apache does not start after installing the web server. (CentOS 7)
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2020-03-28 12:18:22 MSK; 16ms ago
Docs: man:httpd.service(8)
Process: 30144 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 30144 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Starting The Apache HTTP Server...
Mar 28 12:18:22 box-40395.localdomain httpd[30144]: AH00526: Syntax error on line 103 of /etc/httpd/conf.d/ssl.conf:
Mar 28 12:18:22 box-40395.localdomain httpd[30144]: SSLCertificateFile: file '/etc/pki/tls/certs/localhost.crt' does not exist or is empty
Mar 28 12:18:22 box-40395.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Mar 28 12:18:22 box-40395.localdomain systemd[1]: Unit httpd.service entered failed state.
Mar 28 12:18:22 box-40395.localdomain systemd[1]: httpd.service failed.
You could try by creating a fake certificate.
In centos there is a handy script which might help
$ cd /etc/pki/tls/certs
$ sudo ./make-dummy-cert localhost.crt
This script produces a self-signed certificate and the certificate's private key.
Therefore SSLCertificateKeyFile in /etc/httpd/conf.d/ssl.conf could be commented out
SLCertificateFile /etc/pki/tls/certs/localhost.crt
# SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
Otherwise service won't start
The error message is very clear:
SSLCertificateFile: file /etc/pki/tls/certs/localhost.crt does not exist or is empty
Remove this invalid configuration or add missing/fix existing certificate file. Either way to have to fix the configuration before Apache can start.
Obtaining an SSL certificate is out of the scope for StackOverflow. There're plenty of resources on the web, you can try on ServerFault too…
When you're done, simply sudo systemctl start httpd to start Apache.
I can't start my apache server on debian 9.
I tried reinstall :
sudo apt-get autoremove --purge apache2 && sudo apt-get install apache2
but no change...
Job for apache2.service failed because of unavailable resources or another system error.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "restart" failed.
systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: resources)
journalctl -xeu apache2.service
(I set loglevel to debug mod)
Sep 05 11:45:44 systemd[1]: apache2.service: Failed with result 'resources'.
Sep 05 11:50:26 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:27 systemd[1]: apache2.service: Trying to enqueue job apache2.service/stop/replace
Sep 05 11:50:27 systemd[1]: apache2.service: Installed new job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Enqueued job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Job apache2.service/stop finished, result=done
Sep 05 11:50:27 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:30 systemd[1]: apache2.service: Failed to run 'start' task: No such file or directory
Sep 05 11:50:30 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Sep 05 11:50:30 systemd[1]: apache2.service: Failed with result 'resources'.
what's wrong?
Maybe this is a problem with service 'tmp' directory. I has a similar error with systemd-resolved.service, and reason was missing '/var/tmp' directory after system migration. Check what temp directory the service is using and create it if necessary.
Also, if there is systemd newly running and crap in /var/tmp/, you might have to clear up this crap and try running the service again.
In my case it turned out to be this (without apache2 running at the time):
root#www:/var/tmp # ls -al
total 32
drwxrwxrwt 8 root root 4096 Dec 15 12:48 .
drwxr-xr-x 14 root root 4096 Jul 8 21:43 ..
drwx------ 2 root root 4096 Dec 15 12:48 systemd-private-1dcdfe608b6c41f387936225d86126c7-apache2.service-L0KeaS
drwx------ 2 root root 4096 Dec 8 03:09 systemd-private-39294ac7bf4b44198d87d45660dcbac2-phpsessionclean.service-4ShLZm
drwx------ 2 root root 4096 Dec 15 04:00 systemd-private-451ad0c3bfe6435891a80a6c714a222b-apache2.service-YQyZes
drwx------ 2 root root 4096 Dec 15 07:09 systemd-private-451ad0c3bfe6435891a80a6c714a222b-phpsessionclean.service-5L25TU
drwx------ 3 root root 4096 Dec 15 03:53 systemd-private-68bc1493e8804c968af642a2319c4e79-apache2.service-RY1iLF
I'm using RHEL 7.4 OS. I have done systemctl disable httpd.service to disable auto start of httpd. It is disabled also.
[root#clustermrfc002 ~]# systemctl is-enabled httpd
disabled.
But on reboot httpd service is starting.
Jul 28 18:02:07 clustermrfc002.novalocal systemd[1]: Starting The Apache HTTP Server...
Jul 28 18:02:08 clustermrfc002.novalocal httpd[8732]: [Sat Jul 28 18:02:08.357617 2018] [core:warn] [pid 8732] AH00117: Ignoring deprecated use
Jul 28 18:02:08 clustermrfc002.novalocal systemd[1]: Started The Apache HTTP Server.
which is causing problem in rhel 7 pacemaker cluster, below error is seen.
Jul 28 18:12:23 clustermrfc001 pengine[7420]: error: Resource MNGT_httpd_rhcdDaemon (systemd::httpd) is active on 2 nodes attempting recovery
Check the output of "chkconfig" and review its runlevel.
Or, check if any other service for HTTPD is enabled using "systemctl list-unit-files", if enabled, disable and verify
Although httpd.service is disabled to start on boot, its started by network.target as a dependency.
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Network.
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting /etc/rc.d/rc.local Compatibility...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Postfix Mail Transport Agent...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Dynamic System Tuning Daemon...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting Simple Network Management Protocol (SNMP) Daemon....
Jul 26 15:02:41 localhost.localdomain systemd[1]: Starting
The Apache HTTP Server...
I started my laptop after almost a month. Accessing localhost is giving me below error:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Mon 2017-08-21 20:13:20 GST; 1min 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 11127 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 11110 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Stopped LSB: Apache2 web server.
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Starting LSB: Apache2 web server...
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: * Starting Apache httpd web server apache2
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: Segmentation fault
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: Action 'start' failed.
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11110]: The Apache error log may have more information.
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11127]: * Stopping Apache httpd web server apache2
Aug 21 20:13:20 user-HP-ProBook-6470b apache2[11127]: *
Aug 21 20:13:20 user-HP-ProBook-6470b systemd[1]: Started LSB: Apache2 web server.
I am using Ubuntu 16.04 with following Apache2 version:
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-07-14T12:32:26
I tried changing httpd.conf as mentioned in other articles, but that didn't helped and I still continue to get this error. Any help would be appreciated.