Back to site

Update the system (apt)

Keep a HolyCloud Ubuntu/Debian VPS up to date with apt: security updates, kernel, planned reboots, and automation.

Update the system (apt)

Outdated packages expose your HolyCloud Linux VPS to known vulnerabilities. On Debian and Ubuntu, apt manages installation and updates. This guide covers a safe manual cycle, automatic security updates, and reboots after kernel updates.

Prerequisites

  • HolyCloud VPS Ubuntu 22.04/24.04 or Debian 12
  • sudo or root access
  • Snapshot or backup before a major version jump (e.g. release-upgrade)
  • Maintenance window if critical services run (databases, e-commerce)

Tip: run apt update && apt upgrade at least weekly on an Internet-exposed server.

Step 1: current state and mirrors

cat /etc/os-release
uname -r
apt-cache policy

Refresh the package list:

sudo apt update

If apt update fails (slow mirror), check /etc/apt/sources.list and connectivity:

ping -c 2 deb.debian.org

Step 2: see available updates

apt list --upgradable

Security updates only (preview):

sudo apt upgrade --dry-run
grep -i security /var/log/apt/history.log | tail -5

Step 3: apply updates (standard method)

sudo apt upgrade -y

To include recommended dependency changes (new packages, removals):

sudo apt full-upgrade -y

Remove unused packages:

sudo apt autoremove -y
sudo apt autoclean

Step 4: automatic security updates (unattended-upgrades)

Installation:

sudo apt install -y unattended-upgrades apt-listchanges
sudo dpkg-reconfigure -plow unattended-upgrades

Check configuration:

cat /etc/apt/apt.conf.d/50unattended-upgrades | head -40
sudo systemctl status unattended-upgrades

Dry run:

sudo unattended-upgrade --dry-run --debug

Step 5: kernel and reboot

After updating linux-image-*, a reboot loads the new kernel:

uname -r
ls /boot/vmlinuz-* 2>/dev/null | tail -3
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required

Schedule reboot:

sudo reboot

After SSH reconnect:

uptime
uname -r

Step 6: minor version upgrade (optional)

Ubuntu LTS to next point release:

sudo apt update
sudo apt install -y update-manager-core
sudo do-release-upgrade

Debian (stable → next stable): read Debian documentation before do-release-upgrade; prefer a new HolyCloud instance for major production jumps.

Step 7: logs and rollback

apt history:

grep -E 'Start-Date|Commandline' /var/log/apt/history.log | tail -20

HolyCloud snapshot or Borg/rsync backup before major full-upgrade — on regression, restore from the panel.

Verification

sudo apt update
apt list --upgradable
[ ! -f /var/run/reboot-required ] && echo "Pas de reboot requis" || echo "Reboot requis"
systemctl is-active unattended-upgrades 2>/dev/null || echo "unattended-upgrades non installé"

All critical packages up to date: apt list --upgradable should be empty (or only voluntary backports).

HolyCloud help

  • E: Unable to locate package: wrong sources.list or EOL distribution — provide lsb_release -a
  • dpkg was interrupted: sudo dpkg --configure -a then sudo apt -f install
  • Disk full during upgrade: df -h, sudo apt clean
  • HolyCloud support: apt update output, df -h, OS version before/after incident