Automating Daily Updates on Pop!_OS Using systemd Timer

Keeping your Linux system up-to-date is crucial for stability, performance, and especially security.
But running sudo apt update && sudo apt upgrade manually every morning gets repetitive.

Let’s automate it so your Pop!_OS machine updates itself once per day, only on the first boot of the day — not on every restart.


🧠 Goal

We’ll build a lightweight automation that:

  • Runs system and Flatpak updates automatically once per day
  • Ensures updates happen after the network is online
  • Logs everything to journalctl for easy review
  • Works quietly in the background using systemd timers

🧰 Overview

You’ll create three small components:

  1. A Bash script that performs the updates
  2. A systemd service to define how the script runs
  3. A systemd timer to define when it runs (once per day)

🪄 Step 1 — Create the Update Script

File: /usr/local/sbin/daily-update.sh

sudo tee /usr/local/sbin/daily-update.sh >/dev/null <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

# Log everything to the system journal (view with: journalctl -t daily-update)
exec 1> >(logger -t daily-update) 2>&1

export DEBIAN_FRONTEND=noninteractive

# Skip if APT is already running
if pidof apt apt-get >/dev/null; then
  echo "APT already running, skipping update."
  exit 0
fi

# Refresh package lists
apt-get update

# Upgrade packages safely, keeping existing config files
apt-get -o Dpkg::Options::=--force-confdef \
        -o Dpkg::Options::=--force-confold \
        -y dist-upgrade

# Clean out old dependencies
apt-get -y autoremove

# Update Flatpak apps if installed
flatpak update -y || true
EOF

sudo chmod +x /usr/local/sbin/daily-update.sh

🔍 Explanation

LinePurpose
set -euo pipefailExits on any error, undefined variable, or broken pipe
logger -t daily-updateSends logs to journalctl under the tag daily-update
DEBIAN_FRONTEND=noninteractivePrevents interactive prompts during unattended upgrades
apt-get updateFetches the latest package lists
dist-upgradeInstalls all available upgrades, resolving dependencies
autoremoveCleans unused packages automatically
flatpak updateUpdates any Flatpak apps, if present

Check logs anytime with:

journalctl -t daily-update -n 200 --no-pager

⚙️ Step 2 — Create the systemd Service

File: /etc/systemd/system/daily-update.service

[Unit]
Description=Daily system + Flatpak update
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/daily-update.sh
Nice=10
IOSchedulingClass=best-effort
IOSchedulingPriority=7

🧩 What Each Setting Does

  • Wants=network-online.target
    Ensures network is initialized before running (important for APT).
  • After=network-online.target
    Prevents the update from starting too early at boot.
  • Type=oneshot
    Runs once and exits; not a background service.
  • Nice / IOSchedulingClass / IOSchedulingPriority
    Lowers CPU and disk priority so updates don’t slow your desktop.

⏰ Step 3 — Create the Timer

File: /etc/systemd/system/daily-update.timer

[Unit]
Description=Run daily-update once per day

[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true
Unit=daily-update.service

[Install]
WantedBy=timers.target

🔍 Explanation

SettingMeaning
OnCalendar=dailyRuns once every 24 hours
RandomizedDelaySec=1hAdds a random 0–1 hour delay to avoid network congestion
Persistent=trueRuns automatically after next boot if missed
Unit=Tells the timer which service to trigger

🚀 Step 4 — Enable and Test

Reload and enable the timer:

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

Check scheduled timers:

systemctl list-timers | grep daily-update

Run manually (for testing):

sudo systemctl start daily-update.service

View logs:

journalctl -t daily-update -n 50 --no-pager

🧯 Common Error: Permission Denied on Lock File

If you see:

could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

it means the script wasn’t run as root.
Use:

sudo /usr/local/sbin/daily-update.sh

When triggered by systemd, it runs as root automatically.


🧾 Verify It’s Working

  • Show next scheduled run systemctl list-timers --all | grep daily-update
  • View last run systemctl status daily-update.service
  • Check logs for today journalctl -t daily-update --since today

💬 Final Thoughts

This lightweight automation makes your Pop!_OS machine self-maintaining.
It runs quietly once a day, applies updates, and cleans old packages — all while you focus on your work.

For an optional desktop notification, add this to the end of your script:

notify-send "Daily Update" "System packages and Flatpaks are up to date!"

That’s it — your Pop!_OS now keeps itself secure and current every day ✨


Written and tested on Pop!_OS 22.04 LTS (Ubuntu base). Works on any systemd-based distro: Ubuntu, Debian, Fedora, etc.

Time Management

Summary of Time Management Resources

Time is a finite resource — you can’t create more of it or change when things are due. However, you can manage how you use the time you have by planning effectively and utilizing certain resources. Here are three key resources to help manage your time effectively:

  1. Time and Place to Yourself:
    • It’s essential to have some quiet time for yourself to think and plan, but this doesn’t have to be a specific or glamorous time slot. It can be any time you find throughout your day — such as early in the morning before others wake up, during a lunch break, or even while in the shower. The goal is to use this time to focus on what needs to be done and plan your day accordingly.
    • This dedicated time should not add stress; it should fit your needs and help you concentrate on managing your time accurately.
  2. Recording Tools:
    • Use simple tools like pen and paper to jot down your thoughts, tasks, and plans. This could be done on any available paper (an old receipt, envelope, or a blank sheet) and doesn’t need to be fancy.
    • Writing by hand is recommended as it involves more of your senses, helps reduce stress, and improves your focus and memory retention. It allows for a deeper understanding and better engagement with the subject matter.
  3. Tracking Tools:
    • While pen and paper are useful for initial brainstorming and listing tasks, you’ll need a more permanent solution to track your time effectively. Consider using a paper calendar, an online calendar, or a digital tool like a spreadsheet.
    • Tools such as Google Calendar, Microsoft Excel, or bullet journals help keep track of your time in more detail, allowing you to monitor your schedule down to the hour or day.

Key Concepts in Time Management

Time management involves two main factors: control and organization. However, not every aspect of your life can be fully controlled. For example, while you can’t control unexpected events or conflicts, you can manage how you respond to them. By using the resources above, you gain better control over how you allocate your time, helping you become more organized and prepared to handle daily tasks and unforeseen challenges.

Managing Your Time Effectively

To manage your time effectively, you need to treat it as a valuable resource, much like money. Keeping track of your time involves using tools and strategies to understand where your time goes and how to use it more wisely. Here are key steps to help you manage your time:

  1. Take an Inventory of Your Time:
    • Start by writing down all the activities you do daily and how much time you spend on each. Use pen and paper if possible, as this method is more engaging and easier to reflect upon. As you get better at this, you can expand to include weekly and monthly activities.
  2. Analyze Your Time Inventory for Peak Energy Levels:
    • Look at your time inventory to identify when you are most productive — your peak daily energy levels. This could be in the morning, late at night, or any specific time when you feel you accomplish the most. Use this information to determine the best times to schedule your most important tasks.
  3. Prioritize Self-Care:
    • Schedule time for self-care before any other tasks. Taking care of yourself is crucial to maintaining your productivity and effectiveness. Start by dedicating at least an hour a day for self-care activities. Resist the urge to put work before your well-being, which often comes from a perfectionist mindset. Embracing a “good enough” mindset helps reduce stress and avoids burnout.
  4. Evaluate and Prioritize Remaining Tasks:
    • Assess each task to determine its urgency and importance. Reorganize your list of tasks, prioritizing them based on their significance and any dependencies. Make sure to address tasks that could alleviate other deadlines first.
    • Identify Tasks Within Your Capacity: Recognize that you only have limited time and energy each day. Determine which tasks are realistic to complete within your available time.
    • Eliminate or Delegate Nonessential Tasks: Say “no” to tasks that are not essential or have low priority. Delegate tasks when possible, such as asking a coworker for help or outsourcing minor duties. This allows you to focus on what is most important.
  5. Schedule Tasks Based on Priority and Peak Energy Levels:
    • Plan your schedule according to the priority of tasks, the time available, and your peak energy periods. Important tasks should be scheduled during your most productive times to ensure they are completed effectively. Use your understanding of your strengths and energy patterns to optimize your daily schedule.

Benefits of an Anti-Perfectionism Mindset

  • Reduces Stress and Anxiety: Letting go of perfectionism helps reduce the stress and pressure to always perform flawlessly.
  • Encourages Flexibility: An anti-perfectionist or “good enough” mindset allows you to adapt more easily to changes and setbacks.
  • Improves Productivity: By focusing on what’s essential and embracing a good enough approach, you can complete tasks more efficiently without getting bogged down by unnecessary details.
  • Supports Well-being: Prioritizing self-care and avoiding burnout leads to a healthier work-life balance.

Here’s a suggested chart format to help you organize your daily, weekly, and monthly tasks, along with your analysis of peak energy levels. This format is divided into different sections to capture the activities you currently do, the activities you wish to do but don’t have time for, and your peak energy times.

1. Daily Activities and Time Tracking

ActivityTime Spent (hours/minutes)Notes
Morning routine1.15 hourwake up at 6.30 – 7.45
Commuting1.5 hours7.45 to 8.30 / 5.00 – 5.45
Work (tasks or meetings)8 hours8.30 – 5.00
Lunch break30 minutes1 PM – 1.30 PM
Exercise45 minutes6.30 PM to 7.15 PM
Evening relaxation (TV, etc.)1 hour7.30 PM to 8.30 PM
Dinner45 min8.30 – 9.15 PM
Household chores15 min9-15 -9.30 PM
Research & Reading1 hour9.30 – 10.30
Sleep8 hours10.30 – 6.30
Total Time Spent

Unscheduled Daily Activities (Want to Do but No Time)

ActivityTime Needed (hours/minutes)Priority Level
Go to the gym
Watch a favorite show
Meditate

2. Weekly Activities and Time Tracking

ActivityEstimated Time (hours/minutes)Notes
Grocery shopping
Cleaning/household tasks
Socializing with friends
Hobbies (e.g., painting, music)
Self-care (e.g., spa, massage)
Total Time Spent

Unscheduled Weekly Activities (Want to Do but No Time)

ActivityTime Needed (hours/minutes)Priority Level
Weekly massage
Long hike
Attend a workshop