# Troubleshooting

Various problems and their solutions are described here. If you encounter a problem not described here, please file a bug.

## Install Script Errors

This section describes different errors that could occur from running the install scripts (i.e. `install.sh` or `install-noconsolehelper.sh`)

### Error: script must be run as the root user

You attempted to run the script as an ordinary, non-root user. You must be the root user to run the install script, as the scripts edit files located in root-owned directories.

Solution: Run the command `su -` to become the root user, or run the script as the root user with `su -c './install.sh'`.

### Error: script must be run with pwd in script dir

Your current working directory must be the `natives/linux/scripts` subdirectory of the OProfile core plug-in; running the script relative from another location will not work.

Solution: Simply follow the steps on Step 1 - Locate the Installation Scripts to find the `natives/linux/scripts` subdirectory of the OProfile core plug-in.

### Error: required binaries do not exist, OProfile not installed?

The OProfile plug-in could not find the `oprofiled` and `opcontrol` binaries. This could mean they are not in their default directory (`/usr/bin`), or they do not exist at all.

Solution: If the binaries are on your system (and in your `PATH`) but not in those directories, you can either remove these checks from the install script or create symlinks in the `/usr/bin` directory. Of course, if the binaries do not exist on your system, then install the `oprofile` package.

### Error: /usr/bin/pkexec does not exist

You ran the `install.sh` script, but `pkexec` which is provided by PolicyKit was not installed on your system. As described in Step 2 - Choose Which Installation Script To Run, if `PolicyKit` is not installed, then you can use the `install-noconsolehelper.sh` script.

Solution: Run the `install-noconsolehelper.sh` script instead.

### install.sh: line 47: opcontrol: Permission denied

The opcontrol wrapper file could not be created. This can occur if the `natives/linux/scripts` subdirectory is located on an NFS mount; the NFS server will not allow the local root user to create files in the directory.

Solution: After seeing the error mentioned run the following commands from the commandline :

    echo '#!/bin/sh' > opcontrol || exit 1
    echo 'exec pkexec /usr/bin/opcontrol ${1+"$@"}' >> opcontrol
    chmod +x ./opcontrol

## No Samples From A Profile

It is possible for a profile run of a program to return no samples, resulting in no `current` session displayed. This is not always indicative of a problem with either OProfile or the profiled program. OProfile is a system-wide profiling tool; hence, other active processes running on your system may overshadow your program. This is particularly true if the profiled program is not CPU intensive.

In addition, the Event you choose (selected through the Events tab, as described in Regular Mode) could cause a profile to return no samples; for example the event BR_CND_MISSP_EXEC will only provide samples if a branch was mispredicted by the processor. Note also that due to the statistical nature of OProfile, profiling is neither deterministic nor consistent; two subsequent runs may output very different results. In some cases, one run can result in no samples, while another run on the same program can result in many samples. The OProfile online documentation has other useful information here.

Solution: The following suggestions could help you generate more samples from a profile run:

- run your program with a larger input
- halt or kill as many other non-essential processes as possible
- reduce the Count in the Event Configuration tab
- launch a profile several times

If you are unsure whether your configuration is working correctly, try profiling the sample project in the Example Project section.

## Log Reader Hangs

If the OProfile daemon log file is too large, the log reader may hang and possibly cause the OProfile plug-in to crash. This occurs when the verbosity option is set to `all`, which results in several hundred MiB of text in the log over several profile runs. If you do require all this data in the log file, do not launch the log reader. Delete or backup the log file before running the log reader again.

## Using PolicyKit with X/VNC

When using an X/VNC viewer, PolicyKit may open the authentication dialog in the wrong display. If using this setup, please make sure to connect your VNC viewer to the main display.