Update packages safely
Updated 27 Nov 2026 apt dnf updates
Keep Ubuntu, Debian, AlmaLinux and Rocky Linux patched with few surprises.
Before a large update
Back up important data and note which services must be running afterwards.
Ubuntu and Debian
sudo apt update
apt list --upgradable
sudo apt upgrade -y
sudo apt full-upgrade may also remove packages to complete an update; read its list before agreeing. A reboot is needed when this file exists:
cat /var/run/reboot-required
AlmaLinux and Rocky Linux
sudo dnf check-update
sudo dnf upgrade -y
sudo dnf install -y dnf-utils
sudo needs-restarting -r
Automatic security updates
Ubuntu and Debian:
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
AlmaLinux and Rocky:
sudo dnf install -y dnf-automatic
sudo systemctl enable --now dnf-automatic.timer
Set apply_updates = yes in /etc/dnf/automatic.conf if updates should be installed, not only downloaded.
After updating
Check systemctl --failed and test your application. If something went wrong, see package manager errors.