This service automatically runs distrobox-upgrade --all
once a day to keep all your Distrobox containers up to date.
- A Linux system using systemd
- Distrobox installed and configured
- sudo privileges
-
Create the service file:
sudo vim /etc/systemd/system/distrobox-upgrade.service
Copy and paste the following content:
[Unit] Description=Distrobox Upgrade Service After=network.target [Service] Type=oneshot ExecStart=/usr/bin/distrobox-upgrade --all User=YOUR_USERNAME [Install] WantedBy=multi-user.target
Replace
YOUR_USERNAME
with your actual username. -
Create the timer file:
sudo vim /etc/systemd/system/distrobox-upgrade.timer
Copy and paste the following content:
[Unit] Description=Run Distrobox Upgrade daily [Timer] OnCalendar=daily Persistent=true [Install] WantedBy=timers.target
-
Reload systemd, enable and start the timer:
sudo systemctl daemon-reload sudo systemctl enable distrobox-upgrade.timer sudo systemctl start distrobox-upgrade.timer
To verify that the service is set up correctly:
-
Check the status of the timer:
sudo systemctl status distrobox-upgrade.timer
-
List all timers:
sudo systemctl list-timers
You should see
distrobox-upgrade.timer
in the list.
- To change the frequency of updates, modify the
OnCalendar
value in thedistrobox-upgrade.timer
file. For example, to run weekly instead of daily, useOnCalendar=weekly
. - To run the upgrade at a specific time, use a value like
OnCalendar=*-*-* 02:00:00
(this would run it at 2 AM every day).
-
Check the system logs for any error messages:
journalctl -u distrobox-upgrade.service
-
Ensure that the user specified in the service file has the necessary permissions to run
distrobox-upgrade --all
.
To remove the service:
-
Stop and disable the timer:
sudo systemctl stop distrobox-upgrade.timer sudo systemctl disable distrobox-upgrade.timer
-
Remove the service and timer files:
sudo rm /etc/systemd/system/distrobox-upgrade.service sudo rm /etc/systemd/system/distrobox-upgrade.timer
-
Reload systemd:
sudo systemctl daemon-reload