[Libguestfs] redhat-based EL9 distros not supported?

Richard W.M. Jones rjones at redhat.com
Mon Oct 10 13:01:28 UTC 2022


On Mon, Oct 10, 2022 at 08:51:00AM +0000, Harry Bryson wrote:
> >> [Rocky9]$ virt-customize -a disk.qcow2 --firstboot-command /tmp/bootstrap
> >> [ 0.0] Examining the guest ...
> >> [ 17.1] Setting a random seed
> >> [ 17.3] Installing firstboot command: /tmp/bootstrap
> >> virt-customize: error: guest type rocky is not supported
> 
> >This is just a bug. For reference what versions of libguestfs &
> >guestfs-tools are you using?
> 
> Just the native EL9 versions
> $ rpm -q libguestfs guestfs-tools
> libguestfs-1.46.1-4.el9_0.alma.x86_64
> guestfs-tools-1.46.1-6.el9.0.1.x86_64
> (I am running on AlmaLinux9/Rocky9 as well)

What does Alma (as a guest image) return for inspect-get-distro?  As
far as I can tell we don't really support it in libguestfs so far.

Anyway the attached patches should fix the issue for Rocky guest
images, although it's not really long-term supportable to keep adding
distros like this, we'll have to think of a better way.

The bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=2133443

> Not sure if this is the correct fix, but I test patched the distro matching and it seemed to fix this.
> (Although virt-builder did not link cleanly - fPIE ?)

You probably need to configure with:

  ./configure CFLAGS="-O2 -fPIC -g"

(or alternatively just rebuild from the CentOS SRPM)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit
-------------- next part --------------
>From 85f3e4d084b71c4fac84d729f14c798001df2076 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Mon, 10 Oct 2022 13:59:00 +0100
Subject: [PATCH] common: customize: Support Rocky Linux

Reported-by: Harry Benson
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133443
---
 mlcustomize/firstboot.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mlcustomize/firstboot.ml b/mlcustomize/firstboot.ml
index 5c7fd0d..0c76283 100644
--- a/mlcustomize/firstboot.ml
+++ b/mlcustomize/firstboot.ml
@@ -151,7 +151,8 @@ WantedBy=%s
 
   and install_sysvinit_service g root distro major =
     match distro with
-    | "fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based" ->
+    | "fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|"rocky"|
+        "redhat-based" ->
       install_sysvinit_redhat g
     | "opensuse"|"sles"|"suse-based" ->
       install_sysvinit_suse g
-- 
2.37.0.rc2

-------------- next part --------------
>From ea0142b9906ee5844f58b13b72eb6150ee020b6a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones at redhat.com>
Date: Mon, 10 Oct 2022 13:54:52 +0100
Subject: [PATCH] customize: Support Rocky Linux

Reported-by: Harry Benson
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2133443
---
 customize/hostname.ml    | 3 ++-
 customize/password.ml    | 3 ++-
 customize/random_seed.ml | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/customize/hostname.ml b/customize/hostname.ml
index df64a2dab4..fabba3cfd7 100644
--- a/customize/hostname.ml
+++ b/customize/hostname.ml
@@ -36,7 +36,8 @@ let rec set_hostname (g : Guestfs.guestfs) root hostname =
     update_etc_machine_info g hostname;
     true
 
-  | "linux", ("rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based"), v
+  | "linux", ("rhel"|"centos"|"scientificlinux"|"oraclelinux"|"rocky"|
+              "redhat-based"), v
     when v >= 7 ->
     update_etc_hostname g hostname;
     update_etc_machine_info g hostname;
diff --git a/customize/password.ml b/customize/password.ml
index 608bf95dcf..b37b31fcdc 100644
--- a/customize/password.ml
+++ b/customize/password.ml
@@ -160,7 +160,8 @@ and default_crypto g root =
   let distro = g#inspect_get_distro root in
   let major = g#inspect_get_major_version root in
   match distro, major with
-  | ("rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based"), v when v >= 9 ->
+  | ("rhel"|"centos"|"scientificlinux"|"oraclelinux"|"rocky"|
+     "redhat-based"), v when v >= 9 ->
     `YESCRYPT
   | ("rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based"), v when v >= 6 ->
     `SHA512
diff --git a/customize/random_seed.ml b/customize/random_seed.ml
index f32d3194ea..2dcb700eaa 100644
--- a/customize/random_seed.ml
+++ b/customize/random_seed.ml
@@ -47,7 +47,8 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
     let distro = g#inspect_get_distro root in
     let file =
       match typ, distro with
-      | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based") ->
+      | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|
+                  "rocky"|"redhat-based") ->
         Some "/var/lib/random-seed"
       | "linux", ("debian"|"ubuntu"|"kalilinux") ->
         Some "/var/lib/urandom/random-seed"
-- 
2.37.0.rc2



More information about the Libguestfs mailing list