s-tui fails intermittently with TypeError on fresh Proxmox 9.1 install

aphirst

Member
Jun 13, 2022
8
3
8

System Info​

  • Fresh Proxmox 9.1 installation
  • Motherboard: ASUS H97M PLUS (on latest BIOS)
  • s-tui version: 1.1.6 (from repo)
  • psutil version: 5.9.4 (I think; from repo)

Problem​

s-tui fails randomly with the following error. Sometimes it opens fine, sometimes it crashes - completely unpredictable with the same configuration:
Code:
root@midgard:~# s-tui
Traceback (most recent call last):
  File "/usr/bin/s-tui", line 33, in <module>
    sys.exit(load_entry_point('s-tui==1.1.6', 'console_scripts', 's-tui')())
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 958, in main
    graph_controller = GraphController(args)
  File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 758, in __init__
    possible_sources = self._load_config(args.t_thresh)
  File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 691, in _load_config
    FanSource(),
    ~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/s_tui/sources/fan_source.py", line 48, in __init__
    sensors_dict = psutil.sensors_fans()
  File "/usr/lib/python3/dist-packages/psutil/__init__.py", line 2326, in sensors_fans
    return _psplatform.sensors_fans()
           ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1440, in sensors_fans
    current = int(bcat(base + '_input'))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
When s-tui does load, it seems to work normally without issue.

Steps I've Tried​

  1. Ran sensors-detect - suggested loading coretemp module
  2. Researched motherboard - found that ASUS H97 PLUS requires nct6775 module (sensors-detect doesn't suggest it even with aggressive probing)
  3. Loaded nct6775 module - s-tui opened successfully... but then subsequent runs still failed randomly
  4. Monitored hwmon sysfs - ran watch -n 0.2 "cat /sys/class/hwmon/hwmon*/fan*_input 2>/dev/null" and watch -n 0.2 "ls -l /sys/class/hwmon" to check for intermittent missing files/values, but everything appears stable

Possible Solutions I Haven't Tried Yet​

Based on research, I've found these potential fixes but haven't implemented them (because I had to leave for work):
  1. ACPI kernel parameter - Add acpi_enforce_resources=lax to avoid ACPI locking hardware monitoring registers:
    Bash:
       # In /etc/default/grub:
       GRUB_CMDLINE_LINUX="acpi_enforce_resources=lax"
       # Then: update-grub; reboot
  2. Test psutil directly - Run something like this (might be wrong; I've only had two coffees so far today) to catch the actual failure:
    Python:
       python3 - << 'EOF'
       import psutil, pprint
       for i in range(50):
           try:
               pprint.pp(psutil.sensors_fans())
           except Exception as e:
               print("ERROR:", e)
       EOF
  3. Upgrade psutil via pip - Debian's s-tui (1.1.6) and psutil (5.9.4) are quite old. Newer versions apparently fixed fan parsing bugs, according to github Releases pages. Could try:
    Bash:
       apt install python3-pip
       pip3 install --upgrade psutil --break-system-packages
    I'm wary of actually doing this, for the obvious reason stated in the pip3 flags.

Questions​

  1. Has anyone else experienced intermittent s-tui failures on Proxmox 9.x?
  2. Is the acpi_enforce_resources=lax parameter safe/recommended for ASUS boards with nct6775?
  3. Would upgrading psutil via pip cause any issues with Proxmox's system packages?
Any guidance would be appreciated!
 
Last edited:
I can't help with the actual issue but I'd recommend using pipx if you want to use a newer version rather than breaking system packages. Give this a try
Bash:
apt install pipx
pipx run s-tui
 
Last edited:
Thanks @Impact. I tried that instead - using all the latest versions - but it seems I get the same behaviour. I even rebooted the server into a Linux Mint LiveUSB environment and realised that, in fact, the problem is not exclusive to Proxmox. I will investigate a bit more and then consider making a report further upstream, presumably either with the psutil or s-tui developers.