saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
13.98k stars 5.47k forks source link

[BUG] The "status.diskusage" function sometimes crashes in some distros #66646

Open meaksh opened 1 week ago

meaksh commented 1 week ago

Description

When running the status.diskusage function, it sometimes crashes, as stats cannot be obtained for some of the mounted paths. I see this happening for /proc/sys/fs/binfmt_misc which is created by systemd proc-sys-fs-binfmt_misc.automount:

# mount | grep binfmt
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1708)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

# salt-call --local status.diskusage
The minion function caused an exception: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/salt/minion.py", line 1918, in _thread_return
    function_name, function_args, executors, opts, data
  File "/usr/lib/python3.6/site-packages/salt/minion.py", line 1876, in _execute_job_function
    return_data = self.executors[fname](opts, data, func, args, kwargs)                                                                                                                         File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__                                                                                                              return self.loader.run(run_func, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1234, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run                                   
    return callable(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1249, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/executors/direct_call.py", line 10, in execute
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1234, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
    return callable(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1249, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/modules/status.py", line 1056, in diskusage
    fsstats = os.statvfs(path)
OSError: [Errno 19] No such device: '/proc/sys/fs/binfmt_misc'

Setup Please be as specific as possible and give set-up details.