[Libguestfs] debug a corrupted VHDX file with libguestfs

Richard W.M. Jones rjones at redhat.com
Mon Aug 7 12:12:05 UTC 2023


On Fri, Aug 04, 2023 at 10:37:50PM +0000, Lin, HongYi - Dell Team wrote:
> I tried to recompile Ubuntu kernel and add some printk messages, they don’t
> show up in dmesg when I run
> 
> root at HenrikUbuntu2204:/mnt/sdj# guestmount -a
> c1eef115-00000006-ec888b8d-64888b8d-00155000-4a448456 -m /dev/sda1 --ro /mnt/
> sdk/
>  
> 
> I guess the following messages are from libvirt / KVM ?
> 
> [   46.629055] EXT4-fs (sda1): ext4_check_descriptors: Block bitmap for group
> 524288 not in group (block 0)!
> 
> [   46.629656] EXT4-fs (sda1): group descriptors corrupted!

These messages are from the kernel.

However you will need to tell libguestfs to use your recompiled
kernel.  This can be done easily by setting some environment
variables.  This is what I do when I want to test a new kernel:

  rm -rf /tmp/kernel/*
  make
  make INSTALL_MOD_PATH=/tmp/kernel modules_install

  # In case the kernel modules are built with debug symbols:
  find /tmp/kernel/ -name '*.ko' -exec strip --strip-debug {} \;

  modules=`echo /tmp/kernel/lib/modules/*/`
  export SUPERMIN_KERNEL=$PWD/arch/x86/boot/bzImage
  export SUPERMIN_MODULES=$modules

  rm -rf /var/tmp/.guestfs-`id -u`/

Then run guestmount in the usual way.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


More information about the Libguestfs mailing list