Home Learn Linux How to enable data collecting for ‘sar -u’ on Linux

How to enable data collecting for ‘sar -u’ on Linux

We'll show you the troubleshooting process for the 'sar -u' error on Linux, providing step-by-step instructions to enable data collecting and ensure that the sysstat utility functions optimally.

by Arun Kumar
enable data collecting for 'sar u' in linux

The ‘sar’ (System Activity Reporter) tool is an essential utility for Linux administrators and users to monitor and analyze system performance. As part of the sysstat package, ‘sar’ provides valuable insights into various aspects of system usage, such as CPU, memory, and network resource utilization.

While ‘sar’ is a powerful tool, users may occasionally encounter issues when attempting to use it. This article aims to guide you through the process of troubleshooting common problems with ‘sar’ on Linux systems, including enabling data collection, verifying the sysstat service status, and reinstalling the sysstat package on a variety of distributions, such as Ubuntu, Debian, CentOS, RHEL, Arch Linux, and openSUSE.

Sometimes when attempting to use ‘sar -u’ to view CPU usage, users may encounter an error stating that data collection is not enabled. In this article, we will discuss the steps needed to resolve this issue and enable data collection on an Linux system.

“Data Collecting Not Enabled” Error Description

When trying to run ‘sar -u’ on a Linux system, the user encounters the following error (this example is on Ubuntu):

fosslinux@Ubuntu-VM:~$ sar -u
Cannot open /var/log/sysstat/sa28: No such file or directory
Please check if data collecting is enabled
data collecting is not enabled error using sar command

Data collection error while using sar command on Ubuntu

This error message indicates that the system activity data required for ‘sar’ is not being collected or stored. To fix this issue, we need to enable data collecting and configure the sysstat package correctly.


1. Install the sysstat package:

The ‘sar’ command is a part of the ‘sysstat’ package, which is not always pre-installed on Linux distributions. Here’s how to install ‘sysstat’ on some popular Linux distributions:

Debian and Ubuntu:

To install ‘sysstat’ on Debian and Ubuntu, open a terminal and run the following command:

sudo apt-get install sysstat

Red Hat, CentOS, and Fedora:

To install ‘sysstat’ on Red Hat-based systems, open a terminal and run the following command:

sudo yum install sysstat

Arch Linux:

To install ‘sysstat’ on Arch Linux, open a terminal and run the following command:

sudo pacman -S sysstat

SUSE and openSUSE:

To install ‘sysstat’ on SUSE and openSUSE, open a terminal and run the following command:

sudo zypper install sysstat

Once you’ve installed ‘sysstat,’ you can use the ‘sar’ command to monitor the system performance.

2. Enable data collecting in the sysstat configuration file:

To enable data collecting, open the ‘/etc/default/sysstat’ configuration file using your preferred text editor:

sudo nano /etc/default/sysstat

Find the following line in the configuration file:


Change the value from “false” to “true”:

enabling data collection

Enabling data collection (Changing “False” to “True”)

Save the changes and exit the text editor.

3. Configure the sysstat data collection interval:

To configure the data collection interval, edit the ‘/etc/cron.d/sysstat’ file:

sudo nano /etc/cron.d/sysstat

By default, the sysstat package collects data every 10 minutes. To change the interval, find the following line:

5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

Replace ‘/10’ with your desired interval (e.g., ‘/5’ for a 5-minute interval):

5-55/5 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
changing data collection interval from 10 minutes to 5 minutes

Changing data collection interval from 10 minutes to 5 minutes

Save the changes and exit the text editor.

4. Restart the sysstat service:

To apply the changes, restart the sysstat service:

sudo systemctl restart sysstat

5. Verify data collecting is enabled:

To check if data collecting is now enabled, run ‘sar -u’ again:

sar -u
successful execution of sar command

Successful execution of sar command

If everything is configured correctly, you should now see the CPU usage statistics without any errors.

Additional troubleshooting tips of sar

1. Verify if ‘sar’ is in the system’s PATH:

Ensure that ‘sar’ is located in one of the directories listed in your system’s PATH environment variable. You can check this by running:

which sar

If the command returns the path to ‘sar’, it is correctly installed. If not, you may need to add the appropriate directory to your PATH or reinstall the sysstat package.

2. Check if the sysstat service is running:

The sysstat service should be running for ‘sar’ to function properly. To check the status of the sysstat service, use the following command:

sudo systemctl status sysstat

If the service is not running, start it with:

sudo systemctl start sysstat

3. Inspect sysstat configuration files for errors:

If you are still experiencing issues, there may be errors or inconsistencies in the sysstat configuration files. Review the following files for any misconfigurations:


Ensure that the ENABLED variable is set to “true” in /etc/default/sysstat. Verify that the cron job in /etc/cron.d/sysstat is set up correctly to run at your desired interval.

4. Check system logs for related issues:

To get more information about potential issues with ‘sar’ or the sysstat service, check the system logs for any related errors or warnings. You can use the following command to view the logs:

sudo journalctl -u sysstat

5. Reinstall the sysstat package:

If you are still encountering issues, consider reinstalling the sysstat package to ensure you have a clean and up-to-date installation. Use your distribution’s package manager to remove and reinstall the package.

For Ubuntu or Debian-based systems:

sudo apt-get remove --purge sysstat
sudo apt-get update
sudo apt-get install sysstat

For CentOS or RHEL-based systems:

sudo yum remove sysstat
sudo yum install sysstat

For Arch Linux:

sudo pacman -Rns sysstat
sudo pacman -Syu
sudo pacman -S sysstat

For openSUSE:

sudo zypper rm sysstat
sudo zypper refresh
sudo zypper in sysstat

By following the troubleshooting tips outlined in this article, you can resolve common issues encountered while using the ‘sar’ tool.


By following the troubleshooting tips and reinstallation instructions provided in this article, you can effectively address and resolve common issues encountered while using the ‘sar’ tool on various Linux distributions, including Ubuntu, Debian, CentOS, RHEL, Arch Linux, and openSUSE. Properly configuring and maintaining the sysstat package will ensure you can consistently monitor your system’s performance and make informed decisions about resource allocation and optimization.

You may also like

Leave a Comment



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us


©2016-2023 FOSS LINUX



“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.