Пример #1
0
def add_info(report):
    attach_hardware(report)

    report['DiskUsage'] = command_output(['df'])
    report['MemoryUsage'] = command_output(['free'])

    if command_available('dmraid'):
        attach_root_command_outputs(report, {
            'DmraidSets': 'dmraid -s',
            'DmraidDevices': 'dmraid -r'
        })
        if command_available('dmsetup'):
            attach_root_command_outputs(
                report, {'DeviceMapperTables': 'dmsetup table'})

    try:
        installer_version = open('/var/log/installer/version')
        for line in installer_version:
            if line.startswith('ubiquity '):
                # File these reports on the ubiquity package instead
                report['SourcePackage'] = 'ubiquity'
                break
        installer_version.close()
    except IOError:
        pass

    add_installation_log(report, 'DIPartman', 'partman')
    add_installation_log(report, 'DISyslog', 'syslog')
def add_info(report):
    attach_hardware(report)

    report['DiskUsage'] = command_output(['df'])
    report['MemoryUsage'] = command_output(['free'])

    if command_available('dmraid'):
        attach_root_command_outputs(report, {'DmraidSets': 'dmraid -s',
                                             'DmraidDevices': 'dmraid -r'})
        if command_available('dmsetup'):
            attach_root_command_outputs(report, {'DeviceMapperTables': 'dmsetup table'})

    try:
        installer_version = open('/var/log/installer/version')
        for line in installer_version:
            if line.startswith('ubiquity '):
                # File these reports on the ubiquity package instead
                report['SourcePackage'] = 'ubiquity'
                break
        installer_version.close()
    except IOError:
        pass

    add_installation_log(report, 'DIPartman', 'partman')
    add_installation_log(report, 'DISyslog', 'syslog')
Пример #3
0
def add_info(report, ui):

    problem_type = report.get("ProblemType", None)
    if problem_type == "Bug":
        response = ui.yesno("Is the issue you are reporting one you \
encountered when upgrading Ubuntu from one release to another?")
    else:
        response = None
    if response:
        os.execlp('apport-bug', 'apport-bug', 'ubuntu-release-upgrader')
    else:
        attach_gsettings_package(report, 'update-manager')
        attach_file_if_exists(report, '/var/log/apt/history.log',
                              'DpkgHistoryLog.txt')
        attach_file_if_exists(report, '/var/log/apt/term.log',
                              'DpkgTerminalLog.txt')
        attach_root_command_outputs(
            report, {
                'CurrentDmesg.txt':
                'dmesg | comm -13 --nocheck-order /var/log/dmesg -'
            })
        if command_available('hwe-support-status'):
            # not using apport's command_output because it doesn't expect a
            # return code of 10
            unsupported = run_hwe_command('--show-all-unsupported')
            if unsupported:
                report['HWEunsupported'] = unsupported
                report['HWEreplacements'] = \
                    run_hwe_command('--show-replacements')
        report["Aptdaemon"] = recent_syslog(re.compile("AptDaemon"))
Пример #4
0
def add_info(report, ui):
    efiboot = '/boot/efi/EFI/ubuntu'
    if command_available('efibootmgr'):
        report['EFIBootMgr'] = command_output(['efibootmgr', '-v'])
    else:
        report['EFIBootMgr'] = 'efibootmgr not available'
    commands = {}
    try:
        directory = os.stat(efiboot)
    except OSError as e:
        if e.errno == errno.ENOENT:
            report['Missing'] = '/boot/efi/EFI/ubuntu directory is missing'
            return
        if e.errno == errno.EACCES:
            directory = True
    if directory:
        arch = report['Architecture']
        commands['BootEFIContents'] = 'ls %s' % efiboot
        commands[
            'ShimDiff'] = 'diff %s/shim%s.efi /usr/lib/shim/shim%s.efi.signed' % (
                efiboot, efiarch[arch], efiarch[arch])
        commands[
            'GrubDiff'] = 'diff %s/grub%s.efi /usr/lib/grub/%s-efi-signed/grub%s.efi.signed' % (
                efiboot, efiarch[arch], grubarch[arch], efiarch[arch])

    efivars_dir = '/sys/firmware/efi/efivars'
    sb_var = os.path.join(efivars_dir,
                          'SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c')
    mok_var = os.path.join(
        efivars_dir, 'MokSBStateRT-605dab50-e046-4300-abb6-3dd810dd8b23')

    attach_file(report, '/proc/sys/kernel/moksbstate_disabled')
    commands['SecureBoot'] = 'od -An -t u1 %s' % sb_var
    commands['MokSBStateRT'] = 'od -An -t u1 %s' % mok_var
    attach_root_command_outputs(report, commands)
    report['EFITables'] = recent_syslog(re.compile(r'(efi|esrt):|Secure boot'))
