last edited: 2024-06-01 14:26:34 +0000

Here are some common issues that users run into when using gem5, and information on how to fix them on how to fix them.

Segmentation Fault

A segfault error can occur and will output to the terminal like the following:

gem5 has encountered a segmentation fault!


It is important to note that in order to verify that you’re encountering a segfault error, scroll above the back trace output and verify the line gem5 has encountered a segmentation fault! has outputted. The cause of such error is usually the result of an error within your C++ files causing an incorrect address access. The best way to debug segfaults within gem5 is to use gdb, to which we provide documentation here.


A fatal error typically occurs when a simulation configuration is invalid and cannot be processed by the gem5 simulator. The fatal error is preceded by the file that this error came from, which is usually a good indicator of where to look for what went wrong. For example, in the error below, gem5/src/cpu/ would be a good starting point to debug this error.

build/ALL/cpu/ fatal: Number of processes (cpu.workload) (0) assigned to the CPU does not equal number of threads (1).

This type of error can cover situations such as wrong file types or invalid values being passed to gem5, or unconnected ports, just to name a couple examples. This should give you more information on the issue at hand, but if there still isn’t enough information, using some of the debugging techniques within gem5, such as gdb or debug flags may help.


If you encounter a panic error, that usually indicates that something is wrong with gem5 itself. Some of the more common panic errors within gem5 are unrecognized values or unimplemented functions being used. To debug these errors, you can start by looking into the file this error was generated by, which is indicated right before the panic error in your terminal. For example, in the error below, it would be best to start looking at gem5/src/sim/

build/ARM/sim/ panic: assert(_totalPages > 0) failed

This should give you more information on the issue at hand, though similar to fatal errors above, if there still isn’t enough information, using some of the debugging techniques within gem5 may help.

Python Script Errors

For any type of Python error, such as an AttributeError or OSError, it is best to start out by looking below the error message, where you should see a trace output. The first file and line number should indicate where the error occurred. For example, with the error below, you should start by looking to build/ARM/python/m5/, and if that doesn’t give enough information, move onto configs/example/gem5_library/

AttributeError: Class PrivateL1PrivateL2CacheHierarchy has no parameter l1_size

  build/ARM/python/m5/ __setattr__
  configs/example/gem5_library/ <module>
  build/ARM/python/m5/ main

Similarly, if you receive a trace back error as shown below, you’ll also want to refer to the very bottom of the output to get an idea as to where to start debugging. In this IOError example, you’d first want to look towards gem5/configs/common/

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/gem5/src/python/m5/", line 389, in main
exec filecode in scope
File "./configs/example/", line 327, in <module>
test_sys = build_test_system(np)
File "./configs/example/", line 96, in build_test_system
options.ruby, cmdline=cmdline)
File "/opt/gem5/configs/common/", line 580, in
makeX86System(mem_mode, numCPUs, mdesc, self, Ruby)
File "/opt/gem5/configs/common/", line 506, in makeX86System
File "/opt/gem5/configs/common/", line 45, in disk
return searchpath(disk.path, filename)
File "/opt/gem5/configs/common/", line 41, in searchpath
raise IOError, "Can't find file '%s' on path." % filename
IOError: Can't find file 'linux-bigswap2.img' on path.

Looking within this file should give you more information to help debug, though if this isn’t enough, you can look here to enable trace based debugging for further information.


If you’re running into errors when pushing code to the develop branch, one potential issue is that you may not be passing the precommit checks that gem5 requires before any changes are submitted. If you see within Gerrit that you have the following error on your verified check, you can navigate to the logs that were output by the tests.

Kokoro presubmit build finished with status: FAILURE

If the output in these logs contains anything like the line below, you need to verify that your changes match the coding style within gem5.

trim trailing whitespace.................................................Failed

In order to ensure your code passes these checks, you should install and run precommit on your changes. You can install it by running the lines below.

pip install pre-commit
pre-commit install

Additionally, you could instead run util/ to set it up. From here, pre-commit will always run whenever you use git commit. However, if you’ve already committed these files, you can manually check that pre-commit still passes by running pre-commit run --files <files to format> to check specific files, pre-commit run --all-files for testing the entire directory, or pre-commit run <hook_id> for individual hooks. When running these commands, pre-commit will both detect any style issues, and automatically reformat the files for you.


If you’re running into issues getting you continuous integration tests to pass on GitHub, you may be forgetting to add a Change-Id to your commit message. Though we have migrated away from using Gerrit, we still require the addition of a Change-Id. In order to amend your commit and have all our checks pass, you must install the commit message hook from Gerrit. You can install and update your commit by running the following commands below.

n f=.git/hooks/commit-msg ; mkdir -p  ;  curl -Lo ; chmod +x
git commit --amend --no-edit

If you want more information on the commit message hook, read here, and if you want to know more about Change-Ids, look here

Further Issues

If you continue to run into errors using gem5, feel free to ask for help. In addition, you can find information on how to report errors that may potentially need fixes here if other channels don’t cover all the information you need.