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

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

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") )

Related

How should one configure or install salt-cloud to use the Saltstack py3 repository to install the minion instead of the distribution (apt) repository?

I would like salt-cloud to install the salt-minion using the same sources.list.d/saltstack.list file that is on the saltmaster server, but it uses the Ubuntu APT repository instead.
What I get on a new minion in /etc/apt/sources.list.d/saltstack.list:
deb https://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
What I want:
deb https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main
I installed salt-master and salt-cloud from the Saltstack repository by doing the following on my saltmaster server:
wget -O - https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
echo "deb https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main" > etc/apt/sources.list.d/saltstack.list
apt update
apt install python3-pip salt-master salt-minion salt-cloud
I spin up a server using salt-cloud and the /etc/apt/sources.list.d/saltstack.list without fail uses the apt repository, not the py3 repository.
Is there an option I can set in the saltmaster configuration file that defines which repository salt-cloud should use? Is there a similar option in a salt-cloud profile that can be passed to the salt bootstrap script?
I see in the bootstrap script that salt-cloud runs (found at bootstrap.saltstack.com) a command line option called _CUSTOM_REPO_URL, but I don't know how to pass options to that script when creating a server with salt-cloud -p
Happy to ask elsewhere (please indicate where) if more appropriate.
I can provide applicable parts of my salt-cloud profile if needed.
I found https://docs.saltstack.com/en/latest/topics/cloud/deploy.html#deploy-script-arguments
That led me to add the following to my cloud server profile used with the salt-cloud -p command:
script: bootstrap-salt
script_args: -x python3
Then the correct repository was installed.

Wireguard VPN - How to fix Operation not supported if it worked before?

