[Libguestfs] [libguestfs/libguestfs] virt-tar-out (#37)

Richard W.M. Jones rjones at redhat.com
Mon May 13 07:38:38 UTC 2019


On Sun, May 12, 2019 at 04:11:08PM -0700, Jun Aruga wrote:
> I am using libguestfs tool on Fedora 30.
> 
> libguestfs version: 1.40.2
> libguestfs-tools-c RPM package version: libguestfs-tools-c-1.40.2-4.fc30.x86_64
> 
> 
> I have a question about `virt-tar-out`.
> 
> ```
> $ rpm -qf /usr/bin/virt-tar-out
> libguestfs-tools-c-1.40.2-4.fc30.x86_64
> ```
> 
> Current master's `fish/virt-tar-out` https://github.com/libguestfs/libguestfs/blob/master/fish/virt-tar-out is almost same with my local `/usr/bin/virt-tar-out` except bash path.
> 
> ```
> $ diff fish/virt-tar-out /usr/bin/virt-tar-out 
> 1c1
> < #!/bin/bash -
> ---
> > #!/usr/bin/bash -
> ```

Something in Fedora itself rewrites this path, it's nothing to do with
libguestfs and in any case this should not cause a problem.

> ## case1: convert CentOS7 aarch64 iso image to the tar file.
> 
> ```
> $ wget http://mirror.centos.org/altarch/7.6.1810/isos/aarch64/CentOS-7-aarch64-Minimal-1810.iso
> ```
> 
> ```
> $ virt-tar-out -a CentOS-7-aarch64-Minimal-1810.iso / foo.tar
> virt-tar-out: no operating system was found on this disk

libguestfs cannot inspect installation ISOs which is why this fails.

> If using guestfish ‘-i’ option, remove this option and instead
> use the commands ‘run’ followed by ‘list-filesystems’.
> You can then mount filesystems you want by hand using the
> ‘mount’ or ‘mount-ro’ command.
> 
> If using guestmount ‘-i’, remove this option and choose the
> filesystem(s) you want to see by manually adding ‘-m’ option(s).
> Use ‘virt-filesystems’ to see what filesystems are available.
> 
> If using other virt tools, this disk image won’t work
> with these tools.  Use the guestfish equivalent commands
> (see the virt tool manual page).
> ```
> 
> This works when running `guestfish` directly like this.
> 
> ```
> $ guestfish -a CentOS-7-aarch64-Minimal-1810.iso --ro <<EOF
> run
> list-filesystems
> EOF
> /dev/sda: iso9660
> ```
> 
> ```
> $ guestfish --ro -a CentOS-7-aarch64-Minimal-1810.iso -m /dev/sda tar-out / foo.tar
> 
> $ echo $?
> 0
> 
> $ du -sh foo.tar 
> 768M	foo.tar
> ```
> 
> ## case2: convert CentOS7 ppc64 iso image to the tar file.
> 
> ```
> $ wget http://mirror.centos.org/altarch/7.6.1810/isos/ppc64/CentOS-7-ppc64-Minimal-1810.iso
> ```
> 
> ```
> $ virt-tar-out -a CentOS-7-ppc64-Minimal-1810.iso foo.tar
> virt-tar-out: no operating system was found on this disk
> 
> If using guestfish ‘-i’ option, remove this option and instead
> use the commands ‘run’ followed by ‘list-filesystems’.
> You can then mount filesystems you want by hand using the
> ‘mount’ or ‘mount-ro’ command.
> 
> If using guestmount ‘-i’, remove this option and choose the
> filesystem(s) you want to see by manually adding ‘-m’ option(s).
> Use ‘virt-filesystems’ to see what filesystems are available.
> 
> If using other virt tools, this disk image won’t work
> with these tools.  Use the guestfish equivalent commands
> (see the virt tool manual page).
> ```
> 
> This works when running `guestfish` directly like this.
> 
> ```
> $ guestfish -a CentOS-7-ppc64-Minimal-1810.iso --ro <<EOF
> run
> list-filesystems
> EOF
> /dev/sda1: iso9660
> ```
> 
> ```
> $ guestfish --ro -a CentOS-7-ppc64-Minimal-1810.iso -m /dev/sda1 tar-out / foo.tar
> 
> $ echo $?
> 0
> 
> $ du -sh foo.tar 
> 877M	foo.tar
> ```
> 
> Why is `virt-tar-out` command not working?
> I should use `guestfish` command directly?

virt-tar-out is just a convenient, thin wrapper around guestfish, so
use guestfish if that works for you.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list