Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1657561

Summary: permissions denied using virt-sparsify
Product: [Fedora] Fedora Reporter: morgan read <mstuff>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-10 08:20:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
debug outputs none

Description morgan read 2018-12-10 00:50:17 UTC
Created attachment 1512922 [details]
debug outputs

Description of problem:
[readlegal@morgansmachine home_disk-image-files]$ sudo virt-sparsify --compress --tmp /home/tmp Win7.gcow2 Win7_virt-sparsify.gcow2 
[   0.0] Create overlay file in /home/tmp to protect source disk
[   0.1] Examine source disk
virt-sparsify: error: libguestfs error: could not create appliance through 
libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: Cannot access backing file 
'/run/media/readlegal/Backup/home_disk-image-files/Win7.gcow2' of storage 
file '/home/tmp/sparsify8844c2.qcow2' (as uid:107, gid:107): Permission 
denied [code=38 int1=13]

If reporting bugs, run virt-sparsify with debugging enabled and include the 
complete output:

  virt-sparsify -v -x [...]
[readlegal@morgansmachine home_disk-image-files]$

Version-Release number of selected component (if applicable):
$ virt-sparsify --version 
virt-sparsify 1.38.6fedora=28,release=1.fc28,libvirt

How reproducible:
Always

Steps to Reproduce:
1. make tmp file somewhere with enough space
2.run virt-sparsify
3.

Actual results:
success

Expected results:
failure

Additional info:

Comment 1 Richard W.M. Jones 2018-12-10 08:20:08 UTC
This is another manifestation of https://bugzilla.redhat.com/show_bug.cgi?id=890291

When libvirt is run as root, it runs qemu as a non-root qemu.qemu user which cannot access everything that root can.

One solution here is *not* to run virt-sparsify as root at all, since it doesn't need to be.

*** This bug has been marked as a duplicate of bug 890291 ***