Debugging

Differences between revisions 33 and 34
Revision 33 as of 2008-03-26 22:27:06
Size: 40264
Editor: c-67-168-235-241
Comment:
Revision 34 as of 2008-03-27 01:50:22
Size: 40338
Editor: c-67-168-235-241
Comment:
Deletions are marked like this. Additions are marked like this.
Line 498: Line 498:
     * Running /etc/acpi/hibernate.sh or /etc/acpi/sleep.sh should do it

X and Ubuntu

The X Windows System is a critical component in the Ubuntu operating system. X is not without its bugs, but fortunately debugging X issues is not rocket science.

The vast majority of Ubuntu X issues fall into one of several distinct categories, and based on the way they manifest, there are several different tactics that can be employed in a nearly paint-by-numbers fashion to isolate them.

Even non-developers can help! The goal of this handbook is to give folks a toolset for rendering these bugs easily solveable. By making Ubuntu's X strong, we can help drive Open Source to world domination!

Bug Reporting

The lifecycle of a bug report begins, unsurprisingly, with the preliminary report. How a bug is initially reported can have a huge effect on how it's handled and how quickly it gets fixed.

Choosing a Good Title

Your title should communicate two things: The symptom you're seeing, and whatever is unique or unusual about your system. Otherwise, your bug may not get proper attention.

Examples:

BAD:

Crazy screen issues on boot

BAD:

Multiple problems with CD today

BAD:

Not able to login or start X after updating

BAD:

Randomly doesn't work

GOOD:

[Feisty] Screen briefly corrupts during boot with -nv (NVidia 6100)

GOOD:

[Hardy Alpha-3] Alt-CD (only) selected wrong driver (Matrox / BenQ FP91+)

GOOD:

[Gutsy] Periodic crashes w/ high CPU on Dell Latitude D505 (-intel 855GM)

GOOD:

[Dapper,Edgy] Wrong default refresh rates on 16:10 LCD panels

GOOD:

After update to -intel 2.0-0ubuntu3, X fails with 'Invalid mode' error

Do's and Don't's

DON'T:

Assume "they must already know about this"

DO:

Look for existing bug reports that match your problem

DON'T:

Assume a "similar" bug is exactly what you're seeing

DO:

File a new bug, but mention the ID's of all bugs that sound similar. Someone can dupe them together later.

DON'T:

Add "me too" responses. Wastes everyone's time.

DO:

Add missing data (photos, logs) to add to an existing bug's "knowledge base". Or if you just wish to be notified, then Subscribe yourself to the bug.

DON'T:

Post bugs with only a brief description of the problem

DO:

Post relevant logs, config files, and data (see table below) ALWAYS ATTACH YOUR /var/log/Xorg.0.log

DON'T:

Assume "everyone" is seeing this same bug

DO:

Consider what is unique about your system

DON'T:

Assume others will "just know" how the bug occurs

DO:

Itemize the exact steps that result in the issue. Can you reproduce it at will?

DON'T:

Fire and forget. Abandoned bugs rarely get fixed.

DO:

Follow up on your bug from time to time, even if it seems ignored. Report if the issue goes away or remains when new Ubuntu's come out.

What to Include in Bug Reports

Problem class:

Things to Include:

General X bug

Description of problem

Paste in output of lspci -nn | grep VGA

Attach /etc/X11/xorg.conf

Attach /var/log/Xorg.0.log

Attach output of lspci -vvnn

Wrong resolutions, refresh rates, or monitor specs

Resolution, rate, or other parameter expected

Resolutions, rates, or other parameters actually obtained

/etc/X11/xorg.conf

/var/log/Xorg.0.log

output of lspci -vvnn

output of sudo ddcprobe

output of xrandr

Wrong font dpi or size

Are you running GNOME, KDE, XFCE, or ...?

Affected (and unaffected) applications

/var/log/Xorg.0.log

output of sudo ddcprobe

Screenshot showing font differences

X crash, lockup, freeze, exit, or doesn't start/shutdown

Detailed description of problem

List any versions you tried that did not have this issue

Detailed list of steps to reproduce

