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')
def add_info(report, ui): attach_file(report, '/proc/version_signature', 'ProcVersionSignature') attach_file(report, '/proc/cmdline', 'ProcKernelCmdline') sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) report['KernLog'] = recent_kernlog(sec_re) # DBus messages are reported to syslog dbus_sec_re = re.compile('dbus.* apparmor', re.IGNORECASE) report['Syslog'] = recent_syslog(dbus_sec_re) packages = [ 'apparmor', 'apparmor-utils', 'libapparmor1', 'libapparmor-dev', 'libapparmor-perl', 'apparmor-utils', 'apparmor-docs', 'apparmor-profiles', 'apparmor-easyprof', 'python3-apparmor', 'python-apparmor', 'libpam-apparmor', 'libapache2-mod-apparmor', 'python3-libapparmor', 'python-libapparmor', 'auditd', 'libaudit0' ] versions = '' for package in packages: try: version = packaging.get_version(package) except ValueError: version = 'N/A' if version is None: version = 'N/A' versions += '%s %s\n' % (package, version) report['ApparmorPackages'] = versions # These need to be run as root report['ApparmorStatusOutput'] = root_command_output( ['/usr/sbin/apparmor_status']) report['PstreeP'] = command_output(['/usr/bin/pstree', '-p']) attach_file_if_exists(report, '/var/log/audit/audit.log', 'audit.log')
def add_info(report, ui): log_file = '/var/log/upstart/whoopsie.log' attach_file_if_exists(report, log_file, 'WhoopsieLog') reports = glob('/var/crash/*') if reports: report['CrashReports'] = command_output( ['stat', '-c', '%a:%u:%g:%s:%y:%x:%n'] + reports)
def add_info(report, ui): # get info on all files in /var/crash/ reports = glob('/var/crash/*') if reports: report['CrashReports'] = command_output( ['stat', '-c', '%a:%u:%g:%s:%y:%x:%n'] + reports) attach_related_packages(report, ['apport-noui']) # is the system set to autoreport crashes? if os.path.exists('/var/lib/apport/autoreport'): report['Tags'] += ' autoreport-true' else: report['Tags'] += ' autoreport-false' attach_file_if_exists(report, '/var/log/upstart/whoopsie.log')
def add_info(report, ui): response = ui.yesno("The contents of your /etc/ssh/ssh_config file " "may help developers diagnose your bug more " "quickly. However, it may contain sensitive " "information. Do you want to include it in your " "bug report?") if response == None: # user cancelled raise StopIteration elif response: attach_conffiles(report, 'openssh-client') attach_related_packages( report, ['ssh-askpass', 'libpam-ssh', 'keychain', 'ssh-askpass-gnome']) report['SSHClientVersion'] = command_output(['/usr/bin/ssh', '-V'])
def add_info(report): attach_hardware(report) attach_file(report, '/proc/mounts', 'ProcMounts') attach_file_if_exists(report, '/etc/mdadm/mdadm.conf', 'mdadm.conf') attach_file(report, '/proc/mdstat', 'ProcMDstat') attach_file(report, '/proc/partitions', 'ProcPartitions') attach_file(report, '/etc/blkid.tab', 'etc.blkid.tab') attach_file_if_exists(report, '/boot/grub/menu.lst', 'GrubMenu.lst') attach_file_if_exists(report, '/boot/grub/grub.cfg', 'Grub.cfg') attach_file_if_exists(report, '/etc/lilo.conf', 'lilo.conf') devices = glob.glob("/dev/[hs]d*") for dev in devices: report['MDadmExamine' + path_to_key(dev)] = command_output(['/sbin/mdadm', '-E', dev]) initrd_re = re.compile('md[a/]') report['initrd.files'] = get_initrd_files(initrd_re)
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'))
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')
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")