Setup /dev/random and /dev/urandom device in cache prep

In the cache preparation stage, there are certain libraries that
depend on the existance of /dev/random and /dev/urandom in order
to be able to function correctly, such as NSS in the latest CentOS
release (7.5)

This patch adds those nodes so that the libraries are able to use
them with no problems, allowing yum and rpm specifically to work
properly again.

Change-Id: Iaf6b9cb1435591f28289493f480a7fe46789c551
This commit is contained in:
Mohammed Naser 2018-05-10 09:18:28 -04:00 committed by Jesse Pretorius (odyssey4me)
parent ea37450f3e
commit 030c348117
2 changed files with 20 additions and 6 deletions

View File

@ -0,0 +1,14 @@
---
fixes:
- |
Newer releases of CentOS ship a version of libnss that depends on the existance
of /dev/random and /dev/urandom in the operating system in order to run. This
causes a problem during the cache preparation process which runs inside chroot
that does not contain this, resulting in errors with the following message.
.. code-block:: text
error: Failed to initialize NSS library
This has been resolved by introducing a /dev/random and /dev/urandom inside
the chroot-ed environment.

View File

@ -4,12 +4,12 @@ mkdir -p /dev
mkdir -p /proc
mkdir -p /sys/fs/cgroup
# In order for the package manager to function /dev/null must exist. This is
# is being run here because some images do not create /dev/null by default.
if [[ ! -e /dev/null ]]; then
mknod /dev/null c 1 3
chmod 0666 /dev/null
fi
# In order for the package manager to function /dev/null, /dev/random and
# /dev/urandom must exist. This is is being run here because some images do not
# create /dev/null by default.
[ ! -e /dev/null ] && mknod -m 0666 /dev/null c 1 3
[ ! -e /dev/random ] && mknod -m 0666 /dev/random c 1 8
[ ! -e /dev/urandom ] && mknod -m 0666 /dev/urandom c 1 9
# Create the directory where local facts will be stored
mkdir -p /etc/ansible/facts.d