System cannot proceed with the boot process, stuck with an error messages:
systemd-udevd: fork of '/bin/sh -c '>/tmp/.lvm_scan-sdc;'' failed: Cannot allocate memory A start job is running for dev-mapper-\x2droot.device
If the systemd unit called lvmetad is enabled and running, the metadata is cached which reduces disk scanning and it provides LVM commands with VG metadata and PV state. LVM commands will then avoid reading the information from disks. If there are any changes in the underlying Volume groups and Physical volumes, the LVM metadata cache may not have the information about the changes in the disks which can cause this issue to stuck on LVM commands such as lvm_scan-sd*.
Another factor would be that during this scan, memory allocation may fail due to incorrect or inappropriate settings for kernel parameter vm.nr_hugepages. Huge pages can be configured to allocate and dedicate a part of memory that cannot be used by the OS.
1. Boot the system to Rescue mode using Rescue disk.
2. Ensure that huge pages setting in /etc/sysctl.conf is the recommended value to avoid the error “Cannot allocate memory”.
3. You can disable huge page setting in /etc/systcl.conf to see if this was causing the issue. Edit /etc/sysctl.conf and ensure vm.nr_hugepages is not existing or replace it to #vm.nr_hugepages =.
4. Disable lvmetad:
# systemctl disable lvm2-lvmetad # systemctl disable lvm2-lvmetad.socket
5. Edit /etc/lvm/lvm.conf and replace the following line:
use_lvmetad = 1 to use_lvmetad = 0
6. Rebuild initramfs to adapt the changes for the specific kernel:
# cp /boot/initramfs-[kernel version].img /root # cd /boot # dracut -f -v initramfs-[kernel].img [kernel]
# dracut -f -v initramfs-3.10.0-514.el7.x86_64.img 3.10.0-514.el7.x86_64
7. Reboot the system for the changes to take effect:
# shutdown -r now