Post

How to update Flatpak apps automatically

cron is not available in Silverblue but systemd Timers can be used instead.
Systemd configuration can be put into ~/.config/systemd/user but you have to create that folder if it does not exist.

1
mkdir -p ~/.config/systemd/user 

First, let's create the timer in a file called flatpak-update.timer. Use OnCalendar=hourly or OnCalendar=daily as you prefer.

1
2
3
4
5
6
7
8
9
[Unit]
Description=Update flatpaks

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

The timer will trigger a service that will actually run the command to update flatpaks. It is specified in another file that’s named similarily (flatpak-update.service):

1
2
3
4
5
[Unit]
Description=Update flatpaks

[Service]
ExecStart=flatpak update --noninteractive

After creating those files, the updated configuration becomes active by running the following command:

1
systemctl daemon-reload --user
1
2
systemctl enable --user flatpak-update.timer
systemctl start --user flatpak-update.timer

The following command should list your new timer now:

1
systemctl list-timers --user

If you want to have a look at the output of the update, run:

1
journalctl --user -u flatpak-update

Warning:

Consider app size when enabling this. Huge apps could be an issue on bad wifi or metered connections. Maybe it also makes sense to disable this again before journeys with bad internet connections.

1
2
systemctl stop --user flatpak-update.timer
systemctl disable --user flatpak-update.timer

source

This post is licensed under CC BY 4.0 by the author.