|
| 1 | +# Troubleshooting badly behaving apps |
| 2 | + |
| 3 | +Despite the best efforts of Void Linux maintainers, it is possible that you will |
| 4 | +have issues with packages from the official repositories. On such cases, there |
| 5 | +are some steps to follow in order to provide as complete a bug report as |
| 6 | +possible. |
| 7 | + |
| 8 | +Some of these steps can even help you find the cause of the issue yourself! |
| 9 | + |
| 10 | +## Look at error messages attentively THIS NEEDS WORK |
| 11 | + |
| 12 | +Python programs, for example, complain loudly about missing modules and other |
| 13 | +issues like that. If you're using a compiled binary, and it's missing libraries |
| 14 | +for some reason, your dynamic linker should tell you as well. |
| 15 | + |
| 16 | +## Check for issues in the package database |
| 17 | + |
| 18 | +You can use the `-a` flag for |
| 19 | +[xbps-pkgdb(1)](https://man.voidlinux.org/xbps-pkgdb.1) to run a complete check |
| 20 | +on all systems packages, which can detect any files that may have been altered |
| 21 | +when they shouldn't have been. For any of the files listed in this step, you |
| 22 | +should attempt to reinstall them with the `-f` flag for |
| 23 | +[xbps-install(1)](https://man.voidlinux.org/xbps-install.1). An example can be |
| 24 | +seen below: |
| 25 | + |
| 26 | +``` |
| 27 | +# xbps-pkgdb -a |
| 28 | +ERROR: p7zip: hash mismatch for /usr/bin/7z. |
| 29 | +ERROR: p7zip: files check FAILED. |
| 30 | +# xbps-install -f p7zip |
| 31 | +``` |
| 32 | + |
| 33 | +After this is done, check if the issue persists. It should be noted that issues |
| 34 | +like this can indicate hardware issues in your storage media or RAM. |
| 35 | + |
| 36 | +## Strace the program |
| 37 | + |
| 38 | +If the issue is caused by a program, you can run it under the |
| 39 | +[strace(1)](https://man.voidlinux.org/strace.1) utility to check if it's trying, |
| 40 | +for example, to access files that don't exist, and their programmer didn't |
| 41 | +implement a proper fallback or error message. |
| 42 | + |
| 43 | +## Debug the program NEEDS WORK |
| 44 | + |
| 45 | +If a look at `strace` wasn't enough, it may be possible to use the GNU debugger, |
| 46 | +[gdb(1)](https://man.voidlinux.org/gdb.1), to step through the program's |
| 47 | +execution. You can [install debug packages](../xbps/repositories/index.md) or |
| 48 | +use Void's [Debuginfod](https://sourceware.org/elfutils/Debuginfod.html) server. |
| 49 | +GDB is especially useful when an application crashes with `SIGABRT` or `SIGSEGV` |
| 50 | +(see [signal(7)](https://man.voidlinux.org/signal.7), since it will stop |
| 51 | +execution at that point and you can print a backtrace showing all the function |
| 52 | +calls that lead to that place. An example using the Debuginfod server is show |
| 53 | +below: |
| 54 | + |
| 55 | +``` |
| 56 | +$ DEBUGINFOD_URLS="https://debugingod.s.voidlinux.org" gdb --args <program> [arguments] |
| 57 | +``` |
| 58 | + |
| 59 | +Inside GDB, some useful commands are: |
| 60 | + |
| 61 | +- `set logging on`, which creates a `gdb.txt` file which can be shared easily; |
| 62 | +- `backtrace`, which shows the function calls made until the application got to |
| 63 | + that place; |
| 64 | +- `info threads`, which shows information about threads in the program; |
| 65 | +- `break <function>`, which puts a breakpoint in a function that you may think |
| 66 | + is suspect. |
0 commit comments