Trying to get up my VPN interface with sudo wg-quick down wg0;sudo wg-quick up wg0 raised:
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
I am not sure what happened but the only thing I did was reboot. I did not update my packages. Still something apparently changed.
In my case there were no appropriate kernel headers installed.
First you need to know your current kernel version:
# uname --kernel-release
4.19.0-14-cloud-amd64
Important part here is "cloud-amd64" (there are several versions of "linux-headers-..." package, use apt list linux-headers-* to see what is available).
Then install appropriate kernel headers (I'm using Debian):
# apt install linux-headers-cloud-amd64
Then re-install wireguard-dkms package:
# apt install --reinstall wireguard-dkms
Reboot your OS:
# reboot
In my case (Debian 10, PiVPN) i had to:
Install linux headers:
apt-get update
apt-get install linux-image-amd64 linux-headers-amd64
reboot
apt reinstall wireguard-dkms
reboot
Running apt update / upgrade revealed that there are wireguard updates available. Install those (you might have to reboot as well) and all will work fine again.
Secure boot as the internet suggests was a false trail in my case.
solution can be simple:
set in
[Interface]
MTU = 1412
to avoid packet limitations.
Done.
You may elaborate a smaller fitting size.
In my case it was enough:
sudo apt update
sudo apt upgrade
sudo reboot

Apache disabling mpm_prefork error: The following modules depend on mpm_prefork and need to be disabled first: php7.3

I have a 8GB droplet on digitalocean. We launched our site today and we got intense traffic, we have about 3000 concurrent users.
I tried to raise the amount of concurrent connections (with the advice of apache2buddy) but the suggested MaxRequestWorkers to be 482. Here is the file:
<IfModule mpm_prefork_module>
ServerLimit 482
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 482
MaxConnectionsPerChild 0
</IfModule>
Apache2 uses mdm_prefork and we have read that it's better if we use mdm_worker.
So i tried to disable mdm_prefork, so that I can enable mdm_worker:
a2dismod mpm_prefork
And I got the following error:
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php7.3
What do I have to do to enable mpm_worker?
I found the possible solution to resolve this on my ubuntu server, dont know whether you are running ubuntu as well on your side, but I feel that the steps that I have taken will be the same for almost all distros with change in 1 step where you need to install a new package and the command for that may change based on the distro that you are using.
so the first step is
$ sudo a2dismod php7.3 mpm_prefork
This will disable the prefork module but before that it will disable the php7.3 module to stop the dependency error from occurring.
Next, we enable the worker module
$ sudo a2enmod mpm_worker
Now, the output would suggest that you restart the apache web-server. So, we do the same
$ sudo systemctl restart apache2
Now, if you go to check your website homepage, it may either throw an error or may load a blank page.
So, how do we resolve that; I scoured multiple community forums and found a solution related to the same but it was for freebsd platform so tried the same on ubuntu with some tweaks required to be made on ubuntu side for the steps to work.
The Solution based on ubuntu OS :
First of all, we enable the proxy, proxy_fcgi and setenvif module followed with a php-fpm package installation corresponding to your php version
$ sudo a2enmod proxy
$ sudo a2enmod proxy_fcgi
$ sudo a2enmod setenvif
$ sudo apt-get install php7.3-fpm -y
the php7.3-fpm installation command is the one where you may need to check the installation steps based on the Distro you are using.
Once, php-fpm service is installed you need to make sure that it gets enabled and then start it, so for that
$ sudo a2enconf php7.3-fpm
$ sudo systemctl enable php7.3-fpm.service
$ sudo systemctl start php7.3-fpm.service
Once, the php-fpm service starts successfully, just restart apache service to make sure all the made changes take effect properly
$ sudo systemctl restart apache2
After these steps are taken, please check/refresh your website homepage and the error page or the blank page will change to the proper website page.
The End-Result; your website has shifted from using prefork module to worker module to handle requests.
Also, if you want to switch to event module instead of worker module; just enable event module in place of worker module in the second step; the one that you will take after disabling php7.3 and prefork module
replace
$ sudo a2enmod mpm_worker
with
$ sudo a2enmod mpm_event
rest all steps after that remain the same irrespective of enabling worker or event module.
These steps helped me switch from prefork module to worker module on my server so hoping it may help you as well as help others who stumble on this issue.

Incorrect version of vmmom kernel module

I just installed the VMware Workstation Player virtual machine on my laptop running Ubuntu. On the final step of installation, I get the error message "Version mismatch with vmmon module: expecting 360.0, got 309.0.
You have an incorrect version of the 'vmmon' kernel module" Does anyone know how to fix this?
The below technique manually rewrites vmmon and is from a vmware forum (and other places). This worked well for me for my Ubuntu 18.04 guest on a MacOS host.
Quit Fusion.
In terminal:
sudo rm -rf /System/Library/Extensions/vmmon.kext
sudo cp -pR /Applications/VMware\ Fusion.app/Contents/Library/kexts/vmmon.kext /System/Library/Extensions/
sudo kextunload /System/Library/Extensions/vmmon.kext
sudo kextutil /System/Library/Extensions/vmmon.kext
VMWare should restart correctly with the new version.

There is a new relic clone for arm (Raspberry PI)?

I need to monitor the performance of a raspberry PI (with raspbian), I tried to use new relic, but it doesn't support ARM architecture, so it's impossible to use.
I even tried graphdat but seems to have the same problem.
Any alternative to suggest me?
Linode Longview does support arm architecture:
https://www.linode.com/longview
The free tier have 12-hour retention but that may be enough for most cases.
I know this is old, but New Relic has ARM and ARM64 infrastructure agents now:
https://download.newrelic.com/infrastructure_agent/binaries/linux/arm/
I've tested this on a Raspberry Pi 4 (8GB) on Debian (32-bit) and it's been working fine so far.
In case anyone else tries, here's what I did:
Download the Infrastructure Agent:
sudo curl https://download.newrelic.com/infrastructure_agent/binaries/linux/arm/newrelic-infra_linux_1.20.5_arm.tar.gz --output newrelic-infra_linux_1.20.5_arm.tar.gz
Extract the files
sudo tar -xf newrelic-infra_linux_1.20.5_arm.tar.gz
Add license key to the config script:
echo "license_key=\"<YOUR_LICENSE_KEY>\"" | sudo tee -a ~/newrelic-infra/config_defaults.sh
Install the Infrastructure Agent
sudo ~/newrelic-infra/installer.sh
Check service status to make sure it's running:
sudo systemctl status newrelic-infra
By default, process information is not sent to New Relic, so I had to enable it manually:
echo "enable_process_metrics: true" | sudo tee -a /etc/newrelic-infra.yml
Finally, restart the service:
sudo systemctl restart newrelic-infra

Resources