"kernel panic - not syncing: Out of memory and no killable processes..." CentOS/RHEL booting issue due to incorrect HugePages setting

The Problem

System boots into “kernel panic - not syncing: Out of memory and no killable processes…”.

kernel panic - not syncing- Out of memory and no killable processes...

The Solution

Reboot system into Rescue Mode and check /mnt/sysimage/proc/meminfo:

MemTotal: 264536320 kB
HugePages_Total: 126852
Hugepagesize: 2048 kB

(126852 * 2048 kB) / 264536320 kB = 98.21% HugePages used 98.21% of total memory.

1. Edit file /mnt/sysimage/etc/sysctl.conf under Rescue Mode, reduce HugePages setting:

vm.nr_hugepages = 66852

2. Reboot system normally.

# shutdown -r now

3. After rebooting the system, change the HugePages setting again with a recommended value.