salt.modules.sysfs module

Module for interfacing with SysFS

New in version 2016.3.0.

salt.modules.sysfs.attr(key, value=None)

Access/write a SysFS attribute. If the attribute is a symlink, it's destination is returned

Returns:value or bool
CLI example:
salt '*' sysfs.attr block/sda/queue/logical_block_size

Generate a dictionary with all available interfaces relative to root. Symlinks are not followed.

CLI example:
salt '*' sysfs.interfaces block/bcache0/bcache
Output example:
   "r": [
   "rw": [
   "w": [


  • 'r' interfaces are read-only
  • 'w' interfaces are write-only (e.g. actions)
  • 'rw' are interfaces that can both be read or written, root='')

Read from SysFS

Parameters:key -- file or path in SysFS; if key is a list then root will be prefixed on each key
Returns:the full (tree of) SysFS attributes under key
CLI example:
salt '*' class/net/em1/statistics, full=True)

Return the basename of a SysFS key path

  • key -- the location to resolve within SysFS
  • full -- full path instead of basename

fullpath or basename of path

CLI example:
salt '*' class/ttyS0
salt.modules.sysfs.write(key, value)

Write a SysFS attribute/action

CLI example:
salt '*' sysfs.write devices/system/cpu/cpu0/cpufreq/scaling_governor 'performance'