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
This commit is contained in:
Richard W.M. Jones
2025-07-30 10:53:20 +01:00
parent c7aaa89fba
commit f4f84a8824

View File

@@ -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)