'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?

I have a running system with Ubuntu 16.04, Apache 2.4.18, PHP 7.3 and 7.4, PHP-FPM, PHP FastCGI, MPM event.

I wanted to upgrade to the latest Apache version (2.4.46-2+ubuntu16.04.1+deb.sury.org+3 amd64 [upgradable from: 2.4.18-2ubuntu3.17]) as follows:

add-apt-repository -y ppa:ondrej/apache2

apt update

apt-get --only-upgrade install apache2

service apache2 restart

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

journalctl -xe

apachectl[9010]: [:crit] [pid 9013] (38)Function not implemented: AH00141: Could not initialize random number generator

I checked and /dev/random and /dev/urandom are installed. Kernel: 4.4.0-042stab141.2 and libc6: 2.23-0ubuntu11.2



Solution 1:[1]

Happened to me after upgrading apache to version 2.4.46 on Ubuntu as well. I found out it was the kernel version.

I knew I did apt-get upgrade and the kernel should be latest version, Also running sudo update-grub Showed me newer versions, but running uname -r showed very old kernel.

After a long investigation that took almost all day and trying everything I found online about upgrading Ubuntu kernel - I found out it was Digitalocean, not me. Old droplets use external managed kernel - so no matter what you do on your environment, it will always take the external kernel. The solution was here: https://www.digitalocean.com/docs/droplets/how-to/kernel/grubloader/#switch

If you do see the drop down & change button in your droplet settings in Digital ocean control panel, then your kernel is externally managed. In that drop down type “grub” and choose GrubLoader v0.2, press “change” button & that’s it!

Now you’ll need to shut down & turn back on your server, but before you do so I suggest to run the following commands: sudo apt-get update sudo apt-get upgrade

The above upgrade will update the whole system. To update just kernel run the above update command followed by: sudo apt-get upgrade linux-image-generic

Now shut down (sudo poweroff or power off from DigitalOcean interface, though doing it from CLI is preferred). Note that reboot is not sufficient in this particular case and a complete shut down is needed (Thanks @gauss256 for your comment). Then power it back on from digital ocean interface, And upon startup you should see a new kernel version.

Tip - you might want to delete old Kernel files after the reboot, this can be done by: sudo apt-get purge $( dpkg --list | grep -P -o "linux-image-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1