LINUX-001 · Script
Update Linux Packages
Lists pending package updates and, in apply mode, installs them with apt (Debian, Ubuntu) or dnf/yum (RHEL, Rocky, Alma, Fedora). Reports whether a reboot is required and can schedule one.
What it does
Report mode does not install anything. With --refresh=yes it refreshes the package lists (apt-get update or dnf metadata), which is the same thing the system does on its own schedule. Apply mode keeps existing configuration files when a package offers a new one. Apply does not remove packages and does not perform a major release upgrade.
Requirements
Debian, Ubuntu, RHEL, Rocky, Alma or Fedora (apt-get, dnf or yum). Run as root. No prompts.
How to run it
- Run from: an admin workstation or scheduled task with the Microsoft modules installed and app sign-in configured
- This is an admin script for your Linux tenant, not a per-device endpoint script
- User interaction: none with app-only sign-in
- Schedule: run on demand, or weekly for reports
Settings
| Name | What it does | Options | Default |
|---|---|---|---|
| mode | default report | report, apply | report |
| reboot | default never; if-required schedules a reboot after apply when one is needed | never, if-required | never |
| reboot-delay | default 5; wait before the reboot | 5 | |
| refresh | default yes; refresh package lists first | yes, no | yes |
| report-dir | CSV of pending updates; default /var/lib/runbookia/reports | /var/lib/runbookia/reports |
Exit codes
- 0 = No updates pending, or updates applied (and reboot scheduled if needed)
- 1 = Updates pending (report mode), or a reboot is required and not scheduled
- 2 = Script error, or the package manager reported a failure
Testing steps
- Run it first with the mode set to report on one test account or small group. Nothing is changed in that mode.
- Read the log and confirm the planned changes are what you expect.
- Run your chosen settings on the same test target and confirm the result.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- Roll out to a small group next, then everyone.
Rollback steps
Report mode installs nothing (it may refresh the package lists, which the system also does on its own). Apply mode installs package updates; to go back, reinstall the previous version of a package (apt-get install NAME=VERSION on Debian/Ubuntu, dnf history undo ID or dnf downgrade NAME on RHEL-family). A scheduled reboot can be cancelled with shutdown -c.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |