Skip to content

Linux on Apple ARM - psutil.net_if_stats() - OSError: [Errno 25] Inappropriate ioctl for device (originated from ioctl(SIOCETHTOOL)) #2693

@damies13

Description

@damies13

Summary

  • OS: Linux (debian docker container based on python:3.13.9-slim)
  • Architecture: Apple ARM M4 (Docker running on Apple ARM M4 chip)
  • Psutil version: 7.1.3
  • Python version: python:3.13.9
  • Type: core? (psutil.net_if_stats())

Description

My application uses psutil to get network card stats, I got a report from a user that when running in a docker container on a Mac that uses Apple ARM CPU they get the error OSError: [Errno 25] Inappropriate ioctl for device (originated from ioctl(SIOCETHTOOL)) when my code calls psutil.net_if_stats()

User has confirmed running the same docker container on other hardware (e.g. windows machine with intel cpu) does not produce this error.

I've provided the stack trace that I was given below:

<hostname>  | Exception in thread Thread-452 (updatenetpct):
<hostname>  | Traceback (most recent call last):
<hostname>  |   File "/usr/local/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
<hostname>  |     self.run()
<hostname>  |     ~~~~~~~~^^
<hostname>  |   File "/usr/local/lib/python3.13/threading.py", line 994, in run
<hostname>  |     self._target(*self._args, **self._kwargs)
<hostname>  |     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<hostname>  |   File "/usr/local/lib/python3.13/site-packages/rfswarm_agent/rfswarm_agent.py", line 667, in updatenetpct
<hostname>  |     nicstats = psutil.net_if_stats()
<hostname>  |   File "/usr/local/lib/python3.13/site-packages/psutil/__init__.py", line 2285, in net_if_stats
<hostname>  |     return _psplatform.net_if_stats()
<hostname>  |            ~~~~~~~~~~~~~~~~~~~~~~~~^^
<hostname>  |   File "/usr/local/lib/python3.13/site-packages/psutil/_pslinux.py", line 1044, in net_if_stats
<hostname>  |     duplex, speed = cext.net_if_duplex_speed(name)
<hostname>  |                     ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
<hostname>  | OSError: [Errno 25] Inappropriate ioctl for device (originated from ioctl(SIOCETHTOOL))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions