Bug 672485

Summary: [RFE] virt-edit/tar-in/tar-out/inspector do not support encrypted system
Product: Red Hat Enterprise Linux 7 Reporter: Lei Wang <leiwang>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: lkong, mshao, rjones
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: libguestfs-1.22.2-1.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:35:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lei Wang 2011-01-25 10:06:00 UTC
Description of problem:
virt-edit/tar/inspector do not support encrypted system, while some other virt-* commands like virt-cat/ls work fine with encrypted system.

Version-Release number of selected component (if applicable):
libguestfs-tools-1.7.17-10.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Run virt-edit/tar/inspector with an encrypted VM:
virt-edit /var/lib/libvirt/images/rhel55-64-encryptsystem.img /etc/issue
virt-tar -x /var/lib/libvirt/images/rhel55-64-encryptsystem.img /home home.tar
virt-inspector /var/lib/libvirt/images/rhel55-64-encryptsystem.img

2.Run virt-cat/ls with the encrypted VM:
virt-cat -a /var/lib/libvirt/images/rhel55-64-encryptsystem.img /etc/issue
virt-ls -a /var/lib/libvirt/images/rhel55-64-encryptsystem.img /etc

  
Actual results:
At step1, after running the commands there will return similar messages as below:

"virt-edit: No operating system could be detected inside this disk image.

This may be because the file is not a disk image, or is not a virtual machine
image, or because the OS type is not understood by libguestfs.

If you feel this is an error, please file a bug report including as much
information about the disk image as possible."

And at step2, there will be prompt like "Enter key or passphrase ("/dev/vda2"):" to ask users to enter the passphrase, and then the virt-* commands work as expected.

Expected results:
The three virt-* commands virt-edit/tar/inspector should also work well with encrypted system.

Comment 2 Richard W.M. Jones 2011-01-25 10:22:23 UTC
I agree this is a shortcoming, but it's not something we
can do for 6.1.

Setting flags for 6.2.

(Note it's an RFE, not a regression: in 6.0 we didn't support
encrypted guests at all :-)

Comment 3 Lei Wang 2011-01-27 07:14:45 UTC
Also "virt-df -a encrypted_image" does not show the encrypted partitions, only regular partitions were listed, but it won't report error messages.

Comment 5 Richard W.M. Jones 2011-06-12 18:11:44 UTC
Upstream:

- virt-edit now supports encrypted filesystems
- virt-inspector (ie. "virt-inspector2" in RHEL) has supported it
  for quite a while
- virt-tar is obsolete, replaced by virt-tar-in and virt-tar-out
  which are just wrappers around guestfish and therefore support
  encrypted filesystems

-> RHEL 7

Comment 6 Richard W.M. Jones 2013-07-19 10:47:40 UTC
I believe this should Just Work in all recent versions
of libguestfs, including RHEL >= 6.4 and RHEL >= 7.

Note that 'virt-tar' is obsolete.  Don't use it or test it.
Use 'virt-tar-in' and/or 'virt-tar-out' instead.

Comment 8 Lingfei Kong 2013-11-18 03:41:38 UTC
I try to reproduce it with libguestfs-1.21.33-1.1.el7, but 
virt-tar-out, virt-ls virt-df, virt-cat, virt-inspector works well with encrypted systems, as it is a new function for these tools to support encrypted systems, is it ok to just verify it?

Comment 9 Richard W.M. Jones 2013-11-18 08:37:06 UTC
Yes, if it works, please move it to VERIFIED.

Comment 10 Lingfei Kong 2013-11-18 08:44:02 UTC
Verify with libguestfs-1.22.6-15.el7

Steps to verify:
1. Install encrypted system to hvm-6.5-64-2.img
2. Run the following command:
#virt-tar-out  -a ./hvm-6.5-64-2.img /home home.tar
#virt-tar-in -a ./hvm-6.5-64-2.img virsh-kvm.tar /home/
#virt-edit -a ./hvm-6.5-64-2.img  /etc/issue
#virt-inspector -a ./hvm-6.5-64-2.img
#virt-cat -a ./hvm-6.5-64-2.img /etc/issue
#virt-ls -a ./hvm-6.5-64-2.img /home/
#virt-df -a ./hvm-6.5-64-2.img

These command works well with encrypted system.

Comment 11 Ludek Smid 2014-06-13 11:35:06 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.