Bug 1293527 - There should be a reminder to avoid user to edit a guest image by multiple tools at the same time in guestfish man page
There should be a reminder to avoid user to edit a guest image by multiple to...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.2
Unspecified Unspecified
low Severity low
: rc
: 7.3
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks: 1301891
  Show dependency treegraph
 
Reported: 2015-12-21 22:12 EST by Xianghua Chen
Modified: 2016-11-03 13:57 EDT (History)
5 users (show)

See Also:
Fixed In Version: libguestfs-1.32.0-3.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 13:57:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Xianghua Chen 2015-12-21 22:12:08 EST
Description of problem:
I was using "guestfish -a $guest_image -i" without --ro, and at the mean time I used virt-edit/virt-sysprep to modify the guest image, there will be a crash if I'm modifying the same file.
According to the mail discussion with Rich, It's hard to determine that you're using the disk image from multiple tools at once, but it won't work and it will corrupt the disk image.

So, there should be a reminder to avoid user to edit a guest image by multiple tools at the same time in guestfish man page (perhaps in the warning part: http://libguestfs.org/guestfish.1.html#warning)


Version-Release number of selected component (if applicable):
libguestfs-1.20.11-16.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a guest image RHEL-Server-6.7-32-hvm.raw .
2.
# guestfish -a RHEL-Server-6.7-32-hvm.raw -i
><fs> touch /home/file1
><fs> vi /home/file1 
><fs> cat /home/file1
guestfish
><fs> vi /home/file1
Add the content "guestfish add", don't save or exit.

3. At the mean time, open a new tab and execute:
# virt-edit -a RHEL-Server-6.7-32-hvm.raw  /home/file1
Add the content "virt-edit" at the second line,save&exit

4. save & exit step 2 at the same time.
5. exit guestfish and enter again,
# guestfish -a RHEL-Server-6.7-32-hvm.raw -i
><fs> cat /home/file1
guestfish
virt-

You can see some content are lost.
p.s.:
There are also other possible errors, like the file is crash and deleted, or there are garbage characters, etc.

Actual results:


Expected results:


Additional info:
1. On RHEL7.2(libguestfs-1.28.1-55.el7.x86_64) , there is the same problem.
Comment 1 Richard W.M. Jones 2016-01-04 10:19:41 EST
We already have a warning section, see eg:
http://libguestfs.org/guestfish.1.html#warning

However it's not very consistent across different
man pages, and it doesn't mention concurrent use of
disk editing tools.

The following patch series aims to fix this:

https://www.redhat.com/archives/libguestfs/2016-January/msg00001.html

This is not RHEL 6 material, so I have moved the BZ to RHEL 7.
Comment 5 Xianghua Chen 2016-06-27 10:36:15 EDT
Verified with the packages:
libguestfs-1.32.5-6.el7.x86_64

Verify steps: 
Check the manpage of guestfish, virt-edit, virt-copy-in, virt-tar-in, guestmount, virt-rescue, virt-sysprep, virt-sparsify, etc.

There is a warning section like :
Using "guestfish" in write mode on live virtual machines, or  concurrently with other disk editing tools, can be dangerous, potentially causing disk corruption.  The virtual machine must be shut down before you use this command, and disk images must not be  edited concurrently.



So verified.
Comment 7 errata-xmlrpc 2016-11-03 13:57:44 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2576.html

Note You need to log in before you can comment on or make changes to this bug.