Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/local/lib/ruby/3.1.0/securerandom.rb:75:in `urandom': failed to get urandom (RuntimeError) #383

Closed
darksidds opened this issue May 23, 2022 · 3 comments

Comments

@darksidds
Copy link

I'm working with redmine image, which is based on ruby image.
I've posted my problem here docker-library/redmine#264
The image is based on FROM ruby:3.1-slim-bullseye, so I've tried to run pure ruby image.
The steps to reproduce my problem:

# docker run -it --rm ruby:3.1-bullseye bash
root@c39956abcf4e:/# irb
irb(main):001:0> require 'securerandom'
/usr/local/lib/ruby/3.1.0/securerandom.rb:75:in `urandom': failed to get urandom (RuntimeError)
        from /usr/local/lib/ruby/3.1.0/securerandom.rb:75:in `singleton class'
        from /usr/local/lib/ruby/3.1.0/securerandom.rb:42:in `<module:SecureRandom>'
        from /usr/local/lib/ruby/3.1.0/securerandom.rb:41:in `<top (required)>'
        from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from (irb):1:in `<main>'
        from /usr/local/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'

I've also tried images ruby:3.2-rc-slim and ruby:3.0-slim-bullseye -- they work OK!
But all flavours of 3.1-* seem to be broken.
My host machine is

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
# uname -r
3.16.0-4-amd64
# cat /proc/version
Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19)
@tianon
Copy link
Member

tianon commented May 23, 2022

😬 I can't seem to reproduce:

$ docker run -it --rm --pull=always ruby:3.1-slim-bullseye
3.1-slim-bullseye: Pulling from library/ruby
214ca5fb9032: Already exists 
78121ab1df60: Pull complete 
48fbe7e8745f: Pull complete 
6edc84d3fe34: Pull complete 
2152ead824bc: Pull complete 
Digest: sha256:45bf81172fb1169d5659254601c9608704337592e73b5c3e5bee436deb695f2a
Status: Downloaded newer image for ruby:3.1-slim-bullseye
irb(main):001:0> require 'securerandom'
=> true

@yosifkit
Copy link
Member

👀 I would hazard a guess that it might have something to do with running on a 3.16 kernel or likely an old version of libseccomp or Docker. I am not sure how the kernel isn't newer, since 4.19 is the kernel in buster (https://packages.debian.org/buster/linux-image-amd64)

A newer version of Docker, runc, and/or libseccomp might fix this one, but it could also need a kernel bump.

Similar issues: #351 docker-library/php#1192 docker-library/php#1177

@darksidds
Copy link
Author

I had an extremely old kernel, so I decided to switch OS on the host machine. The problem is not relevant to me any longer.
Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants