From d95e69aa3470cdf4b0a7d19a0af66d77e2279422 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 21 Feb 2017 10:24:56 -0800 Subject: [PATCH] Create /dev/random and /dev/urandom before running rpm -qa (#1420523) In order to run rpm inside the newly created image it now needs to create a couple device nodes to satisfy nss, which is used by rpm. --- share/templates.d/99-generic/runtime-postinstall.tmpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/templates.d/99-generic/runtime-postinstall.tmpl b/share/templates.d/99-generic/runtime-postinstall.tmpl index 1f9001d7..a901fe1d 100644 --- a/share/templates.d/99-generic/runtime-postinstall.tmpl +++ b/share/templates.d/99-generic/runtime-postinstall.tmpl @@ -117,6 +117,9 @@ remove etc/lvm/lvm.conf append etc/lvm/lvm.conf "global {\n\tuse_lvmetad = 1\n}\n" ## Record the package versions used to create the image -runcmd chroot ${root} /bin/rpm -qa --pipe "tee /root/lorax-packages.log" +## rpm initializes nss, which requires /dev/urandom to be present, hence the mknod +runcmd chroot ${root} /usr/bin/mknod -m 666 /dev/random c 1 8 +runcmd chroot ${root} /usr/bin/mknod -m 666 /dev/urandom c 1 9 +runcmd chroot ${root} /usr/bin/rpm -qa --pipe "tee /root/lorax-packages.log" ## TODO: we could run prelink here if we wanted?