The auto-updater is a tool designed to perform an unattended and full system upgrade, including package cleanup, upon system shutdown. It ensures that your Debian/Ubuntu system is upgraded regularly, without manual intervention.
The tool consists of two parts:
- A bash script (
auto-updater
) that runsapt-get full-upgrade
,apt-get autoremove
, andapt-get autoclean
. - A Systemd service (
auto-updater.service
) that triggers the script on system shutdown.
To install the auto-updater, use the following one-liner:
curl -o auto-updater https://gist.githubusercontent.com/troykelly/1af7f4dfcdba082025cfa1073a0fe35b/raw/auto-updater && chmod +x auto-updater && sudo mv auto-updater /usr/local/sbin/ && curl -o auto-updater.service https://gist.githubusercontent.com/troykelly/1af7f4dfcdba082025cfa1073a0fe35b/raw/auto-updater.service && sudo mv auto-updater.service /etc/systemd/system/ && sudo systemctl enable auto-updater.service
This command will:
- Download the
auto-updater
script. - Make the script executable.
- Move the script to
/usr/local/sbin/
with root privileges. - Download the
auto-updater.service
file. - Move the service file to
/etc/systemd/system/
with root privileges. - Enable the service with root privileges so that it will trigger on shutdown.
Once installed, the auto-updater will automatically run on every system shutdown. It logs its actions to syslog, allowing you to monitor its activity.
To review the actions logged by auto-updater, check the syslog entries with:
grep 'auto-updater' /var/log/syslog
Auto-upgrading a system involves several risks:
-
Unattended Upgrades: The auto-updater performs upgrades without manual supervision, which might lead to unintentional consequences if problematic updates are applied.
-
System Stability: A full-upgrade could potentially introduce breaking changes that affect the stability of the system or crucial services.
-
Network Dependency: The upgrade process requires a stable network connection. Problems with connectivity during the upgrade could lead to a partially updated system.
-
Data Loss: While not common, there is always a risk of data loss when performing system upgrades.
To mitigate these risks, consider the following precautions:
- Regularly back up the system and data.
- Test the script in a controlled environment before deploying to production systems.
- Review the packages to be upgraded beforehand and ensure no critical services are disrupted.
- Have a recovery plan ready to restore the system to a previous state if needed.
Note: The auto-updater service will timeout after 30 minutes, preventing prolonged system shutdowns. However, if the upgrade has not finished within this window, the system may shutdown with incomplete updates.
By using this tool, you acknowledge the inherent risks of automated system upgrading and agree that it is your responsibility to manage these risks according to your operational requirements.
This auto-updater is open-source and provided under the APACHE-2 License.