#3590·glances

AMD GPU plugin crashes glances when the card is runtime-suspended (EBUSY not caught)

Author: kwehdenCreated Jun 15, 2026Updated Aug 31, 2026
Labelsneeds discussionplugin/gpualready corrected

Description

The AMD GPU plugin (glances/plugins/gpu/cards/amd.py) crashes glances when the GPU is runtime power-managed and currently suspended. On a discrete AMD card with power/control = auto, the amdgpu driver does not wake the card for sysfs sensor reads — instead it returns OSError(errno 16, EBUSY, "Device or resource busy").

The plugin guards those reads with except PermissionError: only (added in #3125). PermissionError maps to EACCES/EPERM, so EBUSY is not caught, propagates out of the plugin, and takes down the whole UI.

Reproduce

On a machine with a discrete AMD GPU using runtime PM, while the card is idle/suspended:

$ cat /sys/class/drm/card0/device/power/runtime_status
suspended
$ cat /sys/class/drm/card0/device/power/control
auto
$ cat /sys/class/drm/card0/device/gpu_busy_percent
cat: ...gpu_busy_percent: Device or resource busy

Then run glances — it errors out as soon as the GPU plugin samples the suspended card.

Minimal confirmation that it's not PermissionError:

python
>>> open("/sys/class/drm/card0/device/gpu_busy_percent").read()
OSError: [Errno 16] Device or resource busy   # isinstance(e, PermissionError) == False

(Note: mem_info_vram_used/mem_info_vram_total happen to still read fine while suspended; it's gpu_busy_percent in get_proc() and temp*_input in get_temperature() that raise.)

Environment

  • Glances 4.3.3
  • Python 3.14.4, psutil 7.1.0
  • OS: Ubuntu 26.04 LTS
  • Kernel: Linux 7.0.0-22-generic x86_64
  • GPU: AMD Radeon RX 6600 — Navi 23 [1002:73ff] (rev c7)
  • Driver: amdgpu (kernel driver in use: amdgpu), runtime PM enabled (power/control = auto)

Suggested fix

Broaden the exception handling in get_mem(), get_proc(), and get_temperature() from except PermissionError: to except OSError: (PermissionError is a subclass of OSError, so this still covers #3125 while also handling EBUSY from a suspended card). The affected functions can simply return None as they already do — sensors then show as unavailable while the card sleeps and repopulate when it wakes.

diff
-            except PermissionError:
-                # Catch exception (see issue #3125)
+            except OSError:
+                # Catch PermissionError (#3125) and EBUSY from a runtime-suspended GPU
                 return None

Happy to open a PR if useful.