Can't start Apache : Error : Could not initialize random number generator - apache2

My apache server doesn't start, here are my logs
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu systemd[1]: Starting The Apache HTTP Server...
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu apachectl[1333176]: [Tue Nov 01 20:34:46.704027 2022] [:crit] [pid 1333176] (38)Function not implemented: AH00141: Could not initialize random number generator
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu apachectl[1333173]: Action 'start' failed.
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu apachectl[1333173]: The Apache error log may have more information.
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu systemd[1]: apache2.service: Failed with result 'exit-code'.
nov. 01 20:34:46 ns3013535.ip-149-202-76.eu systemd[1]: Failed to start The Apache HTTP Server.
i'm on ubuntu 22.04LTS
kernel version 3.14.32-xxxx-grs-ipv6-64
apache2 version: 2.4.52
libapr1 version: 1.7.0-8
i updated all my package but nothing change
i already followed this thread too : How to fix '(38)Function not implemented: AH00141: Could not initialize random number generator' after upgrading Apache from 2.4.18 to 2.4.46?

Related

Apache2 Error AH00072 Reliably determine the server

i want to create a DB, and i'm used to PHPMYADMIN. I wanted to use PHPMYADMIN
for it, but after i install php, i got this error, any clues?
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2023-01-29 00:16:49 UTC; 6min ago
Docs: https://httpd.apache.org/docs/2.4/
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260775]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260775]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260775]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260775]: no listening sockets available, shutting down
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260775]: AH00015: Unable to open logs
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260772]: Action 'start' failed.
Jan 29 00:16:49 ubuntu-4gb-hel1-2 apachectl[260772]: The Apache error log may have more information.
Jan 29 00:16:49 ubuntu-4gb-hel1-2 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jan 29 00:16:49 ubuntu-4gb-hel1-2 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 29 00:16:49 ubuntu-4gb-hel1-2 systemd[1]: Failed to start The Apache HTTP Server.

Cannot start Apache2 server on RaspberryPi 4

I installed Apache2 on Raspberry Pi4 B but it is not starting. If anyone had the same issue, please let me know the solution.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-06-07 21:07:32 EEST; 22ms ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 30140 ExecStart=/usr/sbin/apachectl start (code=exited, status=127)
Jun 07 21:07:32 raspberrypi systemd[1]: Starting The Apache HTTP Server...
Jun 07 21:07:32 raspberrypi apachectl[30140]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 07 21:07:32 raspberrypi apachectl[30140]: Action 'start' failed.
Jun 07 21:07:32 raspberrypi apachectl[30140]: The Apache error log may have more information.
Jun 07 21:07:32 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited, status=127/n/a
Jun 07 21:07:32 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 07 21:07:32 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Problem solved with:
sudo apt install --reinstall apache2-bin
sudo service apache2 start

mongod.service active : failed (failed to start mongodb server)

