Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 893034

Summary: yum traceback with python-2.6.6-29.el6_2.2 and higher + missing /dev/urandom
Product: Red Hat Enterprise Linux 6 Reporter: Patrik Kis <pkis>
Component: pythonAssignee: Robert Kuska <rkuska>
Status: CLOSED ERRATA QA Contact: Jan Kepler <jkejda>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: james.antill, jberan, jkejda, lnovich, richard, rkuska, tcallawa, zpavlas
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-2.6.6-47.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 907383 910674 1112104 (view as bug list) Environment:
Last Closed: 2013-11-21 09:13:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 907383    
Attachments:
Description Flags
Proposed patch - urandom proper exception none

Description Patrik Kis 2013-01-08 13:47:02 UTC
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.

Comment 2 Zdeněk Pavlas 2013-01-08 14:15:52 UTC
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.

Comment 3 Richard Wall 2013-01-24 13:52:50 UTC
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'
}}}

Comment 9 Robert Kuska 2013-06-24 08:54:02 UTC
Created attachment 764520 [details]
Proposed patch -  urandom proper exception

Comment 13 errata-xmlrpc 2013-11-21 09:13:49 UTC
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