Skip to content

Commit

Permalink
fix issue chroot, rpm -qa error: Failed to initialize NSS library xca…
Browse files Browse the repository at this point in the history
  • Loading branch information
immarvin committed Mar 19, 2018
1 parent f047cc7 commit cb3d712
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion xCAT-server/share/xcat/netboot/rh/genimage
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit cb3d712

Please sign in to comment.