Red Hat Bugzilla – 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
Last modified: 2016-11-03 13:57:44 EDT
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.
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.
This is upstream in: https://github.com/libguestfs/libguestfs/commit/6fa4d983a3b7df682fac0801bb89b477e2db4b71 https://github.com/libguestfs/libguestfs/commit/bb27fc1c0afd23c805a8db474b4cfe97c072fdd6 https://github.com/libguestfs/libguestfs/commit/446f7794e0231ae3f6bc724cdbc18235a32bca42
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.
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