libguestfs inspection now lists Windows apps

In version ≥ 1.7.8 Windows apps can be listed from virt-inspector:

$ virt-inspector Win7.img
[...]
    <applications>
      <application>
        <name>Mozilla Firefox (3.6.12)</name>
        <display_name>Mozilla Firefox (3.6.12)</display_name>
        <version>3.6.12 (en-GB)</version>
        <install_path>C:\Program Files\Mozilla Firefox</install_path>
[etc]

or from guestfish:

$ guestfish -a Win7.img --ro -i
Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: Windows 7 Enterprise
/dev/vda2 mounted on /

><fs> inspect-list-applications /dev/vda2
[0] = {
  app_name: Mozilla Firefox (3.6.12)
  app_display_name: Mozilla Firefox (3.6.12)
  app_epoch: 0
  app_version: 3.6.12 (en-GB)
  app_release: 
  app_install_path: C:\Program Files\Mozilla Firefox
  app_trans_path: 
  app_publisher: Mozilla
  app_url: http://www.mozilla.com/en-GB/
  app_source_package: 
  app_summary: 
  app_description: 
}
[1] = {
  app_name: VLC media player
  app_display_name: VLC media player 1.1.5
  app_epoch: 0
  app_version: 1.1.5
  app_release: 
  app_install_path: C:\Program Files\VideoLAN\VLC
  app_trans_path: 
  app_publisher: VideoLAN
  app_url: http://www.videolan.org/
  app_source_package: 
  app_summary: 
  app_description: 
}

The same API also works for Fedora, RHEL, Debian and Ubuntu guests, where it lists installed packages instead of “applications”.

2 Comments

Filed under Uncategorized

2 responses to “libguestfs inspection now lists Windows apps

  1. zhang yuxing

    Hi, Mr. Rich
    I found a problem when I use the libguestfs:
    In my project, I share a vmdk file with the ntfs file system in a container through the qemu-nbd server. I want to access it in the form of guestfish -a nbd://ip in another container based on the ARM-64 environment. /dev/sdx can be mounted successfully. When I call inspect_os, the shell throws a Hivex error. The logs are as follows:

    PE32+ executable (console) x86-64, for MS Windows
    chroot: /sysroot: running ‘case_sensitive_path: /Windows/system32/config/software’
    chroot: /sysroot: running ‘is_file: /Windows/System32/config/SOFTWARE’
    chroot: /sysroot: running ‘case_sensitive_path: /Windows/system32/config/system’
    chroot: /sysroot: running ‘is_file: /Windows/System32/config/SYSTEM’
    hivex: hivex_open: successfully read Windows Registry hive file:
    pages: 14055 [sml: 4096, lge: 16384]
    blocks: 1111157 [sml: 8, avg: 56, lge: 16352]
    blocks used: 1110291
    bytes used: 62533912
    hivex: hivex_close: hivex_close
    ocaml_exn: ‘inspect_os’ raised ‘Hivex.Error’ exception
    guestfsd: error: internal error: inspect_os: unhandled exception thrown: Hivex.Error
    guestfsd: => inspect_os (0x1e0) took 2.93 secslibguestfs: trace: inspect_os = NULL (error)
    libguestfs: error: inspect_os: internal error: inspect_os: unhandled exception thrown: Hivex.Error

    I have installed the Hivex software package. After the problem cannot be located, I attempt to compile Hivex manually. After I run make, the following error occurs:

    make[2]: Entering directory ‘/root/hivex-1.3.17/images’
    CC mklarge-mklarge.o
    CCLD mklarge
    cmp -s ./minimal ./minimal || \
    cp ./minimal ./minimal
    ./mklarge ./minimal ./large
    mklarge: hivex_node_add_child: Invalid argument
    make[2]: *** [Makefile:1539: large] Error 1
    make[2]: Leaving directory ‘/root/hivex-1.3.17/images’
    make[1]: *** [Makefile:1402: all-recursive] Error 1
    make[1]: Leaving directory ‘/root/hivex-1.3.17’
    make: *** [Makefile:1309: all] Error 2

    I don’t know how to fix this mistake. What’s your opinion about this situation? Look forward to your reply.

    Thanks,
    Yuxing

    • zhang yuxing

      After I run the guestfish_run command, the log is as follows:

      OCaml daemon loaded
      trying to open virtio-serial channel ‘/dev/virtio-ports/org.libguestfs.channel.0’
      2020-10-22T13:01:32.849704+08:00|info|qemu[21410]|[21410]|handle_control_message[372]|: virtio serial port ‘1’ handle control message event = 6, value = 1
      commandrvf: stdout=n stderr=y flags=0x0
      commandrvf: udevadm –debug settle
      Unknown filesystem type 62656572 mounted on /sys/fs/cgroup.
      libguestfs: recv_from_daemon: received GUESTFS_LAUNCH_FLAG
      libguestfs: appliance is up
      libguestfs: trace: launch = 0

      But I can still list the file systems and mount /dev/sdx.
      Look forward to your reply.
      Thanks,
      Yuxing

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.