How complete is the X failure? BR + Does ctrl+alt+f1 take you to a console? BR + Does ctrl+alt+backspace restart X? BR + Does mouse pointer still move? BR + Does the keyboard LED come on when hitting the CAPSLOCK key?

/etc/X11/xorg.conf

/var/log/Xorg.0.log

/var/log/Xorg.0.log.old

~/.xsession-errors

output of lspci -vvnn

output of cat /proc/acpi/video/*/DOS

output of sudo cat /proc/acpi/dsdt

Keyboard, touchpad, and mouse issues

Description of the problem

/var/log/Xorg.0.log

output of xprop -root

output of gconftool-2 -R /desktop/gnome/peripherals

Screen display corruption

Photo of the screen

Description of the problem

Does it also occur if DRI is disabled?

/var/log/Xorg.0.log

Bad video playback

/etc/X11/xorg.conf

/var/log/Xorg.0.log

output of lspci -vvnn

Bug Triage

Ubuntu receives a huge amount of bug reports, many of which are important and valid issues needing attention. Even so, nearly all X bugs are initially reported without information necessary for classification and analysis. This is where the bug triaging role comes in.

Bug triaging for Ubuntu's Xorg components does not require any particular expertise with X, just regular Linux know-how should be sufficient. As a bug triager, your role is twofold: First as a coach to help bug reporters in maximizing their chances of getting the bug addressed by providing complete information, and second as a filter to help developers focus their time on important and/or easy-to-fix bugs.

After initially reported, a bug is reviewed and several basic things are checked by the bug triager:

INITIAL TRIAGE:

Do a query for NEW bugs, and for each bug try to move its state to Incomplete, Invalid, etc.: 1. Is it definitely an X bug? Sometimes things get misfiled, and sometimes reports are just invalid, or are really just support requests and should be directed to Launchpad Answers instead. If unsure, leave it as is.

2. Is it clearly a dupe of an already known bug? Ideally reporters should do a cursory scan of existing bug reports to see if it's obviously already in the system, but not all reporters do. If unsure, don't dupe it - someone can handle this later.

3. Is the title descriptive enough? Watch out for generic titles like "Randomly crashes", "X won't start", or "Corrupted graphics after suspend/resume" because these are just common symptoms and will tend to accumulate me too reports from people with the same symptom but actually a different bug.

4. Is there at least the basic minimum amount of data present? If not, mark it Incomplete and see below for a table of what kinds of files and command output is needed. Once you think the basic required info is present, move it to the Confirmed state.

FINAL TRIAGE:

Do a query for INCOMPLETE-WITH-RESPONSE bugs, and for each bug try to move its state to Completed or etc.: 5. Take action if now obvious, or ask for additional information. Often by this point, additional information has come to light indicating the bug is resolved, a dupe, or invalid, so you can just set the state accordingly at this point.

6. Handle 'me-too' replies. Often, additional users will report that they too have the "same" problem, yet don't give evidence to that fact so it's hard to say. As a general rule it is preferred for users to report bugs independently unless they present evidence that it is the same (e.g. identical error messages, steps to reproduce, hardware, etc.) In particular, for third party confirmation of an issue it's best for them to post evidence (log files, screenshots, etc.) that they're seeing the same thing. Often the original information request was not answered by the original reporter, but another user has answered in their place - in this case be extremely careful that the second reporter has exactly the same issue, and is not simply piggybacking on a report that 'sounds roughly similar'; gently encourage them to file a new report on their issue if it's not the same.

7. Review log files for error messages or other obvious anomalies. Highlight these in the bug report, and search launchpad for other reports of that same error message. Mention these as potential dupes, or dupe them where obvious.

8. Tidy up the bug report. This may involve improving the bug's title or wordsmithing the description to clarify it. Also, make sure it has an Importance assigned to it (see below).

Also do a query for INCOMPLETE-WITHOUT-RESPONSE. In some cases, the bugs actually do have a response, so the above procedure can be used. In most cases, we're still waiting on a response. If a long period (say, 60 days) has passed since the first unanswered request, the bug can be closed as out of date, usually with a request to please test against the latest development version of Ubuntu, and reopen the bug with the requested info if the problem still exists.

Marking Bugs Ready to be Upstreamed

Often bugs are best solved upstream, so many of our bugs should be filed upstream with them. However, it's important to ensure we send them only quality reports that have a high chance of being solved. It's our job to filter out reports that lack information or otherwise are inappropriate for upstream. This work can be divided into two steps: Marking bugs for upstreaming, and filing the upstream reports.

A bug is ready for upstreaming if it meets all the following criteria: * The original reporter (or a secondary reporter who has proven to have *exactly* the same issue) is active on the Launchpad bug and can follow up on requests * The issue has be verified using upstream's git-head of xserver and/or the relevant driver * The issue is not Ubuntu-specific, and not likely to be a kernel issue * The bug has complete set of log files, backtraces with debug symbols (if its a crash), config files, screenshots, etc. as appropriate. * The bug has a solid set of steps to reproduce it on demand (if it occurs randomly or intermittently, upstream won't accept it.)

To mark a bug as ready for upstream, click "Also affects project", then leave the URL empty and click "Add to bug report", and "Confirm". This will leave a blank upstream task to search on later.

Reporting X issues upstream

To get issues addressed effectively, its important to provide complete information and clean, high-quality reports them. Indeed, much of the above bug work is geared with the objective of gathering sufficient information that upstream will be able to deal effectively with the problem.

Do a query on "Bugs that need reported upstream". This searches for bugs with an empty project task. For each bug, do a search to see if the same bug is already reported upstream. Take care though - many times a bug *looks* similar but isn't; if there is *any* doubt, file a new bug and just mention the possible dupe, and let the experts decide.

Here are some guidelines for getting best results from bugs upstreamed to bugzilla.freedesktop.org:

* Always ask the original reporter to join the discussion at bugzilla, and also subscribe them to the bug report after filing it. * Focus each bug report on a single issue. Even if the Launchpad bug has multiple "me too" comments, only focus the upstream bug on one of these. * Attach complete logs, config files, screenshots, photos, and all other collected evidence * Be prepared to follow through on additional information requests, testing, and so on * Include a prominent link back to the launchpad bug (not only for upstream; this gives you a convenient back-link to the original bug).

Bug Importance

Bug "Importance" is not the same thing as Development Priority. Importance is an indication of the severity of the issue, not an indication of when it will be fixed (although a bug's importance is a factor to consider when prioritizing).

Low: These bugs are merely cosmetic or make things inconvenient, or occur only rarely.

Medium: Most bugs are medium importance. They hamper use of the system in some fashion, sometimes requiring an inconvenient workaround or other unusual steps (like disabling hardware or software features or reverting to older versions) to get around it.

High: These are serious bugs that are preventing users from using the system, either with no known workaround or an extremely cumbersome one.

Critical: This importance level is not often used, and is saved for widespread catastrophic failures, like X failing to start for all Ubuntu users.

A bug that affects a lot of users may deserve one bump up from where it would be otherwise. A bug which was not well reported, that can't be reproduced, or that only occurs in obscure situations may have its importance bumped down one step.

The bug triager should make an attempt to set an appropriate importance, but don't worry about getting it perfect; it can be adjusted later.

Bug Priority

The priority for a bug is determined by the developers themselves, based on a variety of factors, and so the bug triager does not need to do anything with regard to priority usually.

One factor that can drive a bug to a high priority is if there is a known, tested fix for it, that simply needs integrated into the development version of Ubuntu.

There are two ways priority is indicated in Launchpad:

1. Milestones: Bugs that are assigned to a milestone will gain priority attention during that development cycle. Do not milestone bugs until after they've been fully triaged and have all necessary information available to troubleshoot them.

2. Assignees: Bugs that are assigned to a particular individual will be priorities for them to work on. Generally, ask before assigning bugs to a developer, unless you're that developer's manager.

Bug Research

For many bugs, a little googling and searching in upstream bug trackers can reveal important additional info.

1. Review all attached log files for error messages.

2. Look for other similar/duplicate bug reports to gain additional perspectives and look for obvious commonalities, like same error messages, driver, hardware, etc. Places to search:

  • google.com
  • bugs.launchpad.net/ubuntu
  • bugs.debian.org/
  • bugs.freedesktop.org/
  • ubuntuforums.org
  • If you find the same issue reported in Launchpad, mark the less complete and/or newer bug as a dupe of the other. If you find the same issue reported in debian or xorg, mark it as "Also affects project..." With Google, it often helps to include "ubuntu" in the search string. Also, you can use "site:freedesktop.org" or "site:debian.org" to narrow the search to a specific domain.

3. Try reproducing the issue, especially if you have similar hardware.

4. Look for a newer version of the package, and review its changes to see if there's a fix for this issue.

  • If so, check apt-get update; apt-cache madison $pkgname to see if the new version is already packaged. If not, ask a packager to produce a test package of the new release to test for this bug.

5. Upload any patches you run across directly to Launchpad, and be sure to tick the "patch" checkbox, so patches can be queried for later.

6. Have them try an older Ubuntu Live CD, or have them downgrade a specific package. For example, to downgrade the xserver:

         apt-get install xserver-xorg-core=2:1.3.0.0.dfsg-4ubuntu
  • If an older version fixes the issue, then possibly you can bisect things down to find a specific patch causing the issue. See the Analysis section for how to do this.

7. Unless you've been lucky and found the fix already, finish up the research phase by doing the following:

  • Summarize your findings. Restate the problem, describe progress made, outline remaining suspicions or questions.
  • If appropriate, report the bug upstream to Debian and/or Xorg, attaching all relevant files and a link to the Ubuntu bug report. Summarize the research you did, patches that were tested, and any other details that may be relevant.

Analyzing X Problems

For hard bugs the analysis phase is the most important, and most challenging part of bug work. It often requires both strength of insight and skill with code.

Depending on how the bug is behaving, there are multiple directions to investigate the issue. Here's some different approaches:

Problem manifested only recently

If the issue has been narrowed to occur only after (or before) a given point in time or software version, then it is possible to narrow in on the specific cause of the issue through a "Bi-Section" strategy.

Essentially, if you know it occurred in Version 1, but not Version 8, have a person able to replicate the issue try Version 4. If it's there, then have them try Version 6, otherwise Version 2.

If the problem is in the current Ubuntu, but not in the prior Ubuntu, it can be useful to have them test the intermediate Alpha versions of the new release.

Once you have bracketed it down to a specific version of something, you can then go through the individual patches included in that version compared with the prior one. Sometimes the patch descriptions can give a strong clue to this. If there are a number of changes, then rather than trying each patch one-by-one you may want to simply disable the latter half of patches, and bisect that way.

If you've narrowed it to an upstream version change, then you may wish to use git's bisecting functionality to assist with this.

Problem manifests only with specific configuration options

Often, a bug exhibits itself only with a specific configuration setting turned on (or off). Often, knowing that the bug appears with one option but not another provides a very strong clue for further debugging; it can also provide a short-term workaround for people until it's fixed. Here's a few options that are worthwhile to vary:

Setting

Alternate(s)

Comment

Section "Module"

Load "dri"

Disable "dri"

Many bugs (esp. on -intel) exhibit only with direct rendering enabled

Load "glx"

Disable "glx"

Section "Monitor"

HorizSync 28.0 - 80.0BRVertRefresh 48.0 - 75.0

Comment lines out

Xorg 1.3+ often can figure these out automatically (and usually better). Hardcoding these incorrectly can lead to resolution, dpi, and other mode issues

Section "Device"

Driver "..."

Install alternate driver

Option "DRI" "true"

Option "DRI" "false"

Option "VBERestore" "true"

Option "VBERestore" "false"

Option "XAANoOffscreenPixmaps" "true"

Option "XAANoOffscreenPixmaps" "false"

Section "ServerLayout"

Option "AIGLX" "true"BROr blank

Option "AIGLX" "false"

AIGLX is already enabled in the server so is on by default. Turning it off might affect performance or AIGLX-related issues.

Section "Extensions"

Option "Composite" "Enable"

Option "Composite" "Disable"

Composite is enabled by default starting with Ubuntu. It can cause issues on some systems in some conditions; this is one way to turn it off.

Problem manifests only with a particular driver

If the research found that most people with this problem were all using the same driver, then obviously it makes sense to explore it from that aspect.

Note that for most graphics hardware, there are at least two different drivers. It can be worthwhile to test the alternate driver to verify it's a driver issue.

  • NVidia: -nv (open) and -nvidia (proprietary)
  • ATI: -ati (open) and -fglrx (proprietary)
  • Intel: -intel (current) and -i810 (legacy).

Each driver has its own source code package, which can be retrieved via xserver-xorg-video-<driver>. The open source drivers also have git repositories at http://gitweb.freedesktop.org.

Resolving these issues will generally require patching the driver code, although some driver-specific issues end up requiring changes to other pieces of code, like the xserver.

The following can be added to your /etc/X11/xorg.conf to provide additional debug information:

Section "Device"
        ...
        Option "ModeDebug" "true"
        ...
EndSection

Problem manifests only with particular kind of hardware

Many issues are highly specific to a particular kind of hardware, such as only Intel 855, or only a particular monitor model. Sometimes these end up being general bugs, but often they require adding hardware-specific quirks to the driver or to xserver.

Xorg crashes often tend to be hardware specific, as do issues with TV out and resolution detection failures.

Because they are hardware specific, it's required to provide your hardware identifiers. For video cards, this is the PCI ID, which can be found via lspci -vvnn. For monitors, you should provide the exact model id and manufacturer; EDID information (from ddcprobe or via read-edid by get-edid | parse-edid) can also sometimes be useful.

Problem manifests under seemingly random conditions

Few bugs are truly random; usually this just means more data is needed. In any case, it's nearly impossible to "troubleshoot-by-proxy" Xorg bugs that occur randomly, so it's important that the reporter do some extra work to either a) reduce it to a reproducible case, or b) identify the location in the code where the fault occurs by following other recommendations in this document (e.g. if it is crashing, use the directions for obtaining a backtrace).

Here are some tips for turning a random issue into a deterministic one:

  • Does it seem to come on only after running the screensaver? Or perhaps after resuming from suspend, hibernate, or other power savings mode?
  • Examine resource utilization over time - could it be triggered by a high memory or cpu load?
  • When you experience it, write down everything you did over the last 5 minutes or so; then, the next time it occurs, look at the list and see if you were doing some of those same things. Repeat those actions and see if you can trigger the problem.
  • If you boot a newer or older Ubuntu LiveCD on the same hardware, do you see the same issue?
  • If there is an alternate video driver available for your hardware, can you recreate the problem with that driver?
  • Could it be caused by fluctuating Network/power conditions?

Problem manifests itself during video playback

Many video bugs have already been reported, are well-known, and require significant architectural work to be done upstream in order to resolve them. So, before reporting a bug, please review existing bug reports to see if the issue is already known. Many of the known issues relate to use of Xv and/or compiz, so typical workarounds include not using one or the other or both.

If you are finding your issue is not already reported, first identify which Xorg extensions are involved. You can isolate the issue by varying some of these (e.g. trying with or without Compiz, comparing with XAA vs. EXA, enable/disable DRI, etc.) and by testing out different options in your video player (like whether to use Xv).

Problem manifests itself when using 3D software (compiz, games, GL...)

Many of the open source Xorg drivers do better with 2D than 3D, so issues are not uncommon. Unfortunately, this also means that most "solutions" will involve switching to one of the proprietary binary drivers, or to open but experimental 3D drivers.

In general, these issues need to be forwarded upstream. Gather as much supporting evidence in the form of screenshots/screencasts, log files, lspci -vvnn and detailed steps to reproduce the issue.

If you are seeing the issue with a proprietary application such as a commercial game, first try to reproduce the issue with various open source games or tools such as glxgears; your bug will be much more likely to gain attention upstream if it can be demonstrated with software that upstream developers can easily get their hands on.

Problem manifests as a performance degradation issue

For general performance degradation, you can often isolate these issues by experimenting with different driver options, such as switching between XAA and EXA, turning DRI on or off, or using an alternate driver. Many of these issues will already be well-known, so be sure to search the bug tracker before reporting. They're also often issues that are not trivially solved, so you may need to either live with the issue or use a workaround (such as no Compiz) for a while.

For performance regressions in specific situations, first try to identify exactly when the issue started happening; try reverting to older versions of your video driver (perhaps by testing different alpha releases of Ubuntu). If you can narrow down the range of driver versions where the issue occurred, this can help a great deal in identifying the patch that caused the regression.

If the issue has been present for a long while, and is specific to a particular application, consider reporting the issue against that application. Even if it is a driver limitation at core, sometimes the application developers will be able to work around it on their end more easily than it can be handled in the driver.

Problem results in screen display corruption

Nearly all screen corruption issues will be due to a bug in a driver. Identify the driver and the specific steps to produce the corruption. Then run the xserver through gdb to identify the line or lines immediately prior to the corruption.

From here, things to try could include checking for invalid/undefined values, adding usleep() calls to add delay, or even disabling the lines in question.

Once a preliminary patch exists, post it to the upstream xorg list for feedback. Often they can suggest a better patch.

Problem results in X crash, lockup, freeze, or exit

In some cases, an error message will be printed before the fault; these can be used to identify where in the codebase the fault occurred, and often give an explanation as to why.

Otherwise, use gdb to get a backtrace. Once the issue is found, step through the code leading up to the line where the fault occurred. Look for invalid/undefined values, or questionable logic. Try disabling the line or lines where the fault occurred, adding usleep() before it, or etc.

Once a preliminary patch exists, post it to the upstream xorg list for feedback. Often they can suggest a better patch.

Problem involves wrong resolutions, refresh rates, or monitor specs

These sorts of issues used to be quite common in Feisty and earlier versions of Ubuntu, but should be quite rare these days. However, they do happen from time to time.

Today, the issues are generally due to lack of hardware support in Xorg's hardware autodetection algorithms; this happens usually only if your hardware is very new, very old, or very obscure. You can work around this by manually specifying the configuration in xorg.conf, such as the device driver, monitor vrefresh and hsync, modes, and so on. In a worst case, you may also need to generate your own modeline for the hardware.

In any case, report the issue with example Xorg.0.log files and include detailed information including your monitor manufacturer and model number, and your video card details via lspci -vvnn. Also provide the failed xorg.conf configuration and your working xorg.conf after manual configuration. This information can be used to improve Xorg's autodetection, so it'll be able to properly detect and configure your hardware in the future.

Problem involves wrong font dpi or size

In Feisty and before, GNOME hardcoded the dpi to 96. Starting with Gutsy, they dropped that and began trusting what the X server reported. However, in Gutsy the X server was not very trustworthy on this! Due to the way X was configured back then, using a set of ancient postinst heuristics, the screen physical dimensions were often wild guesses that rarely matched reality. So we saw a LOT of issues with huge or tiny fonts in the login screen, menu bars, applications, etc. For Gutsy, we ended up going back to hardcoding to 96 for the most part.

In Hardy, things have gotten a lot better. The hacky postinst script is no longer in use, so in many cases the X server's calculations are now correct. However, there are still many corner cases where the X server still doesn't get it right. So in the spirit of stability we stuck with the 96 dpi hardcoding that proved to work acceptably in Gutsy.

Unfortunately, this leaves us with various cases where the font dpi is not right. Luckily the issues are usually not the severe HUGE font sizes we used to see, but small things, like text not fitting properly in dialog windows, being slightly distorted on login screens, etc. You can check xdpyinfo and see what the X server thinks is the proper DPI, and if it looks ok to you, you can disable the hardcoded 96 dpi [TBD - how do override it?]

Problem involves buggy EDID from monitor

If the monitor is clearly advertising an incorrect mode (such as not advertising a preferred mode), a quirk can be added to the xserver to prefer a specific mode.

If you run either ddcprobe or get-edid | parse-edid (from the read-edid package), and see the error message "edid fail" in the output, then you have this issue.

For more background, troubleshooting approaches, and solutions, please see bug [https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/194760 #194760].

Problem occurs on resume, logout, screensaver, tty switch, etc.

A large class of graphics bugs occur when changing modes, such as:

  • On resume from hibernate
  • On resume from suspend
  • On closing (or opening) laptop lid (independently of hibernate/suspend)
  • When screensaver comes on
  • When a GL screensaver comes on
  • Right after typing in password on the login screen
  • When switching to a tty console (e.g. ctrl-alt-f1)

Some reporters see issues on only one of the above situations, but many see it on a combination. If you experience one kind of crash from the above list, try some of the others to identify if you're seeing a single-mode or multiple-mode issue.

As well, the symptoms and characteristics of the failure can vary:

  • Screen is blank (like it's turned off)
  • Screen is black but being drawn (like it's on, but on a black screen)
  • Mouse cursor is visible and can be moved, but clicking does nothing
  • Mouse cursor is visible but won't move
  • Despite the display issue, the system works fine (startup sounds play, can ssh in, etc.)
  • Xorg crashes, returning user to the login screen
  • System seems locked up - can be pinged, but cannot ssh in nor run any programs
  • Xorg seems frozen - Ctrl-alt-backspace does not work
  • System seems frozen - Caps lock does not work
  • Occurs every time the mode changes
  • Occurs every other time the mode changes
  • Occurs only some times when the mode changes
  • Occurs only when there is a mode change after the system has been idle some period of time

Typically the failure will involve some combination of the above symptoms. When two reporters have the exact same set of symptoms for a given set of mode change failures, and are using the same chipset family, it's a good bet that they're experiencing the same bug. If the symptoms don't match up exactly, and they have the same hardware, then it's likely they aren't having quite the same bug, and the fix for one will probably not fix the other. On the other hand, sometimes a bug will exhibit different symptoms on different kinds of hardware. So on i915 it may show up as a system freeze, whereas on i945 it just crashes X, but a single bug fix will solve both issues.

Analysis and Workarounds

There are a number of tricks for working around these issues. In some cases they're good enough to address the user's needs. In other cases it simply changes the symptoms, or decreases the frequency of the issue. Sometimes they make things worse! But regardless, this analysis can provide very useful evidence to know which workarounds affect the issue, as that gives strong hints as to where the bug lays.

  • Disable Compiz
  • Disable all power management
  • Force a different mode switch
    • Log out of X, and log into the console, and try suspend/resume (or hibernate, or whatever) from there
      • Running /etc/acpi/hibernate.sh or /etc/acpi/sleep.sh should do it
      • If it does not come up ok, the failure is in the kernel rather than X
      • Test if caps lock works; whether this works determines how bad the kernel failure is
    • Switch virtual consoles and back (alt-ctrl-f1, alt-ctrl-f7 or f8 or f9)
    • If laptop, close lid and reopen
    • Attach another external monitor
  • Try installing an alternate driver (like -i810 instead of -intel), or an older or newer version of the driver
  • Adjust ACPI settings
    • In /etc/default/acpi-support, set SAVE_VBE_STATE=false
    • In /etc/default/acpi-support, set SAVE_VIDEO_PCI_STATE=true
    • In /etc/default/acpi-support, set POST_VIDEO=false
    • In /etc/default/acpi-support, set USE_DPMS=true
    • Add the VBERestore option in Devices section of /etc/X11/xorg.conf
    • Remove the VBERestore option in Devices section of /etc/X11/xorg.conf
  • Adjust kernel ACPI settings in /boot/grub/menu.lst
    • Add to grub kernel parameters: "acpi_sleep=s3_bios,s3_mode"
    • Add to grub kernel parameters: "notsc"
  • Remove ACPI components to narrow down which causes the failure
    • sudo rmmod video

    • Check the contents of cat /proc/acpi/video/*/DOS before and after removing video
    • This can help identify if the bug is in the driver / BIOS
  • BIOS settings
    • Change "Internal Graphics Mode Select" BIOS setting from 1MB to 8MB