I just started learning mongodb everything was going well until I tried stoping the server using sudo systemctl stop mongod and restarting it usingsudo systemctl start mongod.
now its showing:-
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-01-16 12:39:04 IST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 357998 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 357998 (code=exited, status=1/FAILURE)
Jan 16 12:39:04 prabal-computer systemd[1]: Started MongoDB Database Server.
Jan 16 12:39:04 prabal-computer mongod[357998]: {"t":{"$date":"2021-01-16T07:09:04.669Z"},"s":"F", "c":"CONTROL", "id":20574, "ctx":"main">
Jan 16 12:39:04 prabal-computer systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 16 12:39:04 prabal-computer systemd[1]: mongod.service: Failed with result 'exit-code'.
lines 1-11/11 (END)
whenever I am trying to start and see the status using sudo systemctl status mongod,this error appears.
note: I have already tried reinstalling the mongodb

Apache2 Not Running

I'm running an Apache2 LAMP server with Ubuntu 18.04 and suddenly without a warning, the Apache stops running. I tried figuring out the problem with sudo service apache2 status and it shows the following:
sudo service apache2 status
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Mon 2018-09-03 13:07:40 UTC; 1h 6min ago
Process: 55939 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Main PID: 128448 (code=exited, status=1/FAILURE)
Sep 03 13:07:40 localhost systemd[1]: Starting The Apache HTTP Server...
Sep 03 13:07:40 localhost apachectl[55939]: Action 'start' failed.
Sep 03 13:07:40 localhost apachectl[55939]: The Apache error log may have more information.
Sep 03 13:07:40 localhost systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 03 13:07:40 localhost systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 03 13:07:40 localhost systemd[1]: Failed to start The Apache HTTP Server.
The first thing I do is try to start it manually with sudo apachectl restart which results in the following:
sudo apachectl restart
httpd not running, trying to start
Action 'restart' failed.
The Apache error log may have more information.
So I check the log with sudo view /var/log/apache2/error.log and it shows a very long list as below:
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
PHP Warning: Module 'xmlrpc' already loaded in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
[Mon Sep 03 06:25:03.860913 2018] [ssl:emerg] [pid 128448] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 06:25:03.860996 2018] [ssl:emerg] [pid 128448] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 06:25:03.861009 2018] [ssl:emerg] [pid 128448] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 06:25:03.861060 2018] [ssl:emerg] [pid 128448] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 06:25:03.861077 2018] [ssl:emerg] [pid 128448] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
[Mon Sep 03 06:25:03.861086 2018] [:emerg] [pid 128448] AH00020: Configuration Failed, exiting
[Mon Sep 03 06:41:32.662021 2018] [ssl:emerg] [pid 53226] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 06:41:32.662102 2018] [ssl:emerg] [pid 53226] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 06:41:32.662112 2018] [ssl:emerg] [pid 53226] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 06:41:32.662122 2018] [ssl:emerg] [pid 53226] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 06:41:32.662127 2018] [ssl:emerg] [pid 53226] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 13:05:09.612981 2018] [ssl:emerg] [pid 55512] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 13:05:09.613049 2018] [ssl:emerg] [pid 55512] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:05:09.613058 2018] [ssl:emerg] [pid 55512] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:05:09.613068 2018] [ssl:emerg] [pid 55512] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 13:05:09.613072 2018] [ssl:emerg] [pid 55512] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 13:07:40.617846 2018] [ssl:emerg] [pid 55942] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 13:07:40.618439 2018] [ssl:emerg] [pid 55942] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:07:40.618451 2018] [ssl:emerg] [pid 55942] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:07:40.618461 2018] [ssl:emerg] [pid 55942] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 13:07:40.618466 2018] [ssl:emerg] [pid 55942] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 13:14:43.673776 2018] [ssl:emerg] [pid 56048] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 13:14:43.673881 2018] [ssl:emerg] [pid 56048] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:14:43.673895 2018] [ssl:emerg] [pid 56048] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:14:43.673918 2018] [ssl:emerg] [pid 56048] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 13:14:43.673924 2018] [ssl:emerg] [pid 56048] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 13:24:44.627730 2018] [ssl:emerg] [pid 56066] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 13:24:44.627812 2018] [ssl:emerg] [pid 56066] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:24:44.627822 2018] [ssl:emerg] [pid 56066] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:24:44.627839 2018] [ssl:emerg] [pid 56066] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 13:24:44.627845 2018] [ssl:emerg] [pid 56066] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 13:50:11.691451 2018] [ssl:emerg] [pid 56308] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
[Mon Sep 03 13:50:11.691543 2018] [ssl:emerg] [pid 56308] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: DH PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:50:11.691552 2018] [ssl:emerg] [pid 56308] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: EC PARAMETERS) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Mon Sep 03 13:50:11.691569 2018] [ssl:emerg] [pid 56308] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned
[Mon Sep 03 13:50:11.691574 2018] [ssl:emerg] [pid 56308] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
AH00016: Configuration Failed
[Mon Sep 03 14:07:10.776987 2018] [ssl:emerg] [pid 56364] AH02572: Failed to configure at least one certificate and key for hailiga.org:443
I have tried to phpdismod the three error modules and it didn't work. I am running PHP 7.2 and php7.0-fpm, for SSL I have Let's Encrypt Certbot installed.
Can someone out there please tell me what's going on?
Found the problem, a corrupted code in my apache config file.
For those who have the same problem here's how to fix it:
Go to Apache2 sites-available directory using cd /etc/apache2/sites-available
Disable ALL config files using sudo a2dissite example.com.conf example-2.com.conf ... (Ignore the systemctl reload apache2 now, we will get to it later)
Enable the default config files using sudo a2ensite 000-default.conf
Reload Apache2 with sudo systemctl reload apache2
Enable the config files one by one to find out which one is corrupted using sudo a2ensite test-1.conf and reload apache using sudo systemctl reload apache2 and finally test if it is working with sudo service apache2 status
Once you found the file edit it, fix the problem and off to enable all the config files! Be sure to disable the default using sudo a2dissite 000-default.conf, check the Apache is running with sudo service apache2 status.
There you have it! That's how I fix it anyway. Oh, the disabling and enabling config files might result in pointing to the wrong directory, when you enabled all of them back it should return to normal.
Have a great day :D

"systemctl status apache2.service" error in starting apache2

root#kudo2:~# sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
root#kudo2:~# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-10-03 14:22:01 UTC; 3min 33s ago
Process: 17190 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Oct 03 14:22:01 kudo2 apachectl[17190]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 03 14:22:01 kudo2 apachectl[17190]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 03 14:22:01 kudo2 apachectl[17190]: no listening sockets available, shutting down
Oct 03 14:22:01 kudo2 apachectl[17190]: AH00015: Unable to open logs
Oct 03 14:22:01 kudo2 apachectl[17190]: Action 'start' failed.
Oct 03 14:22:01 kudo2 apachectl[17190]: The Apache error log may have more information.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Control process exited, code=exited status=1
Oct 03 14:22:01 kudo2 systemd[1]: Failed to start The Apache HTTP Server.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Unit entered failed state.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Failed with result 'exit-code'.
root#kudo2:~#
Something else is already using port 80. Try starting apache on a different port or else find out what else is using port 80 and move/kill it.
You could run ss -tlnp|grep -w 80 as a superuser to see which proccess is listening on port 80. This process could be configured to listen on another port. This would free port 80 and allow apache to run.

Resources