Question

Apache2 stopped working after upgrade to v2.4 ((38)Function not implemented: AH00141)

Posted March 22, 2021 3.9k views
UbuntuApache

I was happily running apache2 and mysql on a Ubuntu 16.04 server with no problems, but yesterday I noticed that there were a bunch of updates available and I installed them using apt-get.

One of the updates was apache2, upgraded to 2.4.46. Since then, apache stopped working. It returns this error when I try to start it: (38)Function not implemented: AH00141: Could not initialize random number generator. After reading some post online, I decided to upgrade my Ubuntu version to 18.04 (and then to 20.04), the process just finished, but the situation didn’t change, apache is still not working with the same error.

I read to check if /dev/random or /dev/urandom are present on the system, and they are there. I also checked that my PATH does not include any “strange” character, which it does not.

I do not know what to do to have apache working again. Can someone help me? Maybe give me some direction on how to downgrade it, I don’t know, I really have no idea.

The server is running a huge Wordpress installation, the only fallback option I can think of is to switch to nginx, but I do not know how easy it will be to configure wordpress to work with nginx, especially if it is not a new installation.

Thank you in advance,
S.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
3 answers

Hi @leeppolis,

That’s one interesting issue you got there. Unfortunately, I was not able to replicate it :(. Reading online about the issue did not help me in any way as well. I did fine some suggestions which don’t seem relevant or one type of situations only.

Having said that, I do have a suggestion. Copy your configuration files from /etc/apache2/sites-available to a different location, remove Apache2 from your Droplet and install it again. Once you have Apache return your Virtual Host files enable them and see if they are working properly.

This should lead to your problem being fixed.

Please do keep us in the loop on this topic, I’m really interested as to who it will develop!

Regards,
KFSys

  • Hi @leeppolis,

    I just taught about another solution.

    If the above doesn’t help you at all, maybe the issue is with the Kernel. I read a couple of articles where old kernels can cause such issues which is only logical.

    Having said that, check your kernel, see if it’s an older one and if yes try updating it.

    Once the kernel is updated though, you’ll need to update your grub menu and reboot it.

    I would suggest creating a snapshot just in case something doesn’t go as it should while the reboot is happening.

    To update your kernel, simply running

    apt update
    apt upgrade
    

    should be enough.Now run

    update-grub
    

    It should confirm the kernel packages you have. Time for a reboot now. Reboot your Droplet and see if there are any changes.

    • Thanks, I’ll try both and let you know. I think my kernel should be already “new”, since I recently upgraded to 20.04 with no results. But I’ll check the Kernel version. And I’ll try the other solution.

      Really, thanks a lot!

    • Ok,
      so my Kernel version is

      root@do:~# uname -r
      3.13.0-57-generic
      

      If I run

      root@do:~# update-grub
      Sourcing file `/etc/default/grub'
      Sourcing file `/etc/default/grub.d/init-select.cfg'
      Generating grub configuration file ...
      Found linux image: /boot/vmlinuz-5.4.0-67-generic
      Found initrd image: /boot/initrd.img-5.4.0-67-generic
      Found linux image: /boot/vmlinuz-3.13.0-57-generic
      Found initrd image: /boot/initrd.img-3.13.0-57-generic
      Found memtest86+ image: /boot/memtest86+.elf
      Found memtest86+ image: /boot/memtest86+.bin
      done
      

      I see that there is a vmlinuz-5.4.0-67-generic but the selected one is 3.13… Might this be the problem? Should I force the system to use the newest image? (I’m asking because as you might have already understood I’m not really expert).

      Thanks!

      • I tried to edit /etc/default/grub to point to the 5.4 kernel and rebooted, but when I run uname -r I always get 3.13.xxx

        Looks like I don’t know how to select a different version of my kernel, or that for some reason I am not allowed to do it…

  • Hi,
    this solution did not work.
    I did purge Apache2 from the system, and then I manually deleted the folders (like sites-available and few others) left after this operation.

    I then rebooted and reinstalled apache:

    root@do:~# apt-get install apache2
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Suggested packages:
      apache2-doc apache2-suexec-pristine | apache2-suexec-custom
    The following NEW packages will be installed:
      apache2
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/162 kB of archives.
    After this operation, 522 kB of additional disk space will be used.
    Selecting previously unselected package apache2.
    (Reading database ... 143735 files and directories currently installed.)
    Preparing to unpack .../apache2_2.4.46-4+deb.sury.org+1+ubuntu20.04.1+deb.sury.org+5_amd64.deb ...
    Unpacking apache2 (2.4.46-4+deb.sury.org+1+ubuntu20.04.1+deb.sury.org+5) ...
    Setting up apache2 (2.4.46-4+deb.sury.org+1+ubuntu20.04.1+deb.sury.org+5) ...
    Enabling module mpm_event.
    Enabling module authz_core.
    Enabling module authz_host.
    Enabling module authn_core.
    Enabling module auth_basic.
    Enabling module access_compat.
    Enabling module authn_file.
    Enabling module authz_user.
    Enabling module alias.
    Enabling module dir.
    Enabling module autoindex.
    Enabling module env.
    Enabling module mime.
    Enabling module negotiation.
    Enabling module setenvif.
    Enabling module filter.
    Enabling module deflate.
    Enabling module status.
    Enabling module reqtimeout.
    Enabling conf charset.
    Enabling conf localized-error-pages.
    Enabling conf other-vhosts-access-log.
    Enabling conf security.
    Enabling conf serve-cgi-bin.
    Enabling site 000-default.
    Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.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 Tue 2021-03-23 10:51:45 CET; 18ms ago
           Docs: https://httpd.apache.org/docs/2.4/
        Process: 3919 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
    
    Mar 23 10:51:45 do systemd[1]: Starting The Apache HTTP Server...
    Mar 23 10:51:45 do apachectl[3929]: [Tue Mar 23 10:51:45.362658 2021] [:crit] [pid 3929] (38)Function not implemented: AH00141: Could not initialize random number generator
    Mar 23 10:51:45 do apachectl[3919]: Action 'start' failed.
    Mar 23 10:51:45 do apachectl[3919]: The Apache error log may have more information.
    Mar 23 10:51:45 do systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
    Mar 23 10:51:45 do systemd[1]: apache2.service: Failed with result 'exit-code'.
    Mar 23 10:51:45 do systemd[1]: Failed to start The Apache HTTP Server.
    Processing triggers for man-db (2.9.1-1) ...
    Processing triggers for systemd (245.4-4ubuntu3.5) ...
    

    As you see, the error pos up again… the content of all the folders in /etc/apache2 is the default one, with no changes…

    I’m going to check the kernel version and I’ll let you know.

Hi @leeppolis,

Yes, that’s a bit older kernel than what’s recommended. Unfortunately, I’ve always dealt with CentOS grub/kernel issues. It does seem like using

update-grub 

or

update-grub2

should help and then reboot.

  • Hi @leeppolis,

    Looking at more angles, I found the following:

    While still in the terminal, type:

    sudo apt-get dist-upgrade
    

    The “dist-upgrade” switch asks Ubuntu to handle any dependencies intelligently. That is, if a particular software package is dependent on another software package to run, this command will make sure that the second package is upgraded before upgrading the first one.

    This method is a safe way to upgrade your Ubuntu Linux kernel. The kernel updates accessible through this utility have been tested and verified to work with your version of Ubuntu.

    Having said that, prior to trying the above, make sure to create a backup!

    • It really seems that I am unable to select a different Kernel…
      I executed the dist-upgrade and it finished correctly.
      After rebooting, I still get this

      root@do:~# uname -r
      3.13.0-57-generic
      

      Then I run

      root@do:~# update-grub
      Sourcing file `/etc/default/grub'
      Sourcing file `/etc/default/grub.d/init-select.cfg'
      Generating grub configuration file ...
      Found linux image: /boot/vmlinuz-5.4.0-70-generic
      Found initrd image: /boot/initrd.img-5.4.0-70-generic
      Found linux image: /boot/vmlinuz-5.4.0-67-generic
      Found initrd image: /boot/initrd.img-5.4.0-67-generic
      Found linux image: /boot/vmlinuz-3.13.0-57-generic
      Found initrd image: /boot/initrd.img-3.13.0-57-generic
      Found memtest86+ image: /boot/memtest86+.elf
      Found memtest86+ image: /boot/memtest86+.bin
      done
      

      And reboot, and still, I get this:

      root@do:~# uname -r
      3.13.0-57-generic
      

      I tried to manually edit the /etc/defaults/grub file, but nothing changes.

      What if I try to set

      GRUB_DEFAULT="Ubuntu, with Linux 5.4.0-67-generic"
      

      (I can see that entry in grub.cfg) Might it work?

  • This did not help. I’m trying the other solution now, it found 5 new/upgradable packages and I see that it is downloading some kernel module.

    Thank you again for your help!

    • Hi @doc6bf4504dceab

      So basically, updating your grub conf did not help, is that correct? By the way, I think that after you manually update the grub config you still need to run

      update-grub
      

      in order to update.

      I think this here how-to-configure-the-grub2-boot-loaders-settings might be of help.

      Please let me know how it goes!

      • Thank you for your time, really.

        So I edited the grub config file, replacing the GRUB_DEFAULT entry with

        GRUB_DEFAULT="gnulinux-advanced-050e1e34-39e6-4072-a03e-ae0bf90ba13a>gnulinux-5.4.0-70-generic-advanced-050e1e34-39e6-4072-a03e-ae0bf90ba13a"

        (as I found here), run update-grub and rebooted and nothing changed. I then tried to use Webmin to edit the grub config file, just to try… and saw this

        The GRUB executable grub was not found on your system. Maybe GRUB is not installed, or the module configuration is incorrect.

        My doubt at this point is that the grub installation is wrong for some reason.

After trying to play with grub config and trying to re install grub I decided to restore a backup. Now the server is up, with a lot of pending upgrades that I won’t install :)

I decided to try to setup a completely new droplet, and transfer all my data to this new one.

This has been a really stressful experience :) thank you @KFSys for your time and your help, it really has been super appreciated.