Don Quijote de la Mancha -Miguel de Cervantes-



Update, Upgrade and Clean a Debian-based Linux system at boot

To automatically update, upgrade and clean a Debian-based Linux system at boot, you can create a systemd service file with the following steps:

Thank you for reading this post, don't forget to subscribe!

  1. Open a terminal and switch to the root user by running the command sudo su.
  2. Create a new systemd service file by running the command nano /etc/systemd/system/update-debian.service.
  3. In the nano text editor, add the following lines to the service file:
[Unit] Description=Update Debian at boot
ExecStart=/usr/bin/apt update && /usr/bin/apt upgrade -y && /usr/bin/apt autoremove -y && /usr/bin/apt autoclean -y
  1. Save the file and exit the editor by pressing Ctrl+X, then Y, then Enter.
  2. Reload the systemd daemon by running the command systemctl daemon-reload.
  3. Enable the new service to run at boot by running the command systemctl enable update-debian.service.

Now, whenever the system boots up, the update-debian service will automatically update, upgrade, and clean up the system using the apt package manager.

Note: Make sure that the system is connected to the internet at boot time to ensure that the updates can be downloaded and installed successfully.

How useful was this post?

Click on a star to rate it!

Average rating 2 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!


Enjoy this blog? Please spread the word :)