Пример #5
0
def add_info(report, ui):
    arch = platform.machine()
    if arch not in ['ppc64', 'ppc64le']:
        return

    is_kernel = report['ProblemType'].startswith(
        'Kernel') or 'linux' in report.get('Package')

    try:
        with open('/proc/cpuinfo', 'r') as fp:
            contents = fp.read()
            ispSeries = 'pSeries' in contents
            isPowerNV = 'PowerNV' in contents
            isPowerKVM = 'emulated by qemu' in contents
    except IOError:
        ispSeries = False
        isPowerNV = False
        isPowerKVM = False

    if ispSeries or isPowerNV:
        if is_kernel:
            add_tar(report, '/proc/device-tree/', 'DeviceTree.tar')
        attach_file(report, '/proc/misc', 'ProcMisc')
        attach_file(report, '/proc/locks', 'ProcLocks')
        attach_file(report, '/proc/loadavg', 'ProcLoadAvg')
        attach_file(report, '/proc/swaps', 'ProcSwaps')
        attach_file(report, '/proc/version', 'ProcVersion')
        report['cpu_smt'] = command_output(['ppc64_cpu', '--smt'])
        report['cpu_cores'] = command_output(['ppc64_cpu', '--cores-present'])
        report['cpu_coreson'] = command_output(['ppc64_cpu', '--cores-on'])
        # To be executed as root
        if is_kernel:
            attach_root_command_outputs(
                report, {
                    'cpu_runmode': 'ppc64_cpu --run-mode',
                    'cpu_freq': 'ppc64_cpu --frequency',
                    'cpu_dscr': 'ppc64_cpu --dscr',
                    'nvram': 'cat /dev/nvram',
                })
        attach_file_if_exists(report, '/var/log/platform')

    if ispSeries and not isPowerKVM:
        attach_file(report, '/proc/ppc64/lparcfg', 'ProcLparCfg')
        attach_file(report, '/proc/ppc64/eeh', 'ProcEeh')
        attach_file(report, '/proc/ppc64/systemcfg', 'ProcSystemCfg')
        report['lscfg_vp'] = command_output(['lscfg', '-vp'])
        report['lsmcode'] = command_output(['lsmcode', '-A'])
        report['bootlist'] = command_output(['bootlist', '-m', 'both', '-r'])
        report['lparstat'] = command_output(['lparstat', '-i'])
        if command_available('lsvpd'):
            report['lsvpd'] = command_output(['lsvpd', '--debug'])
        if command_available('lsvio'):
            report['lsvio'] = command_output(['lsvio', '-des'])
        if command_available('servicelog'):
            report['servicelog_dump'] = command_output(
                ['servicelog', '--dump'])
        if command_available('servicelog_notify'):
            report['servicelo_list'] = command_output(
                ['servicelog_notify', '--list'])
        if command_available('usysattn'):
            report['usysattn'] = command_output(['usysattn'])
        if command_available('usysident'):
            report['usysident'] = command_output(['usysident'])
        if command_available('serv_config'):
            report['serv_config'] = command_output(['serv_config', '-l'])

    if isPowerNV:
        add_tar(report, '/proc/ppc64/', 'ProcPpc64.tar')
Пример #6
0
def add_info(report, ui):
    arch = platform.machine()
    if arch not in ["ppc64", "ppc64le"]:
        return

    is_kernel = report["ProblemType"].startswith("Kernel") or "linux" in report.get("Package")

    try:
        with open("/proc/cpuinfo", "r") as fp:
            contents = fp.read()
            ispSeries = "pSeries" in contents
            isPowerNV = "PowerNV" in contents
            isPowerKVM = "emulated by qemu" in contents
    except IOError:
        ispSeries = False
        isPowerNV = False
        isPowerKVM = False

    if ispSeries or isPowerNV:
        if is_kernel:
            add_tar(report, "/proc/device-tree/", "DeviceTree.tar")
        attach_file(report, "/proc/misc", "ProcMisc")
        attach_file(report, "/proc/locks", "ProcLocks")
        attach_file(report, "/proc/loadavg", "ProcLoadAvg")
        attach_file(report, "/proc/swaps", "ProcSwaps")
        attach_file(report, "/proc/version", "ProcVersion")
        report["cpu_smt"] = command_output(["ppc64_cpu", "--smt"])
        report["cpu_cores"] = command_output(["ppc64_cpu", "--cores-present"])
        report["cpu_coreson"] = command_output(["ppc64_cpu", "--cores-on"])
        # To be executed as root
        if is_kernel:
            attach_root_command_outputs(
                report,
                {
                    "cpu_runmode": "ppc64_cpu --run-mode",
                    "cpu_freq": "ppc64_cpu --frequency",
                    "cpu_dscr": "ppc64_cpu --dscr",
                    "nvram": "cat /dev/nvram",
                },
            )
        attach_file_if_exists(report, "/var/log/platform")

    if ispSeries and not isPowerKVM:
        attach_file(report, "/proc/ppc64/lparcfg", "ProcLparCfg")
        attach_file(report, "/proc/ppc64/eeh", "ProcEeh")
        attach_file(report, "/proc/ppc64/systemcfg", "ProcSystemCfg")
        report["lscfg_vp"] = command_output(["lscfg", "-vp"])
        report["lsmcode"] = command_output(["lsmcode", "-A"])
        report["bootlist"] = command_output(["bootlist", "-m", "both", "-r"])
        report["lparstat"] = command_output(["lparstat", "-i"])
        if command_available("lsvpd"):
            report["lsvpd"] = command_output(["lsvpd", "--debug"])
        if command_available("lsvio"):
            report["lsvio"] = command_output(["lsvio", "-des"])
        if command_available("servicelog"):
            report["servicelog_dump"] = command_output(["servicelog", "--dump"])
        if command_available("servicelog_notify"):
            report["servicelo_list"] = command_output(["servicelog_notify", "--list"])
        if command_available("usysattn"):
            report["usysattn"] = command_output(["usysattn"])
        if command_available("usysident"):
            report["usysident"] = command_output(["usysident"])
        if command_available("serv_config"):
            report["serv_config"] = command_output(["serv_config", "-l"])

    if isPowerNV:
        add_tar(report, "/proc/ppc64/", "ProcPpc64.tar")