systool Command in Linux



The Linux systool command is a powerful utility that allows users to extract detailed information about system devices by accessing the SysFS (System File System) interface in Linux. It is particularly useful for system administrators and developers who need insights into the hardware and drivers of their systems without manually navigating the filesystem.

Table of Contents

Here is a comprehensive guide to the options available with the systool command −

Understanding systool Command

The systool command in Linux is a powerful utility that provides detailed information about system devices, drivers, and modules. It is part of the sysfsutils package and interacts with the SysFS filesystem to retrieve structured data about hardware components. This command is particularly useful for system administrators and developers who need to inspect device attributes, understand driver relationships, and troubleshoot hardware issues.

By leveraging systool, users can access information that would otherwise require navigating multiple directories within /sys, making it a convenient tool for system analysis and debugging.

Why Use systool?

The systool command is part of the sysfsutils package, which provides an interface to the SysFS virtual filesystem. SysFS is a kernel feature that exposes system hardware information in a structured manner.

  • Hardware Diagnostics − Helps identify hardware components and their attributes.
  • Driver Management − Displays information about device drivers.
  • System Optimization − Allows users to fine-tune hardware configurations.
  • Troubleshooting − Assists in debugging hardware-related issues.

Installing of systool Command in Linux

Most Linux distributions do not include systool by default. To install it −

For Debian-based systems −

sudo apt update && sudo apt install sysfsutils
systool Command in Linux1

For Red Hat-based systems −

sudo yum install sysfsutils

Verify installation −

systool --version

Additionally, systool can be used to inspect kernel modules with the -m option, allowing users to retrieve information about specific modules loaded in the system

Syntax of systool Command in Linux

systool [options] [device]

systool Command Options

  • -a − Show attributes of the requested resource.
  • -b bus − Show information for a specific bus (e.g., PCI, USB).
  • -c class − Show information for a specific class (e.g., block, net).
  • -d − Show only devices.
  • -h − Show usage information.
  • -m module_name − Show information for a specific kernel module.
  • -p − Show absolute SysFS path to the resource.
  • -v − Show all attributes with values.
  • -A attribute − Show attribute value for the requested resource.
  • -D − Show only drivers.
  • -P − Show the device's parent.

How to Use systool Command in Linux?

Overall, systool is an essential command for Linux users who need to interact with system hardware at a granular level. Whether it's for troubleshooting, performance tuning, or general system exploration, systool simplifies the process of accessing detailed device information. Its ability to provide structured output makes it a preferred choice over manually browsing the /sys filesystem. While its availability may depend on the Linux distribution and kernel version, it remains a valuable tool for those managing Linux-based systems

Listing All Attributes of Devices on a Bus

To view all attributes of devices connected via the PCI bus −

systool -b pci -v
systool Command in Linux2

Explanation

  • -b pci − Specifies the bus type (PCI).
  • -v − Enables verbose mode, displaying detailed attributes.

This output provides detailed information about PCI-connected devices, including class, vendor, model, and driver.

Listing All Attributes of a Class of Devices

To view attributes of block devices (e.g., hard drives, SSDs) −

systool -c block -v
systool Command in Linux3

Explanation

  • -c block − Specifies the device class (block devices).
  • -v − Enables verbose mode.

This output helps monitor storage devices, including size, model, and vendor.

Displaying Only Device Drivers of a Bus

To list USB device drivers −

systool -b usb -D
systool Command in Linux4

Explanation

  • -b usb − Specifies the bus type (USB).
  • -D − Displays only device drivers.

This output is useful for debugging driver-related issues.

Showing Information About a Specific Kernel Module

To view details of the network driver module −

systool -m e1000 -v
systool Command in Linux5

Explanation

  • -m e1000 − Specifies the kernel module (e1000 network driver).
  • -v − Enables verbose mode.

This output helps verify driver versions and authorship.

Displaying the Parent Device of a Specific Device

To find the parent device of a USB device −

systool -P /sys/class/usb_device
systool Command in Linux6

Explanation

  • -P − Displays the parent device.

This output helps trace device dependencies.

Troubleshooting for systool Command Issues

Another useful feature of systool is its ability to display only device drivers associated with a specific bus. By running systool -b usb -D, users can see a list of drivers managing USB devices, which is particularly helpful when debugging driver-related problems

Issue 1 − systool Command Not Found

Solution − Ensure sysfsutils is installed −

sudo apt install sysfsutils

Issue 2 − No Output for a Specific Bus or Class

Solution − Verify available buses −

ls /sys/bus
systool Command in Linux7

Verify available classes −

ls /sys/class
systool Command in Linux8

Issue 3 − Incorrect Module Name

Solution − List loaded modules −

lsmod
systool Command in Linux9

Use the correct module name.

Security Considerations of systool Command

Restricting Access to systool − Ensure only authorized users can access hardware information −

chmod 700 /usr/bin/systool

Monitoring Unauthorized Hardware Changes − Regularly check for unexpected hardware modifications.

systool -b pci -v grep "Unknown"

Conclusion

The systool command is a powerful utility for extracting detailed system device information in Linux. Whether diagnosing hardware issues, managing drivers, or optimizing system configurations, systool provides valuable insights.

One of the primary functions of systool is to list attributes of devices based on their bus or class. For example, using systool -b pci -v allows users to view all attributes of devices connected via the PCI bus, including vendor details, device models, and associated drivers. Similarly, systool -c block -v provides insights into block devices such as hard drives and USB storage, displaying attributes like size, model, and vendor. This level of detail is invaluable for diagnosing hardware compatibility issues, optimizing system configurations, and ensuring proper driver installations.

Advertisements