apache startup report shmget of failed: Invalid argument solution

  • 2020-05-10 23:11:03
  • OfStack

On the apache server in use, startup error report:


shmget() failed:  Invalid argument
Failed to start up concurrent users module!

The setting for kernel.shmmax has not been effective after checking (the value setting for another 1 system of copy is too large).

As follows:


[root@localhost ~]# sysctl -a | grep shmm
kernel.shmmni = 4096
kernel.shmmax = 0
[root@localhost ~]# vi /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmall = 1073742
[root@localhost ~]# sysctl -p
[root@localhost ~]# sysctl -a | grep shm        
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096
kernel.shmall = 1073742
kernel.shmmax = 2147483648


kernel.shmmax numerical description:
Unit: bytes. 1 half of physical memory is recommended
Take 4G memory for example: 4096/2*1024*1024=2147483648

kernel.shmall value description:
Unit: page. 1 page =4k, set the value to the physical memory size
Take 4G memory for example: 4096*1024*1024/4000=1073742

Note: the above two values will not be valid if they are larger than the physical memory.

I hope that the above solutions can solve the problems you encounter.


Related articles: