← Back to list

How to Automatically Update Flatpak Apps with systemd and Logs

If you’re like me, tired of manually running flatpak update and confirming updates every time, you can automate it using systemd timers.

Sazid · 2025-08-12 17:08 · 0 claps · 1.8 min read
#flatpak #systemd
Open on Medium ↗
Wiki topics: 🏃 · Running & Endurance

How to Automatically Update Flatpak Apps with systemd and Logs

If you’re like me, tired of manually running flatpak update and confirming updates every time, you can automate it using systemd timers.

This guide will set up a daily Flatpak updater that also runs shortly after boot and logs all update results for later review.

1. Create the systemd service

The service will run the Flatpak update command and write output to a log file.

sudo vim /etc/systemd/system/flatpak-update.service

Paste:

[Unit]
Description=Update all Flatpak apps and log the results
[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak update -y --noninteractive
StandardOutput=append:/var/log/flatpak-update.log
StandardError=append:/var/log/flatpak-update.log

2. Create the systemd Timer

This timer will run the service:

  • 5 minutes after boot
  • Once every 24 hours
  • Catching up if your PC was off during the scheduled time
sudo vim /etc/systemd/system/flatpak-update.timer

Paste:

[Unit]
Description=Run Flatpak updates daily and at boot
[Timer]
OnBootSec=5min
OnUnitActiveSec=1d
Persistent=true
[Install]
WantedBy=timers.target

3. Prepare the Log File

Create the log file and make it readable by all users:

sudo touch /var/log/flatpak-update.log
sudo chmod 644 /var/log/flatpak-update.log

4. Enable and Start the Timer

Reload systemd and activate the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now flatpak-update.timer

5. Viewing the Logs

You can check what was updated by running:

cat /var/log/flatpak-update.log

Example output:

Looking for updates…
Info: org.mozilla.firefox updated from 121.0 to 121.0.1
Info: org.libreoffice.LibreOffice updated from 7.6.3 to 7.6.4
Updates complete.

6. (Optional) Rotate the Logs Monthly

To prevent the log file from growing too large, add a logrotate config:

sudo vim /etc/logrotate.d/flatpak-update

Paste:

/var/log/flatpak-update.log {
    monthly
    rotate 12
    compress
    missingok
    notifempty
}

This will:

  • Rotate the log monthly
  • Keep the last 12 months of logs
  • Compress old logs to save space

7. Troubleshooting

If the updates or logs don’t seem to be working, try these steps:

Check if the timer is active:

systemctl list-timers | grep flatpak-update

If you don’t see it, start it manually:

sudo systemctl enable --now flatpak-update.timer

Run the service manually to test:

sudo systemctl start flatpak-update.service

Then check:

cat /var/log/flatpak-update.log

View recent logs for errors:

journalctl -u flatpak-update.service --no-pager

Make sure Flatpak is installed and working:

flatpak --version

If this fails, install it via your package manager (e.g., sudo apt install flatpak or sudo dnf install flatpak).

Done!

From now on:

  • Flatpak updates run automatically after boot and daily
  • No prompts or confirmations needed
  • All update results are stored in /var/log/flatpak-update.log

You’ll never have to think about manually updating Flatpak again.


메타데이터
post_id
5cb05ee63bb1
slug
how-to-automatically-update-flatpak-apps-with-systemd-and-logs-5cb05ee63bb1
url
https://medium.com/@schlafer/how-to-automatically-update-flatpak-apps-with-systemd-and-logs-5cb05ee63bb1
canonical_url
https://medium.com/@schlafer/how-to-automatically-update-flatpak-apps-with-systemd-and-logs-5cb05ee63bb1
author_url
https://medium.com/@schlafer
status
ok
fetched_at
2026-07-17 04:06:05