diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 2b535fea6..d78832f27 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -520,7 +520,7 @@ unless ($onlyinitrd) { # Hack uname when deal otherpkgs use_hackuname($arch, $kernelver); use_devnull(); - + use_devurandom(); foreach $pass (sort { $a <=> $b } (keys(%extra_hash))) { $yumcmd = $yumcmd_base; @@ -2355,6 +2355,18 @@ sub use_devnull { } } +#in rhels7.5, the /dev/urandom does not exist in rootimg directory +#which cause any rpm command fail with `error: Failed to initialize NSS library` +#create urandom in genimage to avoid the error +sub use_devurandom { + if (-e "$rootimg_dir/dev/urandom" and !-c "$rootimg_dir/dev/urandom") { + system("rm -f $rootimg_dir/dev/urandom"); + } + if (!-e "$rootimg_dir/dev/urandom") { + system("mknod -m444 $rootimg_dir/dev/urandom c 1 9"); + } +} + # Hack uname functions to match what's installed in the rootimg # instead of what's running on the management node. # Needed for some RPMs, especially kernel modules via DKMS.