From 4872c0cf09371167477290de443c628e35f11178 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Sep 2025 13:24:38 +0100 Subject: [PATCH] lib/launch-direct.c: Assume virtio-rng It's always a good idea to provide proper entropy to the libguestfs appliance (eg. for any cryptographic operations). We already assume virtio, so we can assume virtio-rng is present. --- lib/launch-direct.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/launch-direct.c b/lib/launch-direct.c index 0b923a8f4..c28cea48d 100644 --- a/lib/launch-direct.c +++ b/lib/launch-direct.c @@ -685,22 +685,16 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) arg ("-kernel", kernel); arg ("-initrd", initrd); - /* Add a random number generator (backend for virtio-rng). This - * isn't strictly necessary but means we won't need to hang around - * when needing entropy. - */ - if (guestfs_int_qemu_supports_device (g, data->qemu_data, - VIRTIO_DEVICE_NAME ("virtio-rng"))) { - start_list ("-object") { - append_list ("rng-random"); - append_list ("filename=/dev/urandom"); - append_list ("id=rng0"); - } end_list (); - start_list ("-device") { - append_list (VIRTIO_DEVICE_NAME ("virtio-rng")); - append_list ("rng=rng0"); - } end_list (); - } + /* Add a good source of entropy, eg for cryptographic operations. */ + start_list ("-object") { + append_list ("rng-random"); + append_list ("filename=/dev/urandom"); + append_list ("id=rng0"); + } end_list (); + start_list ("-device") { + append_list (VIRTIO_DEVICE_NAME ("virtio-rng")); + append_list ("rng=rng0"); + } end_list (); /* Create the virtio-scsi bus. */ start_list ("-device") {