libvirtError: cannot unlink file '/var/lib/libvirt/images/xxx.qcow2': Success

Bug #1571068 reported by Felipe Reyes
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
libvirt
Fix Released
Undecided
libvirt (Ubuntu)
Fix Released
High
Unassigned
Wily
Won't Fix
Medium
Unassigned
Xenial
Fix Released
Medium
Unassigned

Bug Description

Steps to reproduce:

1) Create VM using virt-install
2) Delete the VM with its associated volume

Expected results:

The VM is removed and the volume is deleted

Actual results:

When trying to remove the volume the following error is printed:

Errors encountered while removing certain storage devices.

cannot unlink file '/var/lib/libvirt/images/bootstrap.qcow2': Success
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/delete.py", line 182, in _async_delete
    self._async_delete_path(conn, path, meter)
  File "/usr/share/virt-manager/virtManager/delete.py", line 228, in _async_delete_path
    vol.delete(0)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 3359, in delete
    if ret == -1: raise libvirtError ('virStorageVolDelete() failed', vol=self)
libvirtError: cannot unlink file '/var/lib/libvirt/images/xxx.qcow2': Success

And the volume is still there
$ sudo virsh vol-list default
 Name Path
------------------------------------------------------------------------------
 bootstrap.qcow2 /var/lib/libvirt/images/bootstrap.qcow2
$ sudo file /var/lib/libvirt/images/bootstrap.qcow2
/var/lib/libvirt/images/bootstrap.qcow2: QEMU QCOW Image (v3), 21474836480 bytes

Other info:

I found an upstream bug that is related to this problem https://bugzilla.redhat.com/show_bug.cgi?id=1293804 , I tested the merged patch and it fixed the problem for me.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: libvirt-bin 1.2.16-2ubuntu11.15.10.3
ProcVersionSignature: Ubuntu 4.2.0-34.39-generic 4.2.8-ckt4
Uname: Linux 4.2.0-34-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
Date: Fri Apr 15 17:05:34 2016
InstallationDate: Installed on 2014-12-06 (495 days ago)
InstallationMedia: Ubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
SourcePackage: libvirt
UpgradeStatus: Upgraded to wily on 2016-03-08 (38 days ago)
modified.conffile..etc.apparmor.d.usr.lib.libvirt.virt.aa.helper: [modified]
modified.conffile..etc.libvirt.qemu.conf: [inaccessible: [Errno 13] Permission denied: '/etc/libvirt/qemu.conf']
modified.conffile..etc.libvirt.qemu.networks.default.xml: [inaccessible: [Errno 13] Permission denied: '/etc/libvirt/qemu/networks/default.xml']
mtime.conffile..etc.apparmor.d.usr.lib.libvirt.virt.aa.helper: 2016-03-14T13:22:07.751461

Revision history for this message
Felipe Reyes (freyes) wrote :
description: updated
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1571068] [NEW] libvirtError: cannot unlink file '/var/lib/libvirt/images/xxx.qcow2': Success

Thanks - so libvirt commit adefc561 should be applied. We should SRU
this as soon as 16.04 is released.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Marking confirmed based on upstream fix

 status confirmed
 importance high

Changed in libvirt (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

in the bugzilla bug this is marked as fixed in 1.3.3 of libvirt, and yakkety currently has 1.3.4, so I've marked fix-released in Ubuntu (yakkety), and targetted xenial and wily for SRU.

Changed in libvirt (Ubuntu):
status: Confirmed → Fix Released
Changed in libvirt (Ubuntu Wily):
status: New → Confirmed
importance: Undecided → Medium
Changed in libvirt (Ubuntu Xenial):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Ryan Harper (raharper) wrote :

Applied the patch indicated in the Bugzilla, plus one more needed to allow it to apply cleanly.

Build to ppa underway, available soon here:

https://launchpad.net/~raharper/+archive/ubuntu/bugfixes/+build/10195197

Revision history for this message
Adam Conrad (adconrad) wrote :

Wily will be EOL soon, not much point fixing it there.

Changed in libvirt (Ubuntu Wily):
status: Confirmed → Won't Fix
Changed in libvirt (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Felipe, or anyone else affected,

Accepted libvirt into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/libvirt/1.3.1-1ubuntu10.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ha,
not only do I want this to finally get through proposed I also often have this issue.
So a testcase is at hand:

before:
$ uvt-kvm destroy xenial-qemu-libvirt-test
uvt-kvm: error: libvirt: cannot unlink file '/var/lib/uvtool/libvirt/images/xenial-qemu-libvirt-test.qcow': Permission denied

Upgrade to proposed, now at 1.3.1-1ubuntu10.2

$ uvt-kvm destroy xenial-qemu-libvirt-test
[works]

tags: added: verification-done
removed: verification-needed
Revision history for this message
Matt Stephenson (mstephenson6) wrote :

1.3.1-1ubuntu10.2 fixes issue for me as well.

Before installing from proposed, could not `uvt-kvm destroy` domains, was getting "libvirt: cannot unlink file", even when attempted via sudo.

After installing, can destroy domains that were already created with 1.3.1-ubuntu10.1.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.3.1-1ubuntu10.2

---------------
libvirt (1.3.1-1ubuntu10.2) xenial; urgency=medium

  * fix file removal in storage pools (LP: #1571068)
    - debian/patches/fix-vol-remove-only-setuid-for-virFileRemove-if-on-NFS.patch
    - debian/patches/fix-vol-remove-vir-file-breakout.patch

 -- Ryan Harper <email address hidden> Thu, 30 Jun 2016 10:09:45 -0500

Changed in libvirt (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for libvirt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Changed in libvirt:
importance: Unknown → Undecided
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.