如何在 openSUSE Leap 上配置 unattended-upgrades

发布: (2025年12月28日 GMT+8 09:08)
2 分钟阅读
原文: Dev.to

Source: Dev.to

Hi friends, welcome to another episode of Shitty Linux Documentation, where I blog about something whose developers never fully described and no one else bothered to write about after figuring it 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. (macOS doesn’t count, as it doesn’t allow you to install OS updates automatically.)

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.

os-update man page

Step 1: Install os-update

# zypper install os-update

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 /etc/os-update.conf and include only the lines you want to override. For example, if the defaults you want to keep are:

#UPDATE_CMD=dup
#REBOOT_CMD=reboot

then /etc/os-update.conf should contain those lines (uncommented or modified as needed).

Step 3: Configure os-update.timer

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

Otherwise, edit /etc/systemd/system/os-update.timer to define when os-update should run. Customize the content based on the systemd timer documentation. An example configuration:

[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

Step 4: Reload systemd config

If you edited the timer file, reload systemd so it picks up the changes:

# systemctl daemon-reload

Step 5: Enable and start os-update.timer

# systemctl enable os-update.timer
# systemctl start os-update.timer

Step 6: Check the os-update.timer config

# systemctl list-timers os-update.timer

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

Back to Blog

相关文章

阅读更多 »