classification
Title: Python requires /dev/urandom on HURD: _Py_HashRandomization_Init: failed to get random numbers
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Jeffrey.Walton, vstinner
Priority: normal Keywords:

Created on 2019-08-12 11:00 by Jeffrey.Walton, last changed 2021-06-18 21:31 by iritkatriel. This issue is now closed.

Messages (2)
msg349453 - (view) Author: Jeffrey Walton (Jeffrey.Walton) * Date: 2019-08-12 11:00
I need to setup a Debian HURD test machine to investigate a problem I was seeing in the Crypto++ library. After setting up the machine and running an apt-get install for some build tools I noticed Python was failing:

    Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python

It seems HURD no longer provides /dev/urandom out of the box. This is new behavior, and it was not present in the past. It is present in the ISO's from June 2019 (https://cdimage.debian.org/cdimage/ports/current-hurd-i386/iso-dvd/).

Python may want to employ a fallback strategy since whatever is using Python ignores the error and trucks on.

Sorry to dump this on you.

-----

jwalton@hurd-x86:~$ ls /dev/*rand*
/dev/random

jwalton@hurd-x86:~$ python --version
Python 2.7.16

jwalton@hurd-x86:~$ uname -a
GNU hurd-x86 0.9 GNU-Mach 1.8+git20190109-486/Hurd-0.9 i686-AT386 GNU

jwalton@hurd-x86:~$ apt-cache show python
Package: python
Architecture: hurd-i386
Version: 2.7.16-1
Multi-Arch: allowed
Priority: standard
Section: python
Source: python-defaults
Maintainer: Matthias Klose <doko@debian.org>
Installed-Size: 68
Provides: python-ctypes, python-email, python-importlib, python-profiler, python-wsgiref
Pre-Depends: python-minimal (= 2.7.16-1)
Depends: python2.7 (>= 2.7.16-1~), libpython-stdlib (= 2.7.16-1), python2 (= 2.7.16-1)
...
msg349454 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-12 11:05
> It seems HURD no longer provides /dev/urandom out of the box.

Why not? How is an application supposed to get entropy from the kernel or from the system?

In short, it seems like Python no longer supports HURD anymore. You can patch Python on HURD for your specific needs (ex: put a patch in Debian) if you want to workaround this issue.
History
Date User Action Args
2021-06-18 21:31:08iritkatrielsetstatus: open -> closed
resolution: third party
stage: resolved
2019-08-12 11:24:45vstinnersettitle: _Py_HashRandomization_Init: failed to get random numbers -> Python requires /dev/urandom on HURD: _Py_HashRandomization_Init: failed to get random numbers
2019-08-12 11:05:15vstinnersetnosy: + vstinner
messages: + msg349454
2019-08-12 11:00:50Jeffrey.Waltoncreate