DEV Community

Cover image for How to configure unattended-upgrades on openSUSE Leap
jdrch
jdrch

Posted on

How to configure unattended-upgrades on openSUSE Leap

Hi friends, welcome to another episode of Shitty Linux Documentation, in which I blog about something whose developers never bothered to fully describe the setup of and no one else in the world could be arsed to write about after they managed to figure out.

I use the term unattended-upgrades in the title not because that package exists or works on openSUSE, but because it's the most functional and reliable automatic update system in the non-Windows world. And no, macOS doesn't count as it doesn't allow you to install OS updates automatically.

So anyway let's get into it:

Step 0: Read the docs

Yeah I hate this step too, but the documentation is minimal and reading it is necessary to understand what follows.

Step 1: Install os-update

# zypper install os-update
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure os-update

Open the /usr/share/os-update/os-update.conf file. If you agree with the settings shown there, skip to the next step.

If you want to change any of the settings, edit the /etc/os-update.conf file to include your desired changed lines only. So, for example, /etc/os-update.conf should contain

#UPDATE_CMD=dup
#REBOOT_CMD=reboot
Enter fullscreen mode Exit fullscreen mode

if those are the /usr/share/os-update/os-update.conf values you want.

Step 3: Configure os-update.timer

If you'd rather just start the service and have os-update set its own schedule, skip to the next step.

This is where you determine when you want os-update to run. Edit /etc/systemd/system/os-update.timer. Customize the content based on this documentation. Mine looks like:

[Unit]
Description="Run os-update daily at 0300 even if machine was offline for previous attempt"

[Timer]
OnCalendar=Mon..Sun *-*-* 03:00:00
Persistent=true
Enter fullscreen mode Exit fullscreen mode

Step 4: Reload systemd config

If you skipped the previous step, skip to the next step.

This will force systemd to pick up any /etc/systemd/system/os-update.timer change made in the previous step:

# systemctl daemon-reload
Enter fullscreen mode Exit fullscreen mode

Step 5: Enable and start os-update.timer

# systemctl enable os-update.timer
# systemctl start os-update.timer
Enter fullscreen mode Exit fullscreen mode

Step 6: Check the os-update.timer config

# systemctl list-timers os-update.timer
Enter fullscreen mode Exit fullscreen mode

The value in the NEXT column should match the intent in /etc/systemd/system/os-update.timer.

Top comments (0)