[Nix-dev] vmTools.runInLinuxImage with ubuntu 1204 image blocks on getrandom()

Domen Kožar domen at dev.si
Wed Jul 27 10:01:23 CEST 2016


Sure - open a PR adding virtio_rng.

On Tue, Jul 26, 2016 at 3:43 PM, Maarten Hoogendoorn <maarten at moretea.nl>
wrote:

> OK, fixed this problem by adding the virtio_rng device to the kernel and
> qemu opts, see below.
>
> Would a PR to make these additions the default in
> build-support/vm/default.nix be appreciated?
>
> with import <nixpkgs> {}; with pkgs;
> let
>  script = ''
>    # /dev/urandom works fine
>    dd if=/dev/urandom of=/dev/null bs=1M count=1
>
>    # /dev/random only works if virtio_rng is enabled.
>    dd if=/dev/random of=/dev/null bs=1M count=1
>  '';
>   img = runCommand "nix-binary-tarball-test" {
>     diskImage = vmTools.diskImages.ubuntu1204x86_64;
>     QEMU_OPTS = "-device virtio-rng-pci";
>    } script;
>    runCustomInImage = vmTools.override {
>      rootModules = [ "virtio_rng" "virtio_pci" "virtio_blk"
> "virtio_balloon" "ext4" "unix" "9p" "9pnet_virtio" "rtc_cmos" ];
>    };
> in
>    runCustomInImage.runInLinuxImage img #<- does work
> #  vmTools.runInLinuxImage img # < - does not work
>
> 2016-07-16 15:39 GMT+02:00 Maarten Hoogendoorn <maarten at moretea.nl>:
>
>> Hi there,
>>
>> I'm trying to run some tests on a binary program on ubuntu 1204 using
>> vmTools.runInLinuxImage. It just blocks on getrandom().
>>
>> I've created a minimal reproducible example:
>>
>> with import <nixpkgs> {}; with pkgs;
>> let
>>  script = ''
>>    # /dev/urandom works fine
>>    dd if=/dev/urandom of=/dev/null bs=1M count=1
>>
>>   # /dev/random does not work!
>>    ${pkgs.strace}/bin/strace \
>>      dd if=/dev/random of=/dev/null bs=1M count=1
>>  '';
>>   img = runCommand "nix-binary-tarball-test" {
>>     diskImage = vmTools.diskImages.ubuntu1204x86_64;
>> #    QEMU_OPTS = "-device virtio-rng-pci";
>>    } script;
>> in
>>   vmTools.runInLinuxImage img
>>
>> I read somewhere that adding a virtio-rng-pci device could solve this,
>> but it made no difference.
>>
>> Could someone confirm this behavior? And maybe one of you has an idea on
>> how to fix this.
>>
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160727/2535157a/attachment.html>


More information about the nix-dev mailing list