Linux Commands

What is Apt Systemd Daily?

When installing or updating packages on Linux distributions, a pesky common error “Unable to lock the administration directory….. locks /var/lib/dpkg” appears frequently.  This error has been discussed on various help portals and forums. Yet, many users run into this problem again and again, despite applying for these potential methods as following:

  1. Detecting the process that holds a lock to the file and killing the process.
  2. Deleting the locked file to kick off the installation again.

Though these solutions work fine, they may lead to system failure or cause some unwanted problems. In the end, you should find out the “the whys and wherefores” as there may be several reasons, among which the following can be one of the reasons.

“It generally happens when the system uses a particular file throughout the time of pre-programmed periodic OS update, security update, or package update triggered by apt-daily.service.” So in this guide, you will get to know what is systemd daily and how it works in Linux.

What is Apt Systemd Daily?

In Linux distributions, the system is programmed in such a way so it can update the packages itself without an external command. So this task is executed by apt-daily.service, which triggers the system to start apt tasks and scan the packages. This results in the system using some resources periodically and locking some files.

What Does Apt-Daily.Service Do?

  1. It performs automatic installation of services/ packages
  2. Look for the package updates periodically.
  3. Update the package list daily.
  4. Download and install security updates daily.

When Does Apt-Daily.Service Perform Updates?

Unless the user’s period is explicitly not set by the user, it executes the install and update process every day triggered by apt-daily.timer.

You can find the configuration file to make changes on it by running the command:

$ cat /lib/systemd/system/apt-daily.timer

that will give you an output like this:

Description=Daily apt download activities

OnCalendar=*-*-* 6,18:00


The red lines show when it tells the system to run the process, 6 AM and 6 PM. Also, you can check the upgrade service run as well with running the following command:

$ cat /lib/systemd/system/apt-daily-upgrade.timer


The error itself displays that another process locks the directory. Since the system enables the automatic updates (executes apt-get update) every time, it finishes booting so you can get security updates.

Do I Really Need Apt-daily Service?

If you turn off the apt-daily service, the major drawback is you will need to manually check the updates for packages by using the apt command update.  Also, you can set the periodic updates to weekly from daily or set to never. It will direct the system not to attempt automatic updates.

How to Disable Apt-daily Service

Method 1

You can disable it even though you are not comfortable with the command line terminal under the software and updates page.

  • Go to updates and change automatic check for updates to Weekly or Never.
  • Restart the system and it will get disabled.

Method 2

Download a text editor. We will use the nano text editor, which is installed in most of the system. In case your system doesn’t install it, then use the following procedure to do it. You can use the Vi editor as well.

  • Run the command $sudo apt update  first
  • Now, run $sudo apt install nano on Debian/Ubuntu
  • $yum install nano on CentOS/Fedora

Now, we will edit the default configuration file for the unattended-upgrades.

Run this command on the nano editor to fetch the configuration file.

$ sudo nano /etc/apt/apt.conf.d/20auto-upgrades

After executing the command, you will get an output like this

APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1"

You need to change these values as given below:

APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::Unattended-Upgrade "0";

Finally, save the file by pressing CTRL and O then restart the system to make the changes successful.

Final words

We hope you understood everything about what is apt Systemd daily. We have thoroughly discussed how you can disable and modify it using the command line and graphical interface. If you liked this guide, check out our official website as we have uploaded hundreds of informative guides like this one.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.