From ec34595bdd9957aa7c0a7e2e6cdbc19993538174 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 4 Dec 2025 12:30:48 +0000 Subject: [PATCH] Import from AlmaLinux stable repository --- .gitignore | 1 - .libguestfs.metadata | 1 - ...fo.c-Generate-new-osinfo-shortname-f.patch | 41 ++++++++++ ...contents-of-etc-fstab-to-verbose-log.patch | 47 ++++++++++++ ...dd-lsblk-and-blkid-output-to-verbose.patch | 45 +++++++++++ ...s_windows.ml-Add-debugging-for-MBR-d.patch | 74 ++++++++++++++++++ ...s_windows.ml-Add-debugging-when-we-s.patch | 31 ++++++++ ...s_windows.ml-Ignore-blank-disks-in-d.patch | 76 +++++++++++++++++++ SOURCES/copy-patches.sh | 2 +- SPECS/libguestfs.spec | 20 ++++- 10 files changed, 332 insertions(+), 6 deletions(-) create mode 100644 SOURCES/0031-lib-inspect-osinfo.c-Generate-new-osinfo-shortname-f.patch create mode 100644 SOURCES/0032-daemon-Add-contents-of-etc-fstab-to-verbose-log.patch create mode 100644 SOURCES/0033-appliance-init-Add-lsblk-and-blkid-output-to-verbose.patch create mode 100644 SOURCES/0034-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch create mode 100644 SOURCES/0035-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch create mode 100644 SOURCES/0036-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch diff --git a/.gitignore b/.gitignore index 57266eb..7d22b45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ SOURCES/libguestfs-1.54.0.tar.gz SOURCES/libguestfs.keyring -SOURCES/libguestfs-common-1.50.2.tar.gz diff --git a/.libguestfs.metadata b/.libguestfs.metadata index 91a48cf..0089c7c 100644 --- a/.libguestfs.metadata +++ b/.libguestfs.metadata @@ -1,3 +1,2 @@ 219ca9ffccfb7c6377f50343aeef1b955bbf1961 SOURCES/libguestfs-1.54.0.tar.gz 1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring -f801826d11e360a906bae5980495ac5425d709ae SOURCES/libguestfs-common-1.50.2.tar.gz diff --git a/SOURCES/0031-lib-inspect-osinfo.c-Generate-new-osinfo-shortname-f.patch b/SOURCES/0031-lib-inspect-osinfo.c-Generate-new-osinfo-shortname-f.patch new file mode 100644 index 0000000..d21a115 --- /dev/null +++ b/SOURCES/0031-lib-inspect-osinfo.c-Generate-new-osinfo-shortname-f.patch @@ -0,0 +1,41 @@ +From e73ac4912d4864d5d378cd40bf1979e02bf0fcb1 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 11 Jun 2025 11:38:23 +0100 +Subject: [PATCH] lib/inspect-osinfo.c: Generate new osinfo shortname for SLES + >= 15 + +libosinfo changes the naming scheme it uses for SUSE starting with +major version 15. Previously it used names like "sles12" (or +"sles12sp1"), "sled12" for Server and Desktop variants. In 15+ it +uses "sle15" as there are no variants any longer (instead the +installer asks you what variant you want to install). We're only +interested in the Server variant. Change the name that we return to +"sle15" or "sle15sp1". + +See: https://gitlab.com/libosinfo/osinfo-db/-/commit/b0fa386699ce634abb6dd4b56aa0e83d979353fc +Fixes: https://issues.redhat.com/browse/RHEL-95791 +Thanks: Ming Xie, Victor Toso +Related: https://issues.redhat.com/browse/RHEL-95540 +(cherry picked from commit db46bcb5356e1c654a4b5b8ecca1ae657d46b9cf) +--- + lib/inspect-osinfo.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c +index f792d771..1fc2f59a 100644 +--- a/lib/inspect-osinfo.c ++++ b/lib/inspect-osinfo.c +@@ -62,10 +62,11 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) + else if (STREQ (distro, "fedora") || STREQ (distro, "mageia")) + return safe_asprintf (g, "%s%d", distro, major); + else if (STREQ (distro, "sles")) { ++ const char *base = major >= 15 ? "sle" : "sles"; + if (minor == 0) +- return safe_asprintf (g, "%s%d", distro, major); ++ return safe_asprintf (g, "%s%d", base, major); + else +- return safe_asprintf (g, "%s%dsp%d", distro, major, minor); ++ return safe_asprintf (g, "%s%dsp%d", base, major, minor); + } + else if (STREQ (distro, "ubuntu")) + return safe_asprintf (g, "%s%d.%02d", distro, major, minor); diff --git a/SOURCES/0032-daemon-Add-contents-of-etc-fstab-to-verbose-log.patch b/SOURCES/0032-daemon-Add-contents-of-etc-fstab-to-verbose-log.patch new file mode 100644 index 0000000..a2bf226 --- /dev/null +++ b/SOURCES/0032-daemon-Add-contents-of-etc-fstab-to-verbose-log.patch @@ -0,0 +1,47 @@ +From dbdc5bc7868ce4431d3dbf613c4b86d47236a34b Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 30 Jul 2025 10:53:20 +0100 +Subject: [PATCH] daemon: Add contents of /etc/fstab to verbose log + +Also some mdadm configuration files. This is useful for debugging. + +The output looks like this: + + info: /etc/fstab in /dev/VG/Root + LABEL=BOOT /boot ext2 default 0 0$ + LABEL=ROOT / ext2 default 0 0$ + +Fixes: https://issues.redhat.com/browse/RHEL-106490 +(cherry picked from commit f4f84a882468cb7b2dc4c265bdc18a5df79c3d4d) +--- + daemon/inspect_fs_unix_fstab.ml | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml +index b0de55e4..83d5016a 100644 +--- a/daemon/inspect_fs_unix_fstab.ml ++++ b/daemon/inspect_fs_unix_fstab.ml +@@ -43,6 +43,23 @@ let rec check_fstab ?(mdadm_conf = false) (root_mountable : Mountable.t) + if mdadm_conf then ["/etc/mdadm.conf"; "/etc/mdadm/mdadm.conf"] else [] in + let configfiles = "/etc/fstab" :: mdadmfiles in + ++ (* If verbose, dump the contents of each config file as that can be ++ * useful for debugging. ++ *) ++ if verbose () then ( ++ List.iter ( ++ fun filename -> ++ let sysroot_filename = Sysroot.sysroot_path filename in ++ if Sys.file_exists sysroot_filename then ( ++ eprintf "info: %s in %s\n%!" ++ filename (Mountable.to_string root_mountable); ++ let cmd = sprintf "cat -A %s >&2" (quote sysroot_filename) in ++ ignore (Sys.command cmd); ++ eprintf "\n%!" ++ ) ++ ) configfiles ++ ); ++ + with_augeas ~name:"check_fstab_aug" + configfiles (check_fstab_aug mdadm_conf root_mountable os_type) + diff --git a/SOURCES/0033-appliance-init-Add-lsblk-and-blkid-output-to-verbose.patch b/SOURCES/0033-appliance-init-Add-lsblk-and-blkid-output-to-verbose.patch new file mode 100644 index 0000000..91e605c --- /dev/null +++ b/SOURCES/0033-appliance-init-Add-lsblk-and-blkid-output-to-verbose.patch @@ -0,0 +1,45 @@ +From b448164dff834fe4e7a652bf9a4ef79f8d7952e2 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 30 Jul 2025 11:05:17 +0100 +Subject: [PATCH] appliance/init: Add lsblk and blkid output to verbose log + +This is useful for debugging. The output looks like: + + + lsblk + NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS + sda 8:0 0 1G 0 disk + |-sda1 8:1 0 512M 0 part + `-sda2 8:2 0 512M 0 part + |-VG-Root 252:0 0 32M 0 lvm + |-VG-LV1 252:1 0 32M 0 lvm + |-VG-LV2 252:2 0 32M 0 lvm + `-VG-LV3 252:3 0 64M 0 lvm + sdb 8:16 0 4G 0 disk / + + blkid + /dev/mapper/VG-LV1: UUID="cc8a3437-4169-4b1c-b432-ee8adc563f6d" BLOCK_SIZE="4096" TYPE="ext2" + /dev/sdb: UUID="30c70ddc-d00b-4620-a408-025890e59aa6" BLOCK_SIZE="4096" TYPE="ext2" + /dev/mapper/VG-LV2: UUID="747009aa-e183-46ba-a034-0c437b15cebc" BLOCK_SIZE="1024" TYPE="ext2" + /dev/mapper/VG-Root: LABEL="ROOT" UUID="01234567-0123-0123-0123-012345678902" BLOCK_SIZE="4096" TYPE="ext2" + /dev/sda2: UUID="DfEjc1-wRU6-vh8U-we7U-ivEl-FRwo-rG0ZuL" TYPE="LVM2_member" PARTUUID="184cbb43-02" + /dev/sda1: LABEL="BOOT" UUID="01234567-0123-0123-0123-012345678901" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="184cbb43-01" + /dev/mapper/VG-LV3: UUID="f9e5dc21-9a2a-45a0-85b0-e2889607139a" BLOCK_SIZE="2048" TYPE="ext2" + +Fixes: https://issues.redhat.com/browse/RHEL-106490 +(cherry picked from commit 217823da95aad095a1c86a90aa4b1db8d46319e4) +--- + appliance/init | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/appliance/init b/appliance/init +index dae06dbb..241928ef 100755 +--- a/appliance/init ++++ b/appliance/init +@@ -164,6 +164,8 @@ if test "$guestfs_verbose" = 1 && test "$guestfs_boot_analysis" != 1; then + ls -lR /dev + cat /proc/mounts + cat /proc/mdstat ++ lsblk ++ blkid + lvm config + lvm pvs + lvm vgs diff --git a/SOURCES/0034-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch b/SOURCES/0034-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch new file mode 100644 index 0000000..d977130 --- /dev/null +++ b/SOURCES/0034-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch @@ -0,0 +1,74 @@ +From cbd75c201754ff1c27911e63c92a82e1bcd21661 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 14:56:47 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Add debugging for MBR drive + mappings + +The function 'map_registry_disk_blob_gpt' immediately below this one +has a debugging statement. Add the equivalent to the function +'map_registry_disk_blob_mbr'. + +The output looks like: + + map_registry_disk_blob_mbr: searching for MBR disk ID 31 32 33 34 + map_registry_disk_blob_mbr: searching for MBR partition offset 00 00 00 10 00 00 00 00 + +(cherry picked from commit e18bd72c8edce1f7227ea625031df1f36db1a793) +--- + daemon/inspect_fs_windows.ml | 8 ++++++++ + daemon/utils.ml | 4 ++++ + daemon/utils.mli | 4 ++++ + 3 files changed, 16 insertions(+) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index 6537481e..18893e86 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -376,6 +376,10 @@ and map_registry_disk_blob_mbr devices blob = + * disk with this disk ID. + *) + let diskid = String.sub blob 0 4 in ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: searching for MBR disk ID %s\n%!" ++ (hex_of_string diskid); ++ + let device = + List.find ( + fun dev -> +@@ -388,6 +392,10 @@ and map_registry_disk_blob_mbr devices blob = + * partition byte offset from Parted.part_list. + *) + let offset = String.sub blob 4 8 in ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: searching for MBR partition offset \ ++ %s\n%!" ++ (hex_of_string offset); + let offset = int_of_le64 offset in + let partitions = Parted.part_list device in + let partition = +diff --git a/daemon/utils.ml b/daemon/utils.ml +index 3b5c957c..bfaab3b0 100644 +--- a/daemon/utils.ml ++++ b/daemon/utils.ml +@@ -296,3 +296,7 @@ let parse_key_value_strings ?unquote lines = + match unquote with + | None -> lines + | Some f -> List.map (fun (k, v) -> (k, f v)) lines ++ ++let hex_of_string s = ++ let bytes = String.map_chars (fun c -> sprintf "%02x" (Char.code c)) s in ++ String.concat " " bytes +diff --git a/daemon/utils.mli b/daemon/utils.mli +index e721f28f..250f2f81 100644 +--- a/daemon/utils.mli ++++ b/daemon/utils.mli +@@ -121,5 +121,9 @@ val parse_key_value_strings : ?unquote:(string -> string) -> string list -> (str + it is applied on the values as unquote function. Empty lines, + or that start with a comment character [#], are ignored. *) + ++val hex_of_string : string -> string ++(** Return a string as a list of hex bytes. ++ Use this for debugging msgs only. *) ++ + (**/**) + val get_verbose_flag : unit -> bool diff --git a/SOURCES/0035-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch b/SOURCES/0035-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch new file mode 100644 index 0000000..5e152bd --- /dev/null +++ b/SOURCES/0035-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch @@ -0,0 +1,31 @@ +From 3720994fca930e5cd685e6380ac5cd3068081bb3 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 14:57:45 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Add debugging when we start + registry analysis + +Add some debugging when we begin the process of analyzing the Windows +registry of a guest. + +(cherry picked from commit 5c7e15cfae7c91bb2e5685d657695a2d87d88bcd) +--- + daemon/inspect_fs_windows.ml | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index 18893e86..f4e3b998 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -207,6 +207,12 @@ and check_windows_registry systemroot data = + if Is.is_file system_hive then Some system_hive else None in + data.windows_system_hive <- system_hive; + ++ if verbose () then ++ eprintf "check_windows_registry: software hive: %s\n\ ++ check_windows_registry: system hive: %s\n%!" ++ (Option.value ~default:"None" software_hive) ++ (Option.value ~default:"None" system_hive); ++ + match software_hive, system_hive with + | None, _ | Some _, None -> () + | Some software_hive, Some system_hive -> diff --git a/SOURCES/0036-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch b/SOURCES/0036-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch new file mode 100644 index 0000000..29475fd --- /dev/null +++ b/SOURCES/0036-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch @@ -0,0 +1,76 @@ +From 98d94d847f9041df79c446d5c149bca626545eb0 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Aug 2025 15:17:59 +0100 +Subject: [PATCH] daemon/inspect_fs_windows.ml: Ignore blank disks in drive + mapping + +If HKLM\System\MountedDevices references a blank disk, then when we +try to search for the actual backing device we will get an error from +parted: + + parted: /dev/sdb: parted exited with status 1: Error: /dev/sdb: unrecognised disk label: Invalid argument + +Just ignore these errors instead of failing inspection. + +Fixes: https://issues.redhat.com/browse/RHEL-108803 +Reported-by: Ameen Barakat +Thanks: Ming Xie +(cherry picked from commit 1c00248ac191ab167f54103197a33bb60c3da67d) +--- + daemon/inspect_fs_windows.ml | 35 ++++++++++++++++++++++++++--------- + 1 file changed, 26 insertions(+), 9 deletions(-) + +diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml +index f4e3b998..5d92ca0f 100644 +--- a/daemon/inspect_fs_windows.ml ++++ b/daemon/inspect_fs_windows.ml +@@ -389,8 +389,18 @@ and map_registry_disk_blob_mbr devices blob = + let device = + List.find ( + fun dev -> +- Parted.part_get_parttype dev = "msdos" && ++ try ++ Parted.part_get_parttype dev = "msdos" && + pread dev 4 0x01b8 = diskid ++ with Unix.Unix_error (EINVAL, "parted", msg) -> ++ (* Errors can happen here if the disk is empty. Just ignore ++ * them. It means the drive mapping might have missing ++ * entries but that's not important. (RHEL-108803) ++ *) ++ if verbose () then ++ eprintf "map_registry_disk_blob_mbr: parted returned: \ ++ %s (ignored)\n" msg; ++ false + ) devices in + + (* Next 8 bytes are the offset of the partition in bytes(!) given as +@@ -428,14 +438,21 @@ and map_registry_disk_blob_gpt partitions blob = + let partition = + List.find ( + fun part -> +- let partnum = Devsparts.part_to_partnum part in +- let device = Devsparts.part_to_dev part in +- let typ = Parted.part_get_parttype device in +- if typ <> "gpt" then false +- else ( +- let guid = Sfdisk.part_get_gpt_guid device partnum in +- String.lowercase_ascii guid = blob_guid +- ) ++ try ++ let partnum = Devsparts.part_to_partnum part in ++ let device = Devsparts.part_to_dev part in ++ let typ = Parted.part_get_parttype device in ++ if typ <> "gpt" then false ++ else ( ++ let guid = Sfdisk.part_get_gpt_guid device partnum in ++ String.lowercase_ascii guid = blob_guid ++ ) ++ with Unix.Unix_error (EINVAL, "parted", msg) -> ++ (* See comment in MBR code above (RHEL-108803) *) ++ if verbose () then ++ eprintf "map_registry_disk_blob_gpt: parted returned: \ ++ %s (ignored)\n" msg; ++ false + ) partitions in + Some partition + with diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh index 99ced47..2a0a714 100755 --- a/SOURCES/copy-patches.sh +++ b/SOURCES/copy-patches.sh @@ -7,7 +7,7 @@ set -e # ./copy-patches.sh project=libguestfs -rhel_version=9.6 +rhel_version=9.7 # Check we're in the right directory. if [ ! -f $project.spec ]; then diff --git a/SPECS/libguestfs.spec b/SPECS/libguestfs.spec index 6516dfd..b2a4fc4 100644 --- a/SPECS/libguestfs.spec +++ b/SPECS/libguestfs.spec @@ -37,7 +37,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.54.0 -Release: 8%{?dist}.alma.1 +Release: 11%{?dist}.alma.1 License: LGPL-2.1-or-later # Build only for architectures that have a kernel @@ -74,7 +74,7 @@ Source7: libguestfs.keyring Source8: copy-patches.sh # Patches are maintained in the following repository: -# https://github.com/libguestfs/libguestfs/commits/rhel-9.6 +# https://github.com/libguestfs/libguestfs/commits/rhel-9.7 # Patches. Patch0001: 0001-website-Add-links-for-1.54-and-1.55-download-locatio.patch @@ -107,6 +107,12 @@ Patch0027: 0027-daemon-inspect-Resolve-Ubuntu-22-dev-disk-by-id-dm-u.patch Patch0028: 0028-RHEL-9-daemon-fstrim.c-Run-the-fstrim-command-twice.patch Patch0029: 0029-daemon-fstrim.c-Issue-sync_disks-after-fstrim.patch Patch0030: 0030-daemon-inspect-Remove-duplicate-root-mountpoints-in-.patch +Patch0031: 0031-lib-inspect-osinfo.c-Generate-new-osinfo-shortname-f.patch +Patch0032: 0032-daemon-Add-contents-of-etc-fstab-to-verbose-log.patch +Patch0033: 0033-appliance-init-Add-lsblk-and-blkid-output-to-verbose.patch +Patch0034: 0034-daemon-inspect_fs_windows.ml-Add-debugging-for-MBR-d.patch +Patch0035: 0035-daemon-inspect_fs_windows.ml-Add-debugging-when-we-s.patch +Patch0036: 0036-daemon-inspect_fs_windows.ml-Ignore-blank-disks-in-d.patch BuildRequires: autoconf, automake, libtool, gettext-devel @@ -1109,11 +1115,19 @@ rm ocaml/html/.gitignore %changelog -* Tue May 27 2025 Eduard Abdullin - 1:1.54.0-8.alma.1 +* Mon Sep 15 2025 Eduard Abdullin - 1:1.54.0-11.alma.1 - Fix build for AlmaLinux - Avoid permission denied for yum/dnf cache - Enable building for ppc64le +* Thu Aug 14 2025 Richard W.M. Jones - 1:1.54.0-11 +- Ignore blank disks in Windows drive mapping + resolves: RHEL-108803 + +* Tue Jun 17 2025 Richard W.M. Jones - 1:1.54.0-9 +- Generate correct osinfo for SLES >= 15 + resolves: RHEL-95791 + * Thu May 08 2025 Richard W.M. Jones - 1:1.54.0-8 - Remove duplicate root mountpoints in /etc/fstab resolves: RHEL-90168