Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 679737 - libguestfs: improve error message when zerofree is not available in the appliance
libguestfs: improve error message when zerofree is not available in the appli...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
6.1
Unspecified Linux
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-23 06:36 EST by Jinxin Zheng
Modified: 2012-06-20 02:59 EDT (History)
4 users (show)

See Also:
Fixed In Version: libguestfs-1.16.5-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 02:59:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0774 normal SHIPPED_LIVE Low: libguestfs security, bug fix, and enhancement update 2012-06-19 15:29:50 EDT

  None (edit)
Description Jinxin Zheng 2011-02-23 06:36:12 EST
Description of problem:
zerofree is unavailable in RHEL 6.

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

How reproducible:
Always

Steps to Reproduce:

$ guestfish
><fs> alloc test.img 100M
><fs> run
><fs> mkfs ext2 /dev/sda
><fs> zerofree /dev/sda
libguestfs: error: zerofree: /dev/vda: zerofree: No such file or directory
Comment 1 Richard W.M. Jones 2011-02-24 01:54:08 EST
In some sense this is correct :-)

Try doing the following command in guestfish (requires the "run"
command to have been done first):

><fs> supported

At the end of the list you should see "zerofree no" indicating that
the zerofree command isn't available in the daemon.

Also:
http://libguestfs.org/guestfs.3.html#availability

However it may be that we need to either:
(1) Add zerofree as a new package to RHEL 6 (probably not
advisable, it's a rather experimental package which can destroy
filesystems if it is not used correctly)

(2) Improve the error message.

Anyway, this is a 6.2 thing I think, so I have reset the flags
to 6.2 ...
Comment 2 Jinxin Zheng 2011-02-24 03:00:57 EST
Well. If zerofree is too dangerous to RHEL 6, why is it still in libguestfs since it could be impossibly available?

Some groups (like ntfs3g) are optional by providing a separate support package. But we'll never get zerofree. Shouldn't it be removed from libguestfs like in 6.0?
Comment 3 Richard W.M. Jones 2011-02-24 19:15:37 EST
The problem is that if we remove the underlying API (ie.
guestfs_zerofree) then some programs wouldn't compile.

If programmers are following the documentation, then
they should be calling guestfs_available first before
using guestfs_zerofree, and they should also check the
return value from guestfs_zerofree for errors.

We could remove it leave it in the API but remove it from
guestfish, but that just makes guestfish irregular -- we
document that guestfish has an equivalent for every
libguestfs API call.

Also it is conceivable that a RHEL 6 user could prepare a
package containing zerofree + the relevant supermin
appliance changes which would transparently add zerofree
support back into libguestfs.  This is roughly what
libguestfs-winsupport does for ntfs-3g.

I don't think there is a good answer to this, although
improving the error message would be a good idea.
Comment 4 Richard W.M. Jones 2011-06-10 05:20:13 EDT
6.3 material, unless a customer complains about this.

zerofree is dangerous.  To add it to RHEL we'd need to
have the code fully and properly checked by Ric Wheeler
and friends.
Comment 5 Richard W.M. Jones 2012-02-01 06:21:31 EST
Reproducer:

$ guestfish -N fs zerofree /dev/sda1
libguestfs: error: zerofree: /dev/vda1: zerofree: No such file or directory

Note this creates/overwrites a file in the current directory
called 'test1.img', so:

$ rm test1.img
Comment 6 Richard W.M. Jones 2012-02-01 07:21:55 EST
Patch posted:

https://www.redhat.com/archives/libguestfs/2012-February/msg00000.html
Comment 7 Richard W.M. Jones 2012-02-01 10:13:38 EST
Updated patch posted:

https://www.redhat.com/archives/libguestfs/2012-February/msg00002.html
Comment 8 Richard W.M. Jones 2012-02-01 11:07:10 EST
Committed upstream:

https://github.com/libguestfs/libguestfs/commit/330fbea5b2d6bd7db84f7ea7afe87cf1bcd438e0
Comment 11 Richard W.M. Jones 2012-02-13 04:34:45 EST
The patch is incomplete and causes the daemon to
segfault in some circumstances.  Patch posted to
fix that:

https://www.redhat.com/archives/libguestfs/2012-February/msg00057.html
Comment 12 Richard W.M. Jones 2012-02-13 10:42:58 EST
Fix included in libguestfs 1.17.7:
https://github.com/libguestfs/libguestfs/commit/ba443ae0486ae30ea597c4e126de63371f8fa7a8
and this will be backported to 1.16 branch and RHEL 6.3.
Comment 13 Richard W.M. Jones 2012-02-13 12:51:56 EST
The fix is included in upstream stable branch version
1.16.5, and in RHEL 6.3 build (same version).
Comment 17 Richard W.M. Jones 2012-04-26 08:15:13 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation needed
Comment 19 errata-xmlrpc 2012-06-20 02:59:28 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.

http://rhn.redhat.com/errata/RHSA-2012-0774.html

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