lspci returns error on devices that don't have pci adapters (arm)

Bug #608449 reported by Ricardo Salveti
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Apport
Undecided
Unassigned
apport (Ubuntu)
Medium
Unassigned

Bug Description

When reporting a system bug on BeagleBoard (ARM based) with Ubuntu, Apport shows an error while trying to list the pci devices of the system.

As BeagleBoard doesn't have any pci adapter, the command lspci will return an error and this error will be inside apport bug report (besides giving a traceback at the console).

ubuntu@beagle-maverick:~$ ubuntu-bug linux
** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
** Message: pygobject_register_sinkfunc is deprecated (GtkObject)
hook /usr/share/apport/package-hooks//source_linux.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/apport/report.py", line 636, in add_hooks_info
    symb['add_info'](self, ui)
  File "/usr/share/apport/package-hooks//source_linux.py", line 123, in add_info
    attach_alsa(report)
  File "/usr/lib/python2.6/dist-packages/apport/hookutils.py", line 202, in attach_alsa
    report['PciMultimedia'] = pci_devices(PCI_MULTIMEDIA)
  File "/usr/lib/python2.6/dist-packages/apport/hookutils.py", line 354, in pci_devices
    key, value = line.split(':',1)
ValueError: need more than 1 value to unpack

On the report screen:
Lspci:
  Error: command ['lspci', '-vvnn'] failed with exit code 1: pcilib: Cannot open /proc/bus/pci
   lspci: Cannot find any working access method

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

The output from a normal console:

ubuntu@beagle-maverick:~$ lspci -vvnn
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

This patch is just a simple fix the issue by verifying the return string of the command lspci.

The proper fix would probably involve checking correctly the output from command_output, but then depends on how do you want to display the error when it happens.

tags: added: armel
Philip Muškovac (yofel)
tags: added: maverick
Changed in apport (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Philip Muškovac (yofel) wrote :

Setting medium as this only affects arm but does prevent it from reporting linux bugs.

tags: added: patch
tags: added: iso-testing
Steve Langasek (vorlon)
tags: added: arm-porting-queue
Revision history for this message
Marcin Juszkiewicz (hrw) wrote :

hrw@efika:/tmp$ diff -u hookutils.py.orig hookutils.py
--- hookutils.py.orig 2011-03-02 16:06:36.872525099 +0100
+++ hookutils.py 2011-03-02 16:06:26.762526842 +0100
@@ -407,6 +407,11 @@
 def pci_devices(*pci_classes):
     '''Return a text dump of PCI devices attached to the system.'''

+ try:
+ os.stat("/proc/bus/pci")
+ except:
+ return ""
+
     if not pci_classes:
         return command_output(['lspci', '-vvnn'])

This change will work on any PCI-less system (as long as /proc/bus/ interface is present) and does not require to call lspci.

Revision history for this message
Marcin Juszkiewicz (hrw) wrote :

Other option is to check for /sys/bus/pci/

Revision history for this message
Martin Pitt (pitti) wrote :

Slightly different patch pushed to trunk, thanks Marcin!

Changed in apport:
status: New → Fix Released
Changed in apport (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 1.20-0ubuntu1

---------------
apport (1.20-0ubuntu1) natty; urgency=low

  * New upstream release. Changes since our previous snapshot:
    - Add support for -w/--window option which will enable user to select a
      window as a target for filing a problem report. Thanks Abhinav Upadhyay.
      (LP: #357847)
    - Disable the filtering on SIGABRT without assertion messages. Turns out
      that developers want these crash reports after all. (LP: #729223)
    - Add support for a "DuplicateSignature" report fields. This allows
      package hooks to implement custom duplicate problem handling which
      doesn't need to be hardcoded in Apport itself. Update the launchpad
      backend to tag such bugs as "need-duplicate-check".
    - hookutils.py Update WifiSyslog regex to correctly catch application log
      messages in syslog. Thanks Mathieu Trudel-Lapierre. (LP: #732917)
    - hookutils.py, attach_hardware(): Avoid error message if machine does not
      have a PCI bus. Thanks Marcin Juszkiewicz. (LP: #608449)
    - backends/packaging-apt-dpkg.py: Replace deprecated getChanges() call
      with get_changes().
    - apport-gtk: Fix broken dialog heading if the name of the crashed program
      contains an & or other markup specific characters.
    - apport-gtk: Don't crash if GTK cannot be initialized. This usually
      happens without a $DISPLAY or when the session is being shut down. Just
      print an error message. If there are pending crashes, they will be shown
      again the next time a session starts. (LP: #730569)
  * debian/local/apport-chroot: In retracing mode, fix the passed --auth and
    --duplicate-db arguments to be paths within the fakechroot.
  * debian/local/apport-chroot: Apply the same absolute path fix to retracing
    mode that we already applied to login mode in 1.19-0ubuntu1.
 -- Martin Pitt <email address hidden> Fri, 18 Mar 2011 16:39:07 +0100

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
ffa (ffatheranderson) wrote :

Same issue here in 2020.

=======================
➜ fa sudo lspci
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
➜ fa uname -a
Linux retropie 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux
➜ fa whoami
root
➜ fa lspci
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
➜ fa

=======================

On :

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

Other bug subscribers