"fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory" - CentOS/RHEL 7 Booting issue
The Problem
System fails to boot with below errors:
[12.524044] systemd-udevd: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.526028] systemd-udevd[483]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.526042] systemd-udevd[475]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.527046] systemd-udevd[605]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.528036] systemd-udevd[496]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.529059] systemd-udevd[503]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.529210] systemd-udevd[473]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.530023] systemd-udevd[507]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.530024] systemd-udevd[660]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.530227] systemd-udevd[470]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.531032] systemd-udevd[456]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.531040] systemd-udevd[513]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.531046] systemd-udevd[553]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.532030] systemd-udevd[560]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.532029] systemd-udevd[464]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.533030] systemd-udevd[467]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.533040] systemd-udevd[570]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.533206] systemd-udevd[640]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.534027] systemd-udevd[575]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.534044] systemd-udevd[461]: fork of '/bin/uname -p' failed: Cannot allocate memory
[ 12.535914] systemd-udevd[492]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.536093] systemd-udevd[509]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.536234] systemd-udevd[436]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.544032] systemd-udevd[433]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.544043] systemd-udevd[490]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.545034] systemd-udevd[497]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
[ 12.564042] systemd-udevd[584]: fork of '/bin/systemd-detect-virt' failed: Cannot allocate memory
The Solution
There are multiple causes for this message - Modules were missing in initramfs/ Dom0 is unable to allocate RAM for Virtual Machine / Huge page configured wrong on Virtual Machine.
1. Rescue system using ISO.
2. Once server is in rescue mode, do chroot /mnt/sysimage.
# chroot /mnt/sysimage
3. Move the /etc/sysctl.conf file of the affected system to a different place, also /etc/sysctl.d/*:
# mv /etc/sysctl.conf /root/sysctl.conf-backup
# mv /etc/sysctl.d/* /root/sysctl.d-backup
4. Rebuild the initrd using dracut -f …. This ensures an initrd without the sysctl.conf options is created.
5. Reboot the system:
# reboot -h now