Problem involves keyboard input ceasing to work

Keyboard failures can occur for a large variety of reasons. Often, the nature of the failure can provide a strong clue as to which chunk of code actually failed. So start by testing the following, and mention them in your report:

  • Are you still able to move the mouse?
    • If so, can you interact with the window system? If so, then the xserver hasn't failed, so it's likely to be a keyboard input driver issue
  • Did the keyboard work for a while after booting into X, and then fail? If it didn't work at all, it may be a hardware/driver incompatibility (or maybe an irq conflict) - /var/log/Xorg.0.log, dmesg, and /var/log/syslog will be worth in depth review for keyboard-related error messages.
  • Try Alt-tab or tab to see if the window system responds. If so, then it may be an application or window manager level issue.
  • Does the keyboard "come back" after some time, or after hitting some keys like ctrl repeatedly?
  • Do all the keys fail, or only some of them?
    • Modifier keys (shift, alt, ctrl)?
    • Do numlock, capslock, and scroll cause the keyboard leds to light? If not, then it's probably a kernel issue
  • Try switching to a virtual terminal window (ctrl-alt-f1)
    • Does keyboard input work here? If so, then it is almost certainly an X-specific issue.
    • If not, try using the [http://en.wikipedia.org/wiki/Magic_SysRq_key Magic SysRq key]

      • alt-sysrq-h to see if the kernel is responding to magic sysrq commands
      • Try alt-sysrq-r to switch keyboard from raw mode to XLATE mode
    • Can you switch back to X (ctrl-alt-f7 or f9 typically)?
    • When switching back, does input work again?
  • Try exiting X using ctrl-alt-backspace. If this doesn't work, then the server has likely hung - see directions for troubleshooting X crashes.
  • Do you use a non-US keyboard layout? If so, can you recreate the issue when using a different layout? If not, it may be a keyboard layout specific issue.

Problem involves missing support for some keyboard keys

TODO

Problem involves keyboard generating extra key output

TODO

Problem involves missing support for mouse or touchpad functions

TODO

Problem involves GUI application that crashes with an X error message

Some GUI applications print out an X error message when they crash, which can make it seem like the issue is in Xorg. In fact, while the error may indeed be generated by X code, most of the time it's due to the application making the call incorrectly or under invalid conditions. So these bugs need to be reported against the application, not X.

For GNOME applications, the X error can be caught using the following approach:

   gdk_error_trap_push ();

   /* ... Call the X function which may cause an error here ... */

   /* Flush the X queue to catch errors now. */
   gdk_flush ();
   if (gdk_error_trap_pop ())
     {
       /* ... Handle the error here ... */
     }

To determine the X error, it is useful to have a backtrace that includes both Xorg and GNOME debug symbols. See DebuggingProgramCrash for info on adding ddeb sources to your config. Then install libgtk2.0-0-dbgsym, and other gnome packages with -dbgsym appended.

Problem may be due to prior installs of a binary driver

Try:

 dpkg -l '*fglrx*'

and

 locate fglrx

to see if there is still some proprietary bits around causing problems.

Debugging Memory Issues

X maintains a pool of memory for GUI applications. As a consequence, it will often appear that X is using a lot of memory, when in fact it is one or more applications that are consuming the memory. top may not indicate which application is to blame, but use of xrestop or other X memory display tools may help indicate it.

As a workaround, you can limit the amount of RAM X is allowed to allocate via ulimit -m in your X startup script.

Troubleshooting Common Error Messages

Common Intel Driver Error Messages

   (II) intel(0): [drm] removed 1 reserved context for kernel
   (II) intel(0): [drm] unmapping 8192 bytes of SAREA 0xf89c1000 at 0xb7b65000

These appear only on system shutdown, and generally don't indicate an issue.

   (EE) intel(0): I830 Vblank Pipe Setup Failed 0

This is because the X driver calls the DRM_I915_SET_VBLANK_PIPE ioctl after de-initializing the DRM. It should be harmless.

   (II) AIGLX: Suspending AIGLX clients for VT switch
   Error in I830WaitLpRing(), timeout for 2 seconds

This is a generic error indicating that the GPU locked up. It could be caused by a variety of issues.

X/Debugging (last edited 2016-01-10 22:13:08 by penalvch)