USB devices are not closed when error occurs

Bug #1642812 reported by Robert Liu on 2016-11-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
fwupd (Ubuntu)
Brian Murray

Bug Description


 * fwupd (used in Xenial) does not close USB device nodes when it fails to process the

 * The orphan (un-closed) device node will be kept until fwupd ends

 * The behavior will avoid the system to set the USB device as idle/suspend then the system cannot enter some power-saving mode (eg. S0ix)

[Test Case]

 * make sure fwupd is not running by executing 'fwupdmgr get-devices'
   It will show devices information.

 * list the fds opened by fwupd
   $ sudo ls -l /proc/$(pgrep fwupd)/fd | grep usb
   If a system is not affected, it will output nothing.
   If the result shows one or more strings like /dev/bus/usb/[BUS]/[DEV]
   (BUS and DEV are numeric variables), that means the issue is existing.

[Regression Potential]

 * The fix only closes file descriptors of USB devices when errors happen and should not have regression there.

[Original description]
  In fwupd, a few of USB devices are not closed when there are some failures of
  operations. This issue will cause fwupd has some orphan USB nodes inside during fwupd is
  running. A orphan USB node might introduce memory leak and block some runtime power
  features as well.

  I proposed a upstream PR, and also put the link here.

Robert Liu (robertliu) on 2016-11-18
description: updated
Robert Liu (robertliu) wrote :

The upstream PR has been merged.
Could we have this patch also land in Ubuntu, please?

The attachment "Close-usb-devices-before-error-returns.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Robert Liu (robertliu) wrote :

update the patch to fix the compiling error.

Robert Liu (robertliu) wrote :

for Zesty

Robert Liu (robertliu) wrote :

for Yakkety

Robert Liu (robertliu) wrote :

for Xenial

Changed in fwupd (Ubuntu):
importance: Undecided → Medium
Changed in fwupd (Ubuntu Zesty):
status: New → Fix Released
Mario Limonciello (superm1) wrote :

Zesty adopted 0.8.1, this is already fixed there.

Amr Ibrahim (amribrahim1987) wrote :


Changed in fwupd (Ubuntu Yakkety):
status: New → Won't Fix
Changed in fwupd (Ubuntu):
status: New → Fix Released
Brian Murray (brian-murray) wrote :

Could you please update the bug description so that it contains information necessary for the SRU process? Thanks in advance!

I've subscribed myself to the bug and will upload the SRU once we have a properly formatted bug report.

Changed in fwupd (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Robert Liu (robertliu) wrote :

Hi @Brian,
I have updated the bug description. If there is something missing, please let me know. Thanks.

description: updated
Brian Murray (brian-murray) wrote :

I've uploaded this for review by the SRU team.

Changed in fwupd (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
Brian Murray (brian-murray) wrote :

Oh, I somehow missed there is already a version, 0.8.3, of fwupd in -proposed for Xenial. Do you know if that version includes the fix for which you are looking?

Brian Murray (brian-murray) wrote :

There are calls to "g_usb_device_close" in 0.8.3 so could you test the version of fwupd in -proposed for xenial and see if it fixes this bug also?

Robert Liu (robertliu) wrote :

Hi @Brian,
The proposed version (0.8.3) has been verified. It does fix the bug as well.

SKU: Dell Thin client
Old version (0.7.0): fwupd has a open fd (/dev/bus/usb/001/007)
New version (0.8.3): fwupd doesn't have a open fd.

Changed in fwupd (Ubuntu Xenial):
status: Triaged → Fix Committed

Hello Robert, or anyone else affected,

Accepted fwupd into xenial-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance!

tags: added: verification-needed verification-needed-xenial
Robert Liu (robertliu) wrote :

The proposed version 0.8.3-0ubuntu2 has been verified. It does fix the bug and no regression is found with my hardware.

SKU: Dell Thin client
Old version (0.7.0-0ubuntu4.3): fwupd has a open fd (/dev/bus/usb/001/007)
New version (0.8.3-0ubuntu2): fwupd doesn't have a open fd.

tags: added: verification-done-xenial
removed: verification-needed-xenial
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package fwupd - 0.8.3-0ubuntu2

fwupd (0.8.3-0ubuntu2) xenial; urgency=medium

  * Fix systemd unit for what is actually supported in
    systemd 229 in xenial (LP: #1746114)
  * This bug also fixes issues with USB devices being closed (LP: #1642812)

 -- Mario Limonciello <email address hidden> Wed, 14 Feb 2018 14:32:41 -0500

Changed in fwupd (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for fwupd 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.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers