Python failing with "failed to get random numbers to initialize Python", did any source of randomness change?

40 views
Skip to first unread message

Henrique Fingler

unread,
Jan 31, 2020, 5:34:58 PM1/31/20
to OSv Development
 Hey everyone,

 I'm getting this weird error that wasn't happening a few weeks before and I'm confused on how to approach this.
 Did anything change related to randomness lately? Could it be something related to my host?
 I'm under Firecracker and latest version of OSv.

 Only thing I could find is this (from here):

When the Python/random.c file was written (by me), the getentropy() function 
was only supported on OpenBSD. Later, random.c was modified to *not* use 
getentropy() on Solaris (Issue #25003).

The problem is that py_getentropy() doesn't handle ENOSYS, and so Python fails 
at startup with a fatal error (Python 3.6):
   Fatal Python error: failed to get random numbers to initialize Python
or (Python 3.5):
   Fatal Python error: getentropy() failed

Waldek Kozaczuk

unread,
Feb 4, 2020, 9:02:08 AM2/4/20
to OSv Development
Could you be more specific as to what exactly is happening plus exact steps to reproduce it along with the version of python and host system (linux distribution)?

I just built python3x and was able to run on firecracker 0.20.0:

OSv v0.54.0-105-gaf96566e
Booted up in 41.05 ms
Cmdline: /python3 
Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Waldek 

Henrique Fingler

unread,
Feb 10, 2020, 11:51:54 AM2/10/20
to OSv Development
 It seems like it's something related to my laptop, and doesn't happen in other places. Pretty weird.
 Anyway, in case anyone faces this and isn't in a production environment, there's a hack to make it run:

--env=PYTHONHASHSEED=1234
Reply all
Reply to author
Forward
0 new messages