← Back to team overview

touch-packages team mailing list archive

[Bug 1370259] Re: apport fails to collect nvram specific information

 

Sorry for the late answer, this fell through the cracks. Did you
actually test that this works? I. e. can a normal user actually read
/dev/nvram? Currently the "cat /dev/nvram" is ran as root via
attach_root_command_outputs(), and requiring root was the main reason
why this "cat" approach was taken in the first place.

Does /dev/nvram actually contain text information and is this a
locale/encoding problem? Or is it binary data, and unrelated to
encodings?

With 14.10's apport, instead of cat the hook could call "base64
/dev/nvram" or a similar command which provides plaintext. But otherwise
I think it would be better to fix attach_root_command_outputs() to get
along with binary outputs.

> One dummy question remaining, how getting the tar file from the ascii
output file if we need to ?

You can use "apport-unpack" to decode the apport report file into
individual files (named by keys), and then just use tar to extract them
further.

** Summary changed:

- apport fails to collect nvram specific information
+ apport fails to collect nvram specific information -- attach_root_command_outputs() does not work for binary data

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1370259

Title:
  apport fails to collect nvram specific information --
  attach_root_command_outputs() does not work for binary data

Status in apport package in Ubuntu:
  Triaged

Bug description:
  ---Problem Description---
  apport fails to collect nvram specific information
   
  ---uname output---
  3.16.0-10-generic
   
  Machine Type = POWER8 
    
  ---Steps to Reproduce---
   
  1) Install Ubuntu 14.10 in Power non-virtualized environment.
  2) Install apport package
  3) Run following command to verify if apport collects power specific information.

     apport-cli -f -p linux-generic --save=/home/sachin/linux.apport

  The command fails with following error :

  root@lep8d:/home/sachin# apport-cli -f -p linux-generic
  --save=/home/sachin/linux.apport

  *** Collecting problem information

  The collected information can be sent to the developers to improve the
  application. This might take a few minutes.
  .......tar: Removing leading `/' from member names
  ....ERROR: hook /usr/share/apport/general-hooks/powerpc.py crashed:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport/report.py", line 197, in _run_hook
      symb['add_info'](report, ui)
    File "/usr/share/apport/general-hooks/powerpc.py", line 72, in add_info
      'nvram': 'cat /dev/nvram',
    File "/usr/lib/python3/dist-packages/apport/hookutils.py", line 469, in attach_root_command_outputs
      buf = f.read().strip()
    File "/usr/lib/python3.4/codecs.py", line 313, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
  ...
  root@lep8d:/home/sachin# 
   
  Userspace tool common name: apport 
   
  Following version of apport is installed.

  root@lep8d:/home/sachin# dpkg --list | grep apport
  ii  apport                                                 2.14.7-0ubuntu1                            all          automatically generate crash reports for debugging
  ii  apport-symptoms                                        0.20                                       all          symptom scripts for apport
  ii  python-apport                                          2.14.7-0ubuntu1                            all          Python library for Apport crash report handling
  ii  python3-apport                                         2.14.7-0ubuntu1                            all          Python 3 library for Apport crash report handling
  root@lep8d:/home/sachin#

  Looking at the code we are doing a cat /dev/nvram to the apport output file which doesn't sounds right to me. I would think using the function add_tar() creating a tar file and copying the content as a ascii file at end of apport output file more appropriate.
  One dummy question remaining, how getting the tar file from the ascii output file if we need to ? ( that's also true to validate the content of the DeviceTree tar file).

  Would suggest following patch:
  --- powerpc.py	2014-09-10 10:28:18.824002770 -0400
  +++ powerpc.py.old	2014-09-04 06:33:16.000000000 -0400
  @@ -69,8 +69,8 @@
                   'cpu_runmode': 'ppc64_cpu --run-mode',
                   'cpu_freq': 'ppc64_cpu --frequency',
                   'cpu_dscr': 'ppc64_cpu --dscr',
  +                'nvram': 'cat /dev/nvram',
               })
  -            add_tar(report, '/dev/nvram', 'nvram.tar')
           attach_file_if_exists(report, '/var/log/platform')
   
       if ispSeries and not isPowerKVM:

  thanks
   diff -urN powerpc.py.old powerpc.py 
  --- powerpc.py.old	2014-09-04 06:33:16.000000000 -0400
  +++ powerpc.py	2014-09-10 10:28:18.824002770 -0400
  @@ -69,8 +69,8 @@
                   'cpu_runmode': 'ppc64_cpu --run-mode',
                   'cpu_freq': 'ppc64_cpu --frequency',
                   'cpu_dscr': 'ppc64_cpu --dscr',
  -                'nvram': 'cat /dev/nvram',
               })
  +            add_tar(report, '/dev/nvram', 'nvram.tar')
           attach_file_if_exists(report, '/var/log/platform')
   
       if ispSeries and not isPowerKVM:

  Initial Launchpad bug id #1336462 implemented feature support

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1370259/+subscriptions