PVE LXC Updater
Update the operating system packages of all LXC containers on a node in one interactive run.
update-lxcs.sh walks through every LXC container on the node and runs the distribution's package upgrade inside it. It does not update the application in the container; for that use PVE LXC Apps Update. For a scheduled, non-interactive version see PVE Cron LXC Updater.
Website entry: update-lxcs. Source: tools/pve/update-lxcs.sh.
Run
In the Proxmox VE host shell, as root:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-lxcs.sh)"Prompts
| Dialog | Choices | Effect |
|---|---|---|
| "This Will Update LXC Containers. Proceed?" | Yes / No | No ends the script. |
| "Do you want to skip containers that are not currently running?" | Yes / No | Yes leaves stopped containers alone. No starts each stopped container, updates it and shuts it down again. |
| "Select containers to skip from updates:" (checklist) | All containers from pct list | Ticked containers are skipped. |
What it runs
The command depends on the container's ostype:
ostype | Command inside the container |
|---|---|
alpine | apk -U upgrade |
archlinux | pacman -Syyu --noconfirm |
fedora, rocky, centos, alma | dnf -y update && dnf -y upgrade |
ubuntu, debian, devuan | apt-get update, apt-get -yq dist-upgrade, apt-get -yq autoremove, apt-get -yq autoclean, then removes /usr/lib/python3.*/EXTERNALLY-MANAGED |
opensuse | zypper ref && zypper --non-interactive dup |
Other OS types are passed over without a command. Templates are never started.
For Ubuntu, Debian and Fedora containers the script prints how full /boot is before updating. After the update of a running container it:
- records the container if
/var/run/reboot-requiredexists and lists those containers at the end, - runs
/usr/local/bin/patchmon-agent reportif that file exists in the container.
Containers whose update command failed, or that could not be started, are listed at the end and the script exits with 1. For Ubuntu, Debian and Devuan containers the command line always ends with a successful rm, so a failed apt-get run is not detected there.
What it changes
Only packages inside the containers. Nothing is written on the host, and the script does not reboot containers.
Environment variables
| Variable | Default | Purpose |
|---|---|---|
COMMUNITY_SCRIPTS_CORE_URL | https://raw.githubusercontent.com/community-scripts/core/main | Base URL the script loads api/api.func from. |
Limits
- There is no undo. Take a snapshot or backup first if a container matters.
- A stopped container gets 5 seconds after
pct startbefore the update command runs. - Removing
EXTERNALLY-MANAGEDletspipinstall system-wide in Debian and Ubuntu containers again; the script does this on every run.