trunk/0000775000000000000000000000000013644166262007123 5ustar trunk/COPYING0000664000000000000000000004310313423635127010153 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. trunk/Makefile0000664000000000000000000000027313423635127010561 0ustar default: @echo Nothing to do install: install -d $(DESTDIR)/usr/share/apport/symptoms install -m 644 symptoms/*.py $(DESTDIR)/usr/share/apport/symptoms .PHONY: default install clean trunk/README0000664000000000000000000000157613423635127010010 0ustar Apport symptom scripts ====================== In some cases it is quite hard for a bug reporter to figure out which package to file a bug against, especially for functionality which spans multiple packages. For example, sound problems are divided between the kernel, alsa, pulseaudio, and gstreamer. Apport supports an extension of the notion of package hooks to do an interactive "symptom based" bug reporting. Calling the UI with just "-f" and not specifying any packae name shows the available symptoms, the user selects the matching category, and the symptom scripts can do some question & answer game to finally figure out which package to file it against and which information to collect. Alternatively, the UIs can be invoked with "-s symptom-name". This package contains all the Apport symptoms used in Ubuntu. Please see /usr/share/doc/apport/symptoms.txt for further information. trunk/debian/0000775000000000000000000000000013645167211010341 5ustar trunk/debian/apport-symptoms.links0000664000000000000000000000043013645167175014607 0ustar /usr/share/apport/symptoms/ubuntu-release-upgrader.py /usr/share/apport/symptoms/dist-upgrade.py /usr/share/apport/symptoms/ubuntu-release-upgrader.py /usr/share/apport/symptoms/release-upgrade.py /usr/share/apport/symptoms/installer.py /usr/share/apport/symptoms/installation.py trunk/debian/changelog0000664000000000000000000001305013645167211012212 0ustar apport-symptoms (0.23) focal; urgency=medium * Add in a symptom for the installer. (LP: #1868161) -- Brian Murray Mon, 13 Apr 2020 15:58:17 -0700 apport-symptoms (0.22) eoan; urgency=medium * symptoms/storage.py: don't crash if udisks2 package is not available. (LP: #1789516) -- Brian Murray Fri, 17 May 2019 14:32:49 -0700 apport-symptoms (0.21) disco; urgency=medium * symptoms/storage.py: Fix the binary name for gnome-session and since its greater than 15 characters use -f with pgrep. (LP: #1813428) -- Brian Murray Mon, 28 Jan 2019 09:40:15 -0800 apport-symptoms (0.20) saucy; urgency=low * Add in an symptom for ubuntu-release-upgrader, and aliases for it that just return the binary package. (LP: #1173913) -- Brian Murray Wed, 22 May 2013 15:03:40 -0700 apport-symptoms (0.19) quantal; urgency=low * symptoms/_audio_checks.py: Dot not try to call nonexisting set_title() function. (LP: #1023949) -- Martin Pitt Fri, 31 Aug 2012 11:37:51 +0200 apport-symptoms (0.18) quantal; urgency=low * symptoms/audio.py: Ensure we use integer array indexes when dividing. (LP: #1022580) -- Martin Pitt Thu, 12 Jul 2012 06:59:39 +0200 apport-symptoms (0.17) quantal; urgency=low * symptoms/_audio_data.py: Fix syntax to be Python 3 compatible. (LP: #1013171) * symptoms/storage.py: Fix decoding of stdout/err in subprocesses. * symptoms/storage.py: Move to udisks2. * debian/copyright: Move to copyright format 1.0. * debian/control: Bump Standards-Version to 3.9.3. * debian/control: Move ${misc:Depends} to Depends. -- Martin Pitt Fri, 15 Jun 2012 09:44:18 +0200 apport-symptoms (0.16) oneiric; urgency=low [ David Henningson ] * symptoms/_audio_data.py: Fix crash when bluetooth headset is connected (LP: #827591) -- Martin Pitt Thu, 25 Aug 2011 10:29:50 +0200 apport-symptoms (0.15) oneiric; urgency=low [ David Henningson ] * symptoms/_audio_data.py: As of PulseAudio 0.99, the "pactl stat" has changed name to "pactl info". -- Martin Pitt Tue, 16 Aug 2011 14:58:50 +0200 apport-symptoms (0.14) oneiric; urgency=low * symptoms/_audio_data.py: Fix crash when pulseaudio does not detect any errors. Thanks to David Henningsson! (LP: #776270) -- Martin Pitt Mon, 04 Jul 2011 15:05:44 +0200 apport-symptoms (0.13) oneiric; urgency=low * symptoms/audio.py: Add missing "report" argument to pa_finish_logging() calls. (LP: #779209) -- Martin Pitt Mon, 06 Jun 2011 08:48:04 +0200 apport-symptoms (0.12) natty; urgency=low [ David Henningson ] * audio.py: - Audio: fix crash when selecting "Internal Speaker" - Fall back to ALSA if PulseAudio is not installed (LP: #733112) - Rename Sound_symptom to Symptom_type for cosmetic reasons. -- Martin Pitt Wed, 23 Mar 2011 16:52:09 +0100 apport-symptoms (0.11) natty; urgency=low [ David Henningsson ] * audio.py: Split into some helper modules, and greatly improve. -- Martin Pitt Mon, 07 Feb 2011 12:15:40 +0100 apport-symptoms (0.10) natty; urgency=low * audio.py: Resolves syntax confusion in audio test (LP: #678371) -- Weston Miller Tue, 23 Nov 2010 09:45:08 +0100 apport-symptoms (0.9) lucid; urgency=low * storage.py: Move from devicekit-disks to udisks. * storage.py: If gvfs-mount is available, add gvfs monitor log. -- Martin Pitt Wed, 10 Mar 2010 15:18:13 +0100 apport-symptoms (0.8) lucid; urgency=low [ Daniel T Chen ] * audio.py: - Add additional stereo playback elements to check for mute status - Add check for jackd [ Marc Deslauriers ] * security.py: add a new "security" symptom. -- Marc Deslauriers Thu, 18 Feb 2010 13:59:00 +0100 apport-symptoms (0.7) lucid; urgency=low * audio.py: Set default bug titles which include the card/codec name and symptom, for easier duplicate bug matching. Thanks David Henningsson! -- Martin Pitt Mon, 08 Feb 2010 11:52:39 +0100 apport-symptoms (0.6) lucid; urgency=low * audio.py: Call subprocesses with LC_MESSAGES=C to fix the symptom for non-English locales. -- Martin Pitt Sat, 23 Jan 2010 13:13:44 +0100 apport-symptoms (0.5) lucid; urgency=low * storage.py: Improve symptom description. * storage.py: Set default bug titles. (UbuntuSpec:desktop-lucid-bug-management) * storage.py: When reporting "Other problem", do not show error message about not being able to determine the package. -- Martin Pitt Wed, 20 Jan 2010 15:33:30 +0100 apport-symptoms (0.4) lucid; urgency=low * Include first version of David Henningsson's "audio" symptom. Thanks! -- Martin Pitt Wed, 20 Jan 2010 14:47:33 +0100 apport-symptoms (0.3) lucid; urgency=low [ Martin Pitt ] * Add README. * display.py: Fix comparison of choice. [ Bryce Harrington ] * Add display symptom for X.org problems. -- Martin Pitt Tue, 03 Nov 2009 20:47:19 +0100 apport-symptoms (0.2) karmic; urgency=low * storage.py: Add description. -- Martin Pitt Wed, 05 Aug 2009 18:40:48 +0100 apport-symptoms (0.1) karmic; urgency=low * Initial release. -- Martin Pitt Wed, 05 Aug 2009 10:42:55 +0100 trunk/debian/compat0000664000000000000000000000000213423635127011537 0ustar 7 trunk/debian/control0000664000000000000000000000166413423635127011753 0ustar Source: apport-symptoms Section: utils Priority: optional Build-Depends: debhelper (>= 7) Maintainer: Ubuntu Developers Standards-Version: 3.9.3 Vcs-Bzr: https://code.launchpad.net/~ubuntu-dev/apport/apport-symptoms Homepage: https://wiki.ubuntu.com/Apport Package: apport-symptoms Architecture: all Depends: ${misc:Depends} Recommends: apport Description: symptom scripts for apport Apport intercepts program crashes, collects debugging information about the crash and the operating system environment, and sends it to bug trackers in a standardized form. It also offers the user to report a bug about a package, with again collecting as much information about it as possible. . This package extends Apport by some "symptom" scripts, so that bug reporters do not have to guess the correct package, but report problems based on symptoms that they have (like "sound problem"), through an interactive process. trunk/debian/copyright0000664000000000000000000000065513423635127012302 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: apport-symptoms Upstream-Contact: Ubuntu Developers Source: https://code.launchpad.net/~ubuntu-dev/apport/apport-symptoms Files: * Copyright: Copyright (C) 2009 - 2012 Canonical Ltd. License: GPL-2+ The full text of the GPL is distributed as in /usr/share/common-licenses/GPL-2 on Debian systems. trunk/debian/rules0000775000000000000000000000003613423635127011420 0ustar #!/usr/bin/make -f %: dh $@ trunk/symptoms/0000775000000000000000000000000013645166643011022 5ustar trunk/symptoms/_audio_checks.py0000664000000000000000000002000113423635127014135 0ustar # Sound/audio related problem troubleshooter/triager # Written by David Henningsson 2011, david.henningsson@canonical.com # Copyright Canonical Ltd 2011 # License: BSD (see /usr/share/common-licenses/BSD ) import apport from apport.hookutils import * from _audio_mixercontrol import * from _audio_data import * def check_audio_users(report, ui): a = get_users_in_group('audio') report['Symptom_AudioUsers'] = ', '.join(a) try: a.remove('pulse') except: pass if len(a) > 0: yn = ui.yesno('The following users or programs can access the sound card ' 'exclusively, and even when not logged in:\n\n%s\n\n' 'This can cause problems even for other users.\n' 'You can fix this by uninstalling the relevant programs or by ' 'unchecking the "Use Audio Devices" checkbox for the user ' 'in the "users and groups" dialog. Do you want to continue troubleshooting?' % ', '.join(a)) if not yn: raise StopIteration def check_volumes(report, ui, card, isOutput, jack, maxdb=None): try: aname = 'hw:'+card.alsa_shortname except: return # this is a PA card only, can't check alsa stuff if jack is None: controlnames = card.get_controlnames(isOutput) else: controlnames = jack.get_controlnames() levels = set() mcl = MixerControlList(aname, report) for c in mcl.controls: cname = c.get_pretty_name() if not cname in controlnames: continue for p in c.pchans: if ('muted' in c.pchans[p]) and c.pchans[p]['muted']: levels.add(cname + ' is muted\n') if ('percent' in c.pchans[p]) and c.pchans[p]['percent'] < 70: levels.add(cname + ' is at {0}%\n'.format(c.pchans[p]['percent'])) if (maxdb is not None) and ('dB' in c.pchans[p]) and (c.pchans[p]['dB'] > maxdb): levels.add(cname + ' is at {0} dB\n'.format(c.pchans[p]['dB'])) if len(levels) > 0: if not ui.yesno('The following mixer control(s) might be incorrectly set: \n' + '\n'.join(levels) + 'Please try to fix that (e g by running \n"alsamixer -D ' + aname + '" in a terminal) and see if that solves the problem.\n' 'Would you like to continue troubleshooting anyway?\n'): raise StopIteration return def check_pulseaudio_running(report, ui): ''' Possible outcomes: None if pulseaudio is running, pulseaudio if installed but not running, or alsa-base if pulseaudio is not installed. ''' if subprocess.call(['pgrep', '-u', str(os.getuid()), '-x', 'pulseaudio']) == 0: return None if subprocess.call(['pgrep', '-u', 'pulse', '-x', 'pulseaudio']) == 0: ui.information('PulseAudio is running as a system-wide daemon.\n' 'This mode of operation is not supported by Ubuntu.\n' 'If this is not intentional, ask for help on answers.launchpad.net.') raise StopIteration try: if apport.packaging.get_version('pulseaudio'): if ui.yesno('PulseAudio seems to have crashed. ' 'Do you wish to report a bug?'): return 'pulseaudio' raise StopIteration except ValueError: pass # PulseAudio is not installed, so fall back to ALSA return 'alsa-base' def check_pulseaudio_profile(report, ui, card, isOutput, jack): ''' Returns package, channelmap ''' # ensure card was detected by PA if not 'pa_card' in card.__dict__: report['Title'] = get_hw_title(card, isOutput, jack, "Pulseaudio fails to detect card") return 'pulseaudio', None ssname, ssprofile, channelcount = get_pa_default_profile(isOutput) if not card.has_sink_or_source(ssname): if not ui.yesno("You don't seem to have configured PulseAudio to use " 'the card you want %s from (%s).\n You can fix ' 'that using pavucontrol or the GNOME volume control. ' 'Continue anyway?' % ("output" if isOutput else "input", card.pretty_name())): raise StopIteration if isOutput and (jack is not None) and (channelcount < jack.needed_channelcount()): if not ui.yesno("You don't seem to have configured PulseAudio " 'for surround output (%s).\n You can fix that using pavucontrol ' 'or the GNOME volume control. Continue anyway?' % ssprofile): raise StopIteration return None, channelcount def check_playback(report, ui, device_name, channelcount): ''' Returns package if it successfully finds one. ''' ui.information('Next, a speaker test will be performed. For your safety,\n' 'if you have headphones on, take them off to avoid damaging your ears.\n' 'Close this dialog to hear the test tone. It should alternate between %d channels.' % channelcount) run_subprocess(report, 'Symptom_AlsaPlaybackTest', ['pasuspender', '--', 'speaker-test', '-l', '3', '-c', str(channelcount), '-b', '100000', '-D', device_name, '-t', 'sine']) result = ui.yesno('Were the test tones played back correctly?') report['Symptom_AlsaPlaybackTest'] = "ALSA playback test through %s %s" % (device_name, 'successful' if result else 'failed') if not result: return 'alsa-base' ui.information('Close this dialog to hear the second test tone. It should alternate between channels.') run_subprocess(report, 'Symptom_SpeakerTestPulse', ['speaker-test', '-l', '3', '-c', str(channelcount), '-b', '100000', '-D', 'pulse', '-t', 'sine']) result = ui.yesno('Were the test tones played back correctly?') report['Symptom_PulsePlaybackTest'] = 'PulseAudio playback test %s' % ('successful' if result else 'failed') if not result: return 'pulseaudio' return None def check_recording(report, ui, device_name, channelcount, tmpfile): ui.information('Next, up to two recording tests will be performed. Close this dialog to \n' 'start recording some sounds. After some seconds, the recorded sound should be \n' 'played back to you through the default sound output.') if os.path.exists(tmpfile): run_subprocess(report, 'Symptom_RemoveRecording', ['rm', tmpfile]) run_subprocess(report, 'Symptom_AlsaRecordingTest', ['pasuspender', '--', 'arecord', '-q', '-f', 'cd', '-d', '7', '-D', device_name, tmpfile]) run_subprocess(report, 'Symptom_AlsaRecordingPlayback', ['paplay', tmpfile]) result = ui.yesno('Was the sound recorded correctly?') report['Symptom_AlsaRecordingTest'] = "ALSA recording test through %s %s" % (device_name, 'successful' if result else 'failed') if not result: return 'alsa-base' ui.information('Close this dialog to record some sounds for the second test.\n' 'After some seconds, the recorded sound should be \n' 'played back to you through the default sound output.') run_subprocess(report, 'Symptom_RemoveRecording', ['rm', tmpfile]) run_subprocess(report, 'Symptom_PulseAudioRecordingTest', [ 'arecord', '-q', '-f', 'cd', '-d', '7', '-D', 'pulse', tmpfile]) run_subprocess(report, 'Symptom_PulseAudioRecordingPlayback', ['paplay', tmpfile]) result = ui.yesno('Was the sound recorded correctly?') report['Symptom_PulseAudioRecordingTest'] = "PulseAudio recording test through %s %s" % (device_name, 'successful' if result else 'failed') if not result: return 'pulseaudio' return None def check_devices_in_use(report, ui): report['Symptom_DevicesInUse'] = root_command_output(['fuser','-v'] + glob.glob('/dev/snd/*')) def check_test_tones(report, ui, card, isOutput, jack): channelcount = 2 if jack is not None: channelcount = jack.needed_channelcount()+1 try: aname = 'plughw:' + card.alsa_shortname except: return 'pulseaudio' if isOutput: return check_playback(report, ui, aname, channelcount) else: return check_recording(report, ui, aname, channelcount, '/tmp/audio_symptom_test.wav') trunk/symptoms/_audio_data.py0000664000000000000000000002304713423635127013623 0ustar # Written by David Henningsson # Copyright Canonical Ltd 2011. # Licensed under GPLv3. import re import os import subprocess from apport.hookutils import * class SoundCard: def init_alsa(self, index, name, longname): self.alsa_index = index self.alsa_shortname = name self.alsa_longname = longname self.jacks = parse_jacks(index) def init_pa(self, pactl_card): self.pa_card = pactl_card self.pa_properties = pactl_card['Properties'] self.pa_longname = self.pa_properties['device.description'] if not 'jacks' in self.__dict__: self.jacks = [] def pretty_name(self): try: return '%s - %s' % (self.pa_longname, self.pa_properties['alsa.card_name']) except: if not 'pa_longname' in self.__dict__: return self.alsa_longname return self.pa_longname def has_sink_or_source(self, ssname): # TODO: Check that this works for bluetooth as well, # and/or implement something more sophisticated try: a, b, ssname = ssname.partition(".") return self.pa_card['Name'].find(ssname) != -1 except: return False def get_controlnames(self, isOutput): if isOutput: return set(["PCM", "Hardware Master", "Master", "Master Front", "Front"]) else: return set(["Capture"]) def get_codecinfo(self): try: s = "" for codecpath in glob.glob('/proc/asound/card%s/codec*' % self.alsa_index): if os.path.isfile(codecpath): s = s + read_file(codecpath) return s except: return "" class Jack: def isOutput(self): if self.jack_type.find("Out") != -1: return True if self.jack_type == "Speaker": return True return False def needed_channelcount(self): if self.jack_type == "Line Out": try: colormap = {'Orange': 3, 'Black': 5, 'Grey': 7} return colormap[self.color] except: pass return 1 def get_controlnames(self): if self.isOutput(): # Do not localize c = set(["PCM", "Hardware Master", "Master", "Master Front", "Front"]) if self.jack_type == "Speaker": c |= set(["Speaker", "Desktop Speaker"]) nc = self.needed_channelcount() if nc >= 3: c |= set(["Center", "LFE", "Surround"]) if nc >= 7: c.add("Side") else: c = set(["Capture", self.jack_type]) if self.jack_type.find("Mic"): c.add(self.jack_type+" Boost") return c def pretty_name(self): # Hmm, this is not going to be easy to localize. jack_type = self.jack_type if jack_type == 'HP Out': jack_type = 'Headphone Out' color = self.color if (color != 'Unknown'): jack_type = '%s %s' % (color, jack_type) if self.jack_conns == 'Fixed': return '%s, Internal' % jack_type if self.connectivity == 'Sep': return '%s, %s, Docking station' % (jack_type, self.location) return '%s, %s' % (jack_type, self.location) def parse_jacks(alsa_card_index): ''' Returns list of jacks on a specific card. ''' result = [] dirname = '/proc/asound/card%d' % int(alsa_card_index) for fname in os.listdir(dirname): if not fname.startswith('codec#'): continue codecname = '' for line in open(os.path.join(dirname,fname)): m = re.search('Codec: (.*)', line) if m: codecname = m.groups(1)[0] m = re.search('Pin Default 0x(.*?): \[(.*?)\] (.*?) at (.*?) (.*)', line) if m: item = Jack() item.codecname = codecname item.hex_value = m.groups(1)[0] item.jack_conns = m.groups(1)[1] item.jack_type = m.groups(1)[2] item.connectivity = m.groups(1)[3] item.location = m.groups(1)[4] if not item.jack_conns == 'N/A': result.append(item) continue m = re.search('Conn = (.*?), Color = (.*)', line) if m: item.connection = m.groups(1)[0] item.color = m.groups(1)[1] return result def parse_alsa_cards(): ''' Returns list of SoundCard as seen by alsa ''' # Parse /proc/asound/cards alsacards = [] try: for card in open('/proc/asound/cards'): m = re.search(' (\d+) \[(\w+)\s*\]: (.+)', card) if not m is None: s = SoundCard() s.init_alsa(*tuple(m.groups(1))) alsacards.append(s) except: pass return alsacards def parse_pactl_list(pactlvalues): ''' Returns a structured version of pactl list ''' # Not perfect, but good enough for its purpose result = dict() for line in pactlvalues.splitlines(): m = re.match('^(\w+) #(\d+)', line) if m: category = m.groups(1)[0] index = int(m.groups(1)[1]) if not category in result: result[category] = dict() curitem = dict() result[category][index] = curitem continue m = re.match('^\t(\w+.*?): (.*)', line) if m: curname = m.groups(1)[0] curvalue = m.groups(1)[1] curitem[curname] = curvalue continue m = re.match('^\t(\w+.*?):', line) if m: curname = m.groups(1)[0] curitem[curname] = dict() continue m = re.match('^\t\t(\w+.*?) = "(.*)"', line) if m: curpropname = m.groups(1)[0] curpropvalue = m.groups(1)[1] curitem[curname][curpropname] = curpropvalue return result def add_pa_cards(cards, pactlvalues): if not 'Card' in pactlvalues: return cards for pa_card in pactlvalues['Card'].values(): s = None try: index = pa_card['Properties']['alsa.card'] for c in cards: if index == c.alsa_index: s = c except: pass if not s: s = SoundCard() cards.append(s) s.init_pa(pa_card) return cards def get_pa_default_profile(isOutput): ''' Returns sinkname,sinkprofile,channelcount ''' pactlstat = command_output(['pactl', 'info']) ss = "Default %s: (.*)" % ("Sink" if isOutput else "Source") for line in pactlstat.splitlines(): m = re.match(ss, line) if m: sink = m.groups(1)[0] sinkname, dummy, sinkprofile = sink.rpartition(".") if dummy == '': sinkname = sinkprofile sinkprofile = "analog-stereo" # easy processing later continue # TODO: handle missing sinkname/sinkprofile match? # calculate channel count a = sinkprofile.split('-') cc = 2 if 'mono' in a: cc = 1 elif 'surround' in a: try: # e g surround-51 => 51 => 5+1 => 6 cc = int(a[len(a)-1]) cc = cc/10 + cc % 10 except: cc = 2 return sinkname, sinkprofile, cc def get_hw_title(card, isOutput, jack, text): a = [] if jack is not None: # Get motherboard/system name try: f = open("/sys/class/dmi/id/product_name") a.append(''.join(f.readlines()).strip()) except: pass a.append(jack.codecname) a.append(jack.pretty_name()) else: try: a.append(card.alsa_longname) except: a.append(card.pretty_name()) a.append("playback" if isOutput else "recording") return "[%s] %s" % (', '.join(a), text) def get_users_in_group(groupname): match = "%s:(.*?):(.*?):(.*)" % groupname for line in open("/etc/group"): m = re.match(match, line) if not m: continue s = m.groups(1)[2] return s.split(',') # group does not exist return [] def pa_start_logging(): command_output(['pacmd','set-log-level','4']) command_output(['pacmd','set-log-time','1']) def pa_finish_logging(report): command_output(['pacmd','set-log-level','1']) command_output(['pacmd','set-log-time','0']) s = recent_syslog(re.compile("pulseaudio")) report['Symptom_PulseAudioLog'] = s return s def run_subprocess(report, reportkey, args): ''' Helper function to run a subprocess. Returns stdout and writes stderr, if any, to the report. ''' # avoid localized strings env = os.environ env['LC_MESSAGES'] = 'C' sub_mon = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, universal_newlines=True) sub_out, sub_err = sub_mon.communicate() if sub_err is not None and (len(str(sub_err).strip()) > 0): report[reportkey+'Stderr'] = ' '.join(sub_err) return sub_out def parse_cards(): cards = parse_alsa_cards() pactlvalues = run_subprocess(dict(), 'PactlList', ['pactl', 'list']) pactl_parsed = parse_pactl_list(pactlvalues) cards = add_pa_cards(cards, pactl_parsed) return cards '''test Main''' if __name__ == '__main__': cards = parse_cards() for c in cards: print(c.pretty_name()) for j in c.jacks: print(j.pretty_name()) trunk/symptoms/_audio_mixercontrol.py0000664000000000000000000000753313423635127015441 0ustar # Written by David Henningsson # Copyright Canonical Ltd 2010. # Licensed under GPLv3. from _audio_data import run_subprocess import re class MixerControl: ''' A simple mixer control ''' def parse_amixer(self, amixer_data): self.name = amixer_data[0][len("Simple mixer control "):] self.amixer_dict = {} for line in amixer_data: s = line.split(":") if (len(s) != 2): continue self.amixer_dict[s[0].strip()] = s[1].strip() self.caps = set(self.amixer_dict['Capabilities'].split(" ")) if not 'Playback channels' in self.amixer_dict: pchan_set = set() else: pchan_set = set(self.amixer_dict['Playback channels'].split(" - ")) self.has_dB = True self.pchans = {} for c in pchan_set: self.pchans[c] = {} s = self.amixer_dict[c] m = re.search("\[([\-0-9.]+)dB\]", s) if m is None: self.has_dB = False else: self.pchans[c]['dB'] = float(m.group(1)) if re.search("\[on\]", s): self.pchans[c]['muted'] = False if re.search("\[off\]", s): self.pchans[c]['muted'] = True m = re.search(" ?(\d+) ", s) if m is not None: self.pchans[c]['value'] = int(m.group(1)) m = re.search("\[([\-0-9.]+)%\]", s) if m is not None: self.pchans[c]['percent'] = float(m.group(1)) def __init__(self, amixer_data, device_name): self.device_name = device_name self.parse_amixer(amixer_data) def get_pretty_name(self): s = self.name.split("'") t = int(s[2].split(",")[1]) s = s[1] if (t > 0): return s + " " + str(t) return s def get_caps(self): return self.caps def do_get(self): s = run_subprocess(("amixer", "-D", self.device_name, "sget", self.name)) self.parse_amixer(s.splitlines()) def do_set(self, *args): run_subprocess(("amixer", "-D", self.device_name, "--", "sset", self.name) + args) def get_pstate(self): self.do_get() return self.pchans def set_dB(self, level): s = '{0:.4f}dB'.format(level) if ("pswitch" in self.caps) or ("pswitch-joined" in self.caps): self.do_set(s, "unmute") else: self.do_set(s) def set_mute(self, is_muted): if is_muted: self.do_set("mute") else: self.do_set("unmute") def set_original(self): for (k,v) in self.pchans.iteritems(): t = [] # t = [k] didn't work if 'value' in v: t.append(str(v['value'])) if 'muted' in v: t.append("mute" if v['muted'] else "unmute") if len(t) <= 0: return self.do_set(*t) class MixerControlList: def __init__(self, device_name, report): self.device_name = device_name self.parse_amixer(report) def parse_amixer(self, report): r = run_subprocess(report, "Symptom_amixer", ["amixer", "-D", self.device_name, "scontents"]) self.controls = [] s = [] for line in r.splitlines(): if (s != []) and (not line.startswith(" ")): self.controls.append(MixerControl(s, self.device_name)) s = [] s.append(line) if (s != []): self.controls.append(MixerControl(s, self.device_name)) def get_control_cap(self, cap_list): result = [] for c in self.controls: if len(c.get_caps().intersection(set(cap_list))) > 0: result.append(c) return result def restore_all(self): for c in self.controls: c.set_original() trunk/symptoms/audio.py0000664000000000000000000001770313423635127012475 0ustar # Sound/audio related problem troubleshooter/triager # Written by David Henningsson 2010, david.henningsson@canonical.com # Copyright Canonical Ltd 2010 # License: BSD (see /usr/share/common-licenses/BSD ) description = 'Sound/audio related problems' import apport from apport.hookutils import * import re import os import sys import subprocess sys.path.append('/usr/share/apport/symptoms/') from _audio_data import * from _audio_checks import * def ask_jack_and_card(report, ui): ''' Reports what jack and/or card the user has a problem with Returns (package, card, isOutput, jack) tuple ''' cards = parse_cards() jacks = [] for c in cards: for j in c.jacks: jacks.append((c,j)) # Ask for a specific jack if len(jacks) > 0: choices = ["%s (%s)" % (j.pretty_name(), c.pretty_name()) for c,j in jacks] choices.append("It's not listed here") nr = ui.choice('What hardware are you having a problem with?\n', choices) if nr is None: raise StopIteration nr = nr[0] if (nr < len(jacks)): c,j = jacks[nr] report['Symptom_Card'] = c.pretty_name() report['Symptom_Jack'] = j.pretty_name() return (None, c, j.isOutput(), j) # Okay, not a specific jack, let's ask for sound cards choices = [] interfaces = ['PCI/internal', 'USB', 'Firewire', 'Bluetooth'] for c in cards: choices.append("Playback from %s" % c.pretty_name()) choices.append("Recording from %s" % c.pretty_name()) choices.extend(["%s device not listed here" % i for i in interfaces]) nr = ui.choice("What audio device are you having a problem with?", choices) if nr is None: raise StopIteration nr = nr[0] if int(nr / 2) < len(cards): report['Symptom_Card'] = c.pretty_name() return (None, cards[int(nr/2)], nr % 2 == 0, None) # card not detected by alsa, nor pulse nr = nr - 2 * len(cards) report['Title'] = "%s sound card not detected" % interfaces[nr] if interfaces[nr] == 'Firewire': if not ui.yesno('External firewire cards require manual setup.\n' 'Documentation is here: https://help.ubuntu.com/community/HowToJACKConfiguration\n' 'Would you like to continue reporting a bug anyway?'): raise StopIteration return ('libffado1', None, None, None) return ('alsa-base', None, None, None) def symptom_fails_after_a_while(report, ui, card, isOutput, jack): pa_start_logging() ui.information("Please try to reproduce the problem now. Close this dialog\n" "when the problem has appeared.") pa_finish_logging(report) report['Title'] = get_hw_title(card, isOutput, jack, "fails after a while") return 'alsa-base' def symptom_distortion(report, ui, card, isOutput, jack): check_volumes(report, ui, card, isOutput, jack, 0) p = check_test_tones(report, ui, card, isOutput, jack) report['Title'] = get_hw_title(card, isOutput, jack, "Sound is distorted") return p def symptom_background_noise(report, ui, card, isOutput, jack): check_volumes(report, ui, card, isOutput, jack) p = check_test_tones(report, ui, card, isOutput, jack) report['Title'] = get_hw_title(card, isOutput, jack, "Background noise or low volume") return p def symptom_underrun(report, ui, card, isOutput, jack): pa_start_logging() p = check_test_tones(report, ui, card, isOutput, jack) if p is None: ui.information("Please try to reproduce the problem now. Close this dialog\n" "when the problem has appeared.") pa_finish_logging(report) report['Title'] = get_hw_title(card, isOutput, jack, "Underruns, dropouts or crackling sound") return p def symptom_mixer(report, ui, card, isOutput, jack): pa_start_logging() ui.information("If there is a range of the mixer slider that's particularly\n" "problematic, please place the slider in that range before continuing.\n" "Also describe the problem in the bug report. Thank you!") pa_finish_logging(report) report['Title'] = get_hw_title(card, isOutput, jack, "volume slider problem") return 'alsa-base' def symptom_user(report, ui, card, isOutput, jack): check_audio_users(report, ui) check_devices_in_use(report, ui) report['Title'] = get_hw_title(card, isOutput, None, "sound not working for all users") return 'alsa-base' def symptom_no_sound(report, ui, card, isOutput, jack): check_volumes(report, ui, card, isOutput, jack) check_devices_in_use(report, ui) p = check_test_tones(report, ui, card, isOutput, jack) report['Title'] = get_hw_title(card, isOutput, jack, "No sound at all") return p def symptom_fallback(report, ui, card, isOutput, jack): check_volumes(report, ui, card, isOutput, jack) p = check_test_tones(report, ui, card, isOutput, jack) report['Title'] = get_hw_title(card, isOutput, jack, "Playback problem" if isOutput else "Recording problem") return 'alsa-base' def symptom_noautomute(report, ui, card, isOutput, jack): check_volumes(report, ui, card, isOutput, jack) if jack is not None: ui.information("Now, please make sure the jack is NOT plugged in.\n" "After having done that, close this dialog.\n") report['Symptom_JackUnplugged'] = card.get_codecinfo() ui.information("Now, please plug the jack in.\n" "After having done that, close this dialog.\n") report['Symptom_JackPlugged'] = card.get_codecinfo() report['Title'] = get_hw_title(card, isOutput, jack, "No automute" if isOutput else "No autoswitch") return 'alsa-base' def ask_symptom(report, ui, isOutput): ''' returns a function to call next, or StopIteration ''' dirstr = "output" if isOutput else "input" symptom_map = [ ('No sound at all', symptom_no_sound), ('Only some of %ss are working' % dirstr, symptom_fallback), ('No auto-%s between %ss' % ("mute" if isOutput else "switch", dirstr), symptom_noautomute), ('Volume slider, or mixer problems', symptom_mixer), ('Sound has bad quality (e g crackles, distortion, high noise levels etc)', None), ('Sound works for a while, then breaks', symptom_fails_after_a_while), ('Sound works for some users but not for others', symptom_user), ('None of the above', symptom_fallback)] symptom_badquality_map = [ ('Digital clip or distortion, or "overdriven" sound', symptom_distortion), ('Underruns, dropouts, or "crackling" sound', symptom_underrun), ('High background noise, or volume is too low', symptom_background_noise)] problem = ui.choice('What particular problem do you observe?', [a for a,b in symptom_map]) if problem is None: raise StopIteration desc, func = symptom_map[problem[0]] # subquestion for bad quality sound if func is None: problem = ui.choice('In what way is the sound quality bad?', [a for a,b in symptom_badquality_map]) if problem is None: raise StopIteration desc, func = symptom_badquality_map[problem[0]] report['Symptom_Type'] = desc return func def run(report, ui): # is pulseaudio installed and running? package = check_pulseaudio_running(report, ui) if package is not None: return package # Hardware query (package, card, isOutput, jack) = ask_jack_and_card(report, ui) if package is not None: return package # Check that the pulseaudio profile is correctly set package, channelcount = check_pulseaudio_profile(report, ui, card, isOutput, jack) if package is not None: return package # Symptom query problem_func = ask_symptom(report, ui, isOutput) package = problem_func(report, ui, card, isOutput, jack) if package is not None: return package # Hopefully we don't come here, but if we do, use ALSA as fallback. return 'alsa-base' trunk/symptoms/display.py0000664000000000000000000000665413423635127013044 0ustar # Display (X.org) related problems # Author: Bryce Harrington # (C) 2009 Canonical Ltd. # License: GPL v2 or later. from glob import glob import subprocess import apport.hookutils import time import os description = 'Display (X.org)' def problem_boot_fail(report, ui): prompt = "What type of boot failure do you experience?" problems = [ {'desc':"Go back", 'package':None}, {'desc':"Black or blank screen", 'tags':'blank', 'info':"See http://wiki.ubuntu.com/X/Troubleshooting/BlankScreen for help working around and debugging blank screen on boot issues.", 'package':report['VideoDriver']}, {'desc':"White screen after logging in", 'info':"White screens generally indicate a failure initializing Compiz or kwin; thus, as a workaround try disabiling Desktop Effects", 'package':'mesa'}, {'desc':"Solid brown or other color", 'tags':'freeze', 'package':report['VideoDriver']}, {'desc':"Garbage or corruption on screen", 'tags':'freeze corruption', 'info':"If possible, please also take a photo of the screen and attach to the bug report. Sometimes the style of corruption can give clues as to where in memory the error has occurred.", 'package':report['VideoDriver']}, ] choice = [] for item in problems: choices.append(item['desc']) choice = ui.choice(prompt, choices)[0] if choice is None: raise StopIteration return problem[choice]['package'] def run(report, ui): prompt = 'What display problem do you observe?' choice = ui.choice(prompt, ['I don\'t know', 'Freezes or hangs during boot or usage', 'Crashes or restarts back to login screen', 'Resolution is incorrect', 'Shows screen corruption', 'Performance is worse than expected', 'Fonts are the wrong size', 'Other display-related problem', ]) if choice is None or choice == [0]: raise StopIteration choice = choice[0] report.setdefault('Tags', '') # Tag kubuntu bugs if subprocess.call(['pgrep', '-u', str(os.getuid()), '-x', 'ksmserver']) == 0: report['Tags'] += ' kubuntu' # Process problems if choice == 1: ui.information('To debug X freezes, please see https://wiki.ubuntu.com/X/Troubleshooting/Freeze') report['Tags'] += ' freeze' report['Title'] = 'Xorg freeze' return 'xorg' if choice == 2: ui.information('Please reproduce the crash and collect a backtrace. See https://wiki.ubuntu.com/X/Backtracing for directions.') report['Tags'] += ' crash' report['Title'] = 'Xorg crash' # TODO: Look in /var/crash and let user select a crash file, and then parse it return 'xorg' if choice == 3: report['Tags'] += ' resolution' return 'xorg' if choice == 4: ui.information('Please take a photo of the screen showing the corruption and attach to the bug report') report['Tags'] += ' corruption' # TODO: Let user upload the file return 'xorg' if choice == 5: report['Tags'] += ' performance' return 'xorg' if choice == 6: report['Tags'] += ' fonts' return 'xorg' if choice == 7: return 'xorg' ui.information('Please run "ubuntu-bug " to report this bug') return None trunk/symptoms/installer.py0000664000000000000000000000115413645166643013372 0ustar # ubuntu-release-upgrader related problems # Author: Brian Murray # (C) 2020 Canonical Ltd. # License: GPL v3 or later. import os def run(report, ui): with os.scandir('/var/log/installer') as entries: for entry in entries: if entry.name.startswith('subiquity'): return 'subiquity' elif entry.name == 'telemetry': return 'ubiquity' # d-i leaves a few unique things including # lsb-release, hardware-summary, status elif entry.name == 'status': return 'debian-installer' trunk/symptoms/security.py0000664000000000000000000000614213423635127013236 0ustar # Security related problems # Author: Marc Deslauriers # (C) 2010 Canonical Ltd. # License: GPL v3 or later. from glob import glob import subprocess import apport.hookutils import time import os description = 'Security related problems' def run(report, ui): problem = ui.choice('What particular problem do you observe?', ['I can see my password as I type when using ssh and sudo', 'The root account is disabled by default', 'I am not prompted for my password when I run sudo a second time', 'I am not prompted for a password when booting to rescue mode', 'Other users can access files in my home directory', 'My screen isn\'t locked when I come out of suspend or hibernate', 'My screen doesn\'t lock automatically after being idle', 'Other screen locking issue', 'Other problem', ]) if problem is None: raise StopIteration problem = problem[0] if problem == 0: ui.information('This is expected as there is no "tty" allocated when running commands directly via ssh. Adding the "-t" flag will allocate a tty and prevent sudo from echoing the password.\n\nFor more information, please see:\nhttps://wiki.ubuntu.com/SecurityTeam/FAQ#SSH') raise StopIteration if problem == 1: ui.information('By default, the root account is disabled in Ubuntu and use of the "sudo" command is recommended.\n\nFor more information, please see:\nhttps://help.ubuntu.com/community/RootSudo') raise StopIteration if problem == 2: ui.information('Sudo is designed to keep a "ticket" valid for 15 minutes after you use your password for the first time. This is configurable.\n\nFor more information, please see:\nhttps://wiki.ubuntu.com/SecurityTeam/FAQ#Sudo') raise StopIteration if problem == 3: ui.information('By default, the root account is disabled in Ubuntu and use of the "sudo" command is recommended. Since the root account is disabled, it\'s not possible to prompt for the root password when entering single user mode.\n\nFor more information, please see:\nhttps://wiki.ubuntu.com/SecurityTeam/FAQ#Rescue%20Mode') raise StopIteration if problem == 4: ui.information('By default, Ubuntu is designed to allow users to easily share files and help each other. To support this, each user\'s default home directory is readable by all other users.\n\nFor more information, please see:\nhttps://wiki.ubuntu.com/SecurityTeam/Policies#Permissive%20Home%20Directory%20Access') raise StopIteration if problem == 5: report['Title'] = 'Screen not locked when coming out of suspend/hibernate' return 'gnome-screensaver' if problem == 6: report['Title'] = 'Screen not locked after inactivity' return 'gnome-screensaver' if problem == 7: report['Title'] = 'Screen locking issue' return 'gnome-screensaver' if problem == 8: ui.information('Please use "ubuntu-bug " to report a bug against the particular package') raise StopIteration assert False, 'not reached' trunk/symptoms/storage.py0000664000000000000000000001217413467623244013042 0ustar # Storage device related problems # Author: Martin Pitt # (C) 2009 Canonical Ltd. # License: GPL v2 or later. from glob import glob import subprocess import apport.hookutils import time import os description = 'External or internal storage devices (e. g. USB sticks)' def run(report, ui): problem = \ ui.choice('What particular problem do you observe?', ['Removable storage device is not mounted automatically', 'Internal hard disk partition cannot be mounted manually', 'Internal hard disk partition is not displayed in Places menu', 'No permission to access files on storage device', 'Documents cannot be opened in desktop UI on storage device', 'Other problem'] ) if problem is None: raise StopIteration problem = problem[0] if problem == 0: return problem_removable(report, ui) if problem == 1: report['Title'] = 'Internal hard disk partition cannot be mounted manually' return 'udisks2' if problem == 2: report['Title'] = 'Internal hard disk partition is not displayed in Places menu' return get_desktop_vfs(ui) if problem == 3: return problem_permission(report, ui) if problem == 4: report['Title'] = 'Documents cannot be opened in desktop UI on storage device' return get_desktop_vfs(ui) if problem == 5: ui.information('Please use "ubuntu-bug " to report a bug against the particular package') raise StopIteration assert False, 'not reached' def problem_removable(report, ui): ui.information('Please disconnect the problematic device now if it is still plugged in.') try: ud_mon = subprocess.Popen(['udisksctl', 'monitor'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) except OSError: ud_mon = None try: udev_mon = subprocess.Popen(['udevadm', 'monitor', '--udev', '-e'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) except OSError: udev_mon = None try: gvfs_mon = subprocess.Popen(['gvfs-mount', '-oi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) except OSError: gvfs_mon = None old_mounts = set(open('/proc/mounts').readlines()) old_devices = set(glob('/dev/sd*')) ui.information('Please connect the problematic device now.') time.sleep(10) new_mounts = set(open('/proc/mounts').readlines()) new_devices = set(glob('/dev/sd*')) if ud_mon: ud_mon.terminate() out, err = ud_mon.communicate() report['UdisksMonitorLog'] = out if err: report['UdisksMonitorError'] = err if udev_mon: udev_mon.terminate() out, err = udev_mon.communicate() report['UdevMonitorLog'] = out if err: report['UdevMonitorError'] = err if gvfs_mon: gvfs_mon.terminate() out, err = gvfs_mon.communicate() report['GvfsMonitorLog'] = out if err: report['GvfsMonitorError'] = err new_devices = new_devices - old_devices new_mounts = new_mounts - old_mounts report['HotplugNewDevices'] = ' '.join(new_devices) report['HotplugNewMounts'] = '\n'.join(new_mounts) apport.hookutils.attach_dmesg(report) if not new_devices: return apport.packaging.get_kernel_package() if new_mounts: if ui.yesno('The plugged in device was automounted:\n\n%s\n' 'Do you still need to report a problem about this?' % report['HotplugNewMounts']): return 'udisks2' else: raise StopIteration if 'SUBSYSTEM=block' not in report['UdevMonitorLog']: report['Title'] = \ 'Removable storage device not detected as block device' return 'udev' report['Title'] = 'Does not detect hotplugged storage device' for d in new_devices: if 'DEVNAME=' + d not in report['UdevMonitorLog']: return 'udev' if ' %s\n' % d not in report['UdisksMonitorLog']: return 'udisks2' return get_desktop_vfs(ui) def problem_permission(report, ui): '''No permission to access files on storage device''' report['Title'] = 'No permission to access files on storage device' return 'udisks2' def get_desktop_vfs(ui): if subprocess.call(['pgrep', '-u', str(os.getuid()), '-f', 'gnome-session-binary']) == 0: return 'gvfs' if subprocess.call(['pgrep', '-u', str(os.getuid()), '-x', 'ksmserver']) == 0: return 'kdelibs5' ui.information('Sorry, you are not running GNOME or KDE. Automounting needs to be provided by your desktop environment.') raise StopIteration trunk/symptoms/ubuntu-release-upgrader.py0000664000000000000000000000032613423635167016140 0ustar # ubuntu-release-upgrader related problems # Author: Brian Murray # (C) 2013 Canonical Ltd. # License: GPL v2 or later. def run(report, ui): return 'ubuntu-release-upgrader-core'