2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-23 19:50:21 +00:00

fix issue chroot, rpm -qa error: Failed to initialize NSS library #4959 (#4967)

This commit is contained in:
yangsong
2018-03-19 16:28:05 +08:00
committed by Bin Xu
parent f047cc73e3
commit 3d5cd23d0d

View File

@@ -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.