Add /etc/fstab, lsblk and blkid to verbose output

resolves: RHEL-106539
This commit is contained in:
Richard W.M. Jones 2025-07-30 12:23:48 +01:00
parent d475e2337c
commit 74238a92e0
3 changed files with 99 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From dbdc5bc7868ce4431d3dbf613c4b86d47236a34b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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)

View File

@ -0,0 +1,45 @@
From b448164dff834fe4e7a652bf9a4ef79f8d7952e2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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

View File

@ -37,7 +37,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.54.0
Release: 9%{?dist}
Release: 10%{?dist}
License: LGPL-2.1-or-later
# Build only for architectures that have a kernel
@ -106,6 +106,8 @@ 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
BuildRequires: autoconf, automake, libtool, gettext-devel
@ -1115,6 +1117,10 @@ rm ocaml/html/.gitignore
%changelog
* Wed Jul 30 2025 Richard W.M. Jones <rjones@redhat.com> - 1:1.54.0-10
- Add /etc/fstab, lsblk and blkid to verbose output
resolves: RHEL-106539
* Tue Jun 17 2025 Richard W.M. Jones <rjones@redhat.com> - 1:1.54.0-9
- Generate correct osinfo for SLES >= 15
resolves: RHEL-95791