DistroNews

The week in Linux, gathered from the distributions' own feeds

Fedora Magazine

How a missing build flag made btop crash on Fedora with AMD GPUs

fedoramagazine.org

Image from the original story at fedoramagazine.org.

Key points

A Fedora Magazine article traces a startup crash of btop on Fedora systems with AMD GPUs to the rocm-smi package. The package was built without NDEBUG, so a debug assertion inside the library aborted the whole process. A one-line spec change fixes it and is now in stable updates for Fedora 44 and 45.

Versions

  • Fixed builds: rocm-smi 7.1.1-4 or later on Fedora 44, 7.2.1-4 or later on Fedora 45.
  • The Fedora 45 update went stable on October 6 and the Fedora 44 update on October 7.
  • The same crash was reported on Fedora 39 (February 2024), Fedora 43 (November 2025) and Fedora 44 (July 2026).

Who is affected

  • Fedora users with AMD GPUs running btop, which reads GPU data through the ROCm SMI library.
  • The crash showed up as an assertion failure in src/rocm_smi.cc followed by a core dump.
  • It is common on APUs. On these systems the kernel may write an unindexed extra line (e.g. 1066Mhz *) to pp_dpm_mclk when the current memory clock matches no defined level. The kernel has done this deliberately since a 2020 commit.
  • The same btop version did not crash on Ubuntu or Arch with the same GPU.

Cause

  • The library's parser cannot read that extra line. get_multiplier_from_str gets an empty unit and reaches a default branch that runs assert(false) before throwing an exception.
  • With NDEBUG defined, the assert is compiled out. The exception is then caught and returned as an error code, and btop logs a warning and keeps running.
  • Fedora's %cmake macro sets CMAKE_CXX_FLAGS_RELEASE="-DNDEBUG", but neither the macro nor the rocm-smi spec sets CMAKE_BUILD_TYPE, so CMake never applies that flag.
  • A Rawhide build with the original spec showed 0 of 34 compile lines carrying -DNDEBUG.
  • AMD's packages and Arch build with -DCMAKE_BUILD_TYPE=Release, which is why the crash was specific to Fedora.

The fix

  • Switching to a Release build type stopped the crash but broke packaging. Upstream strips the library in Release, which left debugsourcefiles.list empty.
  • The merged change instead adds export CXXFLAGS="%{build_cxxflags} -DNDEBUG" in %build, before %cmake.
  • The pull request was opened on 2026-07-28 and went unreviewed for about eight weeks.
  • It was merged on 2026-09-24 by maintainer Tom Rix, the day after a direct email to him.
  • After updating, the GPU clock may briefly vanish from the btop display, because the parser itself is still unfixed.

Check your system

rpm -q rocm-smi
cat /sys/class/drm/card*/device/pp_dpm_mclk
  • A line without an index in the second output is the format the parser still cannot handle.

Tracing a similar crash

  • Inspect the crash with systemd's tools, find the first library function in the backtrace outside the program, and identify its package:
coredumpctl list btop
coredumpctl info btop
rpm -qf /usr/lib64/librocm_smi64.so*
  • Where ABRT handles crashes, coredumpctl may show nothing. ABRT's report contains the same backtrace.
  • Search Bugzilla for the function name. If nothing turns up, clone the package, do a mock build and count compile lines carrying the flag:
fedpkg clone -a rocm-smi
cd rocm-smi
fedpkg mockbuild
grep '/usr/bin/g++' results_rocm-smi/*/*/build.log | grep -c DNDEBUG
  • After changing the spec, confirm the debug packages are still produced. Then fork on src.fedoraproject.org, open a pull request against Rawhide and link it in Bugzilla.
  • Contributors who are not packagers cannot push to dist-git over SSH. They need HTTPS with an OIDC token, or the fork's web editor.
  • If a pull request stalls and the maintainer is active, a short direct email can unblock it.

Still open

  • Upstream issue #231 in rocm_smi_lib, about the parser, remains open.
  • In June 2026 the same assert was reported on IBM Power machines, so the parser problem is not limited to Fedora or to APUs.
  • The author notes using AI to help read the C++ code and suggest tests. The author ran the tests and wrote the fix.

Summary by DistroNews, based on the original post.

In July 2026, I opened btop on my Fedora 44 machine and the program died before drawing the first screen. The terminal returned this line:

btop: src/rocm_smi.cc:136: uint64_t get_multiplier_from_str(char): Assertion `false' failed.
Aborted (core dumped)

This article tells the story about how an ordinary user carried a fix into Fedora, and how you can do the same.

If you haven't used it, btop is a terminal resource monitor. It reads GPU information through the ROCm SMI library (packaged in Fedora as rocm-smi), which exposes data from the amdgpu driver. The error came from inside that library, not from btop, and the message made that clear. The strangest part: the same version of btop worked fine on Ubuntu and Arch with the same GPU.

Almost three months passed between my first crash and the stable update reaching users. The pull request sat unreviewed for almost eight weeks. Along the way, I found a two-year-old report closed as “not a bug,” a build flag that nobody was defining, and a direct email that finally unblocked the process.

A two-year-old bug, closed as NOTABUG

In February 2024, Jerry James installed btop on Fedora 39 and hit the same crash on first run. The automatic report from ABRT (Fedora’s tool for capturing program crashes) pointed to rocm-smi. In Bugzilla, he identified the exact function: freq_string_to_int was receiving a line from sysfs that it could not parse.

Two things are worth explaining here. sysfs is the kernel’s virtual filesystem, where each file under /sys exposes a piece of the hardware state. An assert is a check used during development. If the tested condition is false, the program aborts immediately instead of continuing with an invalid state.

Tom Rix, from AMD, replied in Bugzilla arguing that if sysfs was malformed, the problem was in the kernel. Jerry posted the contents of the file and pointed to the kernel code that prints that format on purpose. This information was added in a 2020 commit. It was not a formatting error: it was a case the rocm-smi parser did not know how to read. The discussion stalled and in November 2024 the report was closed as NOTABUG, near the end of life of Fedora 39.

Two parties, each certain the problem was on the other side.

The bug returns, and where I come in

On November 28, 2025, Russell Odom opened a new report on Fedora 43. Jerry returned to the case, disagreed with the NOTABUG, and took the problem upstream, opening issue #231 in the rocm_smi_lib repository.

In July 2026, I hit the same crash on Fedora 44 and published my analysis in Bugzilla. The conclusion: these were two independent problems.

The first, already tracked upstream, was the parser that did not understand the line. The second, and the real cause of the abort, was in Fedora’s packaging. Nobody replied to my comment.

The four-link chain

To understand the crash, it helps to follow the data’s path from the kernel to btop. There are four links.

First link: the kernel prints an unusual format. btop asks for the GPU memory frequency, and the library reads the file /sys/class/drm/card0/device/pp_dpm_mclk. The normal format is a list of levels, with the current one marked with an asterisk:

0: 400Mhz
1: 1067Mhz *

When the current frequency does not match any defined level, the kernel prints an extra line without an index, on purpose, since the 2020 commit. This is common on APUs, AMD processors with integrated graphics:

2: 400Mhz
3: 1067Mhz
   1066Mhz *

Second link: the parser does not understand that line. When splitting the number from the unit, the unit string ends up empty, and the get_multiplier_from_str function receives a null character. It falls into the default case, which is:

assert(false);
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_DATA, ...);

Third link: the assert. This is where a build flag called NDEBUG comes in. When it is defined, every assert() compiles to nothing. When it is not, they stay active.

Fourth link: the Fedora package never defined NDEBUG. The result: the assert fired, called abort(), and the whole process died. btop did not receive an error code; it was taken down together with the library.

The upstream intent is clear: with NDEBUG, the assert disappears, the throw runs, the library’s public functions catch the exception, and they return an error code. btop logs a warning and keeps running. If the assert were meant to stay active in production, the throw right after it would be dead code.

Why the problem was Fedora-specific

Fedora’s %cmake macro defines CMAKE_CXX_FLAGS_RELEASE="-DNDEBUG", but it does not define CMAKE_BUILD_TYPE, and the rocm-smi spec does not either. CMake only adds per-configuration flags such as CMAKE_CXX_FLAGS_RELEASE when CMAKE_BUILD_TYPE selects that configuration. Without a build type, the flag is defined and never used.

The proof came from a measurement. In September 2026, I took the case to the devel@ list after five weeks without a review on the pull request. Florian Weimer, from Red Hat, asked whether NDEBUG shouldn’t already be active, since %cmake defines the Release flag. I replied by measuring: on Rawhide, with the original spec, 0 out of 34 compile lines had -DNDEBUG.

AMD’s own packages and Arch’s build use -DCMAKE_BUILD_TYPE=Release. That is why the abort was specific to Fedora.

The one-line fix

My first attempt was to use CMAKE_BUILD_TYPE=Release. It compiled and fixed the crash, but the build failed with Empty %files file debugsourcefiles.list. The reason: the upstream CMakeLists.txt has a rule that, only in Release, runs strip on the library right after linking. Without the symbols, Fedora cannot generate the debug source package.

The solution was to inject NDEBUG through the compile flags, without touching the build type:

%build
export CXXFLAGS="%{build_cxxflags} -DNDEBUG"
%cmake \

That one line was the whole fix.

From pull request to stable update

Opening the PR in dist-git, the Fedora repository that holds the spec and patches for each package, was not the easy part. I spent hours trying to push over SSH before discovering that non-packagers need to use HTTPS with an OIDC token or the fork’s web editor. The path to users was even longer:

  • 2026-07-28: PR opened against Rawhide, tested in mock, with debuginfo and debugsource intact.
  • 2026-09-01: rebased onto the updated Rawhide, tested again.
  • 2026-09-10: email to devel@ asking for review.
  • 2026-09-11: reply to Florian with the measurement. Then silence again.
  • 2026-09-20: Tom updated the package to 10.0, and my PR conflicted again. I realized he was active; he just wasn’t seeing dist-git PRs.
  • 2026-09-23: direct email to him. Reply the same day.
  • 2026-09-24: I rebased, and Tom merged it the same day.

After the merge, Tom Rix submitted the updates in Bodhi, Fedora’s update system, which moves builds from testing to stable. The Fedora 45 update became stable on October 6; the Fedora 44 update became stable on October 7. I tested the F44 update and gave it a +1, which brought it to the minimum karma.

On October 8, I confirmed in Bugzilla: on my Ryzen 5 5600G, btop, which used to crash on startup, now runs with GPU monitoring, including under load.

Check your system

If you use Fedora 44 or 45 with an AMD GPU, you can verify whether the fix is on your system:

rpm -q rocm-smi

The minimum version is 7.1.1-4 on F44 and 7.2.1-4 on F45. To see the sysfs format that caused the crash:

cat /sys/class/drm/card*/device/pp_dpm_mclk

If a line without an index appears, such as 1066Mhz *, that is the case the parser still does not handle. With the patch, btop no longer crashes, but the GPU clock may briefly disappear from the screen until the parser is fixed upstream.

How to do the same

If you run into a similar crash, here is the path.

Start with systemd’s crash log:

coredumpctl list btop
coredumpctl info btop

The second command shows the signal (SIGABRT, in my case) and the backtrace. (On systems where ABRT handles crashes, coredumpctl may show nothing; ABRT’s report has the same backtrace.) Look for the first function outside the program that crashed. In my case, get_multiplier_from_str was in librocm_smi64. Find out which package it comes from:

rpm -qf /usr/lib64/librocm_smi64.so*

The answer was rocm-smi. Before investigating further, search Bugzilla for the function name: someone may have seen the problem already. If not, clone the package and run a test build:

fedpkg clone -a rocm-smi
cd rocm-smi
fedpkg mockbuild

The mock build writes its log to results_rocm-smi/<version>/<release>/build.log. Search it for the compile lines and count how many carry the flag:

grep '/usr/bin/g++' results_rocm-smi/*/*/build.log | grep -c DNDEBUG

If the number is zero, as it was for me, you have found the packaging link. Test the spec change and check that the debug packages are still generated. Then fork the repository on src.fedoraproject.org, create a branch, open the PR against Rawhide, and link it in Bugzilla.

If the PR sits idle, check whether the maintainer is active on the package. If they are, write to them directly. Keep it short: the link, one line of context, and an offer to do the work. That email, on September 23, is what unblocked mine.

What remains open

The upstream parser is still broken. Issue #231 remains open, and in June 2026 someone else reported the same assert on IBM Power machines, which shows the parser problem is neither Fedora-specific nor APU-specific.

But the main point of this article is not the parser. It is that a shared library should not take down the process that calls it. Kernel, library, and packaging can disagree about the sysfs format for years; the user should not pay for that with a program that crashes on startup.

Jerry James diagnosed the parser side in 2024. My part was spotting the packaging side and fixing it.

AI note

I used AI to help read the C++ code and suggest tests. I ran the tests, confirmed the cause, and made the fix.

By Igor Giamoniano, from Fedora Magazine, reproduced under CC BY-SA 4.0. Formatting is simplified and images in the text are omitted.

Read the original at fedoramagazine.org