BlogApache CloudStack

How to Upgrade Apache CloudStack to 4.22 LTS: Steps and Order

Scott Sternloff

By Scott Sternloff, Senior Enterprise Architect

LinkedIn · Updated · 5 min read

How to Upgrade Apache CloudStack to 4.22 LTS: Steps and Order
On this page

Short answer

To upgrade Apache CloudStack to the 4.22 LTS release: confirm Java 17, register the 4.22 system VM template, stop all management servers, back up the cloud and cloud_usage databases, upgrade the first management server, upgrade KVM agents, start the first server, check it, then upgrade the rest and patch the system VMs. Steps and versions below follow the Apache CloudStack downloads page and the 4.22.1.1 upgrade documentation, read 19 November 2026.

To upgrade Apache CloudStack to the 4.22 LTS release: confirm Java 17, register the 4.22 system VM template, stop all management servers, back up the cloud and cloud_usage databases, upgrade the first management server, upgrade KVM agents, start the first server, check it, then upgrade the rest and patch the system VMs. Steps and versions below follow the Apache CloudStack downloads page and the 4.22.1.1 upgrade documentation, read 19 November 2026.

Which release is "the LTS" today?

On 19 November 2026 the downloads page lists 4.23.0.0 as the latest regular release and 4.22.1.1 as the current LTS. The previous LTS line, 4.20.x, was at 4.20.3.1. The project says LTS releases receive bug and security fixes for 18 months after the main release, and that regular releases get only critical fixes for a short period, so users of a regular release are expected to move on to receive fixes. The upgrade guide has one instruction page per starting release (from 4.3.x up to 4.22.x in the current documentation), so start from the page that matches the version you run today.

What do you check before touching anything?

Check Why
Java 17 on management servers and KVM hosts 4.22 requires Java 17 JRE for the management server and the KVM agent
Manually added guest OS rows Custom rows in guest_os, guest_os_hypervisor, guest_os_details and guest_os_category can make the upgrade fail; the docs say remove them first
Customised UI CSS and plugins CSS is likely overwritten; back up the plugin directories and plugins.js
Third-party integrations The community cannot test them all; check with the vendor
System VM service offerings The system VM template moved to Debian 12.x in 4.20; default system offerings are 512 MiB, and a custom 256 MiB offering can cause kernel panics at boot

Java 17 support arrived in 4.20, and the docs state that later versions drop Java 11. On each host, set Java 17 as default with sudo alternatives --config java. Then verify /etc/default/cloudstack-management and /etc/default/cloudstack-usage (and /etc/default/cloudstack-agent on KVM hosts) match the packaged defaults, specifically that JAVA_OPTS includes --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED. The Java side of the estate is covered in Java LTS versions and end-of-life dates by vendor.

How do you upgrade, step by step?

The documented upgrade process has the same order for every hypervisor, with hypervisor-specific notes called out. Stop all running management servers before you begin.

  1. Register the 4.22.0 system VM template if you are not already on it. Register one per hypervisor type in use (for KVM: name systemvm-kvm-4.22.0-x86_64, format QCOW2, not public, not extractable) and wait for the READY state. Since 4.16 registration can also be handled during the upgrade when templates are missing, but the manual route still works and lets you see failures early.
  2. Stop every management server and the usage server. sudo service cloudstack-management stop and sudo service cloudstack-usage stop on each host.
  3. Back up MySQL. mysqldump -u root -p -R cloud > cloud-backup_$(date +%Y-%m-%d-%H%M%S) and mysqldump -u root -p cloud_usage > cloud_usage-backup_$(date +%Y-%m-%d-%H%M%S). Test that the dump restores somewhere else; an untested dump is a hope, not a rollback.
  4. Point the package repository at 4.22 on every management server and KVM host, then run sudo apt-get upgrade cloudstack-management (or sudo yum upgrade cloudstack-management), and the same for cloudstack-usage if you run it. Run the package upgrade on the first management server only; the other servers wait until step 8.
  5. Check logging. When upgrading from versions before 4.20, the log configuration may not migrate to Log4j2 automatically, especially if you customised it. Verify log4j-cloud.xml under /etc/cloudstack/management and /etc/cloudstack/usage uses Log4j2 format, or logs may be missing after the upgrade.
  6. Upgrade the KVM agents (hypervisor step). Stop cloudstack-agent, upgrade the package, start it again. The docs say this does not affect running guests. XenServer needs no extra steps. For VMware, the management server packages must be built with "noredist".
  7. Start the first CloudStack management server, then the usage server, and check the environment works.
  8. Upgrade and start the remaining management servers.

Why does the first management server refuse to start?

From CloudStack 4.20.3 and 4.22.1 onward, a management server that detects a pending database upgrade aborts if it also finds mshost entries for other management servers that are up. The error reads "Database upgrade is required but the management server is running in a clustered environment." First confirm every other management server is truly stopped. If one died ungracefully, the docs say to check select name from mshost where state <> 'Down' and, only when all are safe, run update mshost set state = 'Down' for it. Never edit that table while any server could still be running.

How do you update system VMs and virtual routers?

Since 4.17 you can live patch the secondary storage VM, console proxy VM and virtual routers, with no destroy and recreate. Live patching updates the packaged agent and scripts and restarts services in place: cloud, apache2, portmap on the SSVM, cloud on the CPVM, and haproxy, apache2, dnsmasq on routers. For routers, set the global setting minreq.sysvmtemplate.version to the minimum supported router template version first (for example 4.20.1 if that is what is deployed). A network restart without cleanup runs during router patching so the rules are reapplied.

Restart or recreate instead when you need the new template content (security patches in the template) or when live patching fails (for example VPC networks without tiers). That can mean downtime. The bundled cloudstack-sysvmadm script does it: nohup cloudstack-sysvmadm -d <mysql-ip> -u cloud -p <password> -a > sysvm.log 2>&1 &. It needs integration.api.port set to 8096, which exposes an unauthenticated API port, so keep it off the public internet, set it back to 0 afterwards and restart the management server. The docs say the run can take an hour or more.

What fails most often?

  • Manually added guest OS mappings (see the checklist).
  • Java 11 still the default on one management server or KVM host.
  • An old management server left running during the first start (the mshost abort).
  • Logging silently lost after a pre-4.20 upgrade.
  • Skipping the restore test of the dump.

CloudStack consulting from AceMQ covers upgrades between LTS lines; the scope of a Java 17 and system VM upgrade assessment is on our use-case page, alongside the management database backup and restore review.

FAQ

Can I upgrade CloudStack without downtime for guests? The documentation says KVM agent upgrades do not affect running guests, and system VMs can be live patched. The management server is stopped during the database upgrade, so API and UI access is unavailable for that period.

Do I have to register the system VM template before upgrading? Not strictly: since 4.16 the upgrade can register missing templates itself. Registering first, and confirming READY, makes problems visible before you stop the management servers.

Is it safe to roll back after the database upgrade? Plan on restoring from the mysqldump backup taken before the upgrade. The docs recommend rehearsing the procedure on a test system before production.

Sources

Scott Sternloff

Author

Scott SternloffSenior Enterprise Architect

Senior Enterprise Architect at AceMQ. Writes the technical coverage here: RabbitMQ, Kafka and Redis architecture, clustering and migrations.

Talk to an engineer

Need a hand with Apache CloudStack?

Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

Free Consultation

Get Expert Eyes on Your Apache CloudStack Environment

Whether you're troubleshooting a production incident, planning a migration, or want a second opinion on your architecture — our team is ready. No pitch, just answers.

Email Us