Red Hat Bugzilla – Bug 893034
yum traceback with python-2.6.6-29.el6_2.2 and higher + missing /dev/urandom
Last modified: 2016-04-18 06:16:49 EDT
Description of problem: Yum drops traceback when /dev/urandom in missing and python-2.6.6-29.el6_2.2 is installed. It looks like a regression but not sure where is the problem, yum or python or if there is a problem at all. Version-Release number of selected component (if applicable): yum-3.2.29-22.el6 python-2.6.6-29.el6_2.2 How reproducible: always Steps to Reproduce: 1. # mkdir -p /tmp/newroot/etc /tmp/newroot/dev /tmp/newroot/proc /tmp/newroot/sys # touch /tmp/newroot/etc/fstab # mknod /tmp/newroot/dev/null c 1 3 # chmod 666 /tmp/newroot/dev/null" # mount --bind /sys /tmp/newroot/sys" # yum -y --installroot=/tmp/newroot install yum" 2. # chroot /tmp/newroot bash-4.1# rpm -q yum python yum-3.2.29-22.el6.noarch python-2.6.6-29.el6_2.2.x86_64 bash-4.1# yum version Traceback (most recent call last): File "/usr/bin/yum", line 4, in <module> import yum File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 46, in <module> import tempfile File "/usr/lib64/python2.6/tempfile.py", line 34, in <module> from random import Random as _Random File "/usr/lib64/python2.6/random.py", line 873, in <module> _inst = Random() File "/usr/lib64/python2.6/random.py", line 96, in __init__ self.seed(x) File "/usr/lib64/python2.6/random.py", line 110, in seed a = long(_hexlify(_urandom(16)), 16) OSError: [Errno 2] No such file or directory: '/dev/urandom' bash-4.1# bash-4.1# strace yum version 2>&1 | grep urandom open("/dev/urandom", O_RDONLY) = -1 ENOENT (No such file or directory) stat("/dev/urandom", 0x7fffc86de180) = -1 ENOENT (No such file or directory) open("/dev/urandom", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "a = long(_hexlify(_urandom(16)),"..., 37a = long(_hexlify(_urandom(16)), 16) write(2, "[Errno 2] No such file or direct"..., 51[Errno 2] No such file or directory: '/dev/urandom') = 51 bash-4.1# Actual results: yum drops traceback Expected results: no traceback Additional info: It seems that the problem was introduced with python-2.6.6-29.el6_2.2 There is no traceback when the same reproducer with same yum just older python is replayed: bash-4.1# rpm -q yum python yum-3.2.29-22.el6.noarch python-2.6.6-29.el6.x86_64 bash-4.1# bash-4.1# yum version Installed: $releasever/x86_64 84:564b0e078974221db1dd508c3887ff284bbd634a Group-Installed: yum 13:e4d8d13610d9ff5103fd20f4b9ceec4cbacbd38a version bash-4.1# bash-4.1# strace yum version 2>&1 | grep urandom open("/dev/urandom", O_RDONLY) = -1 ENOENT (No such file or directory) stat("/dev/urandom", 0x7fff1c26c8f0) = -1 ENOENT (No such file or directory) open("/dev/urandom", O_RDONLY) = -1 ENOENT (No such file or directory) bash-4.1# It looks like yum tries to access /etc/urandom but it does not really mind when it fails. With newer python this changed.
Probably python-only issue. Yum needs /dev/random only indirectly, via tempfile. I bet this would traceback, too: ~$ strace python -m tempfile 2>&1|grep urandom open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 4 IMO, os.urandom() should never raise exceptions, but acquire entropy by other means when /dev/urandom is not available.
This Python bug may be the root cause of the problem: * http://bugs.python.org/issue15340 I encountered a similar error while installing a python-twisted in a Fedora18 chroot eg {{{ sudo yum --releasever=18 --nogpg --installroot=/srv/fedora18 --disablerepo='*' --enablerepo=fedora install systemd passwd yum fedora-release openssh python-twisted ... Installing : python-twisted-conch-12.1.0-2.fc18.x86_64 146/151 Traceback (most recent call last): File "/usr/libexec/twisted-dropin-cache", line 13, in <module> from twisted.plugin import IPlugin, getCache File "/usr/lib64/python2.7/site-packages/twisted/plugin.py", line 34, in <module> from twisted.python.modules import getModule File "/usr/lib64/python2.7/site-packages/twisted/python/modules.py", line 68, in <module> from twisted.python.filepath import FilePath, UnlistableError File "/usr/lib64/python2.7/site-packages/twisted/python/filepath.py", line 11, in <module> import random File "/usr/lib64/python2.7/random.py", line 881, in <module> _inst = Random() File "/usr/lib64/python2.7/random.py", line 97, in __init__ self.seed(x) File "/usr/lib64/python2.7/random.py", line 111, in seed a = long(_hexlify(_urandom(16)), 16) OSError: [Errno 2] No such file or directory: '/dev/urandom' }}}
Created attachment 764520 [details] Proposed patch - urandom proper exception
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-1582.html