Introduction
Keeping Linux virtual machines up to date is essential for maintaining security, stability, and compliance in Microsoft Azure environments.
However, patching a production Linux server requires more than simply running sudo apt upgrade. A poorly planned update can interrupt applications, restart critical services, affect network connectivity, or leave a virtual machine inaccessible after reboot.
This is particularly important for Azure VMs running business-critical services such as NGINX reverse proxies, load balancers, databases, web applications, and middleware.
In this guide, we demonstrate a structured patching process using a production-style Azure Ubuntu 24.04 LTS virtual machine.
We also explain how to handle a common situation where most updates install successfully but Ubuntu reports that some packages have been deferred due to phasing.
1. Understanding Ubuntu Linux Patching on Azure
Ubuntu patching typically includes several categories of updates:
| Update category | Purpose | Potential impact |
|---|---|---|
| Security updates | Address known security vulnerabilities | May require service restart |
| Kernel updates | Improve kernel security and reliability | Usually require reboot |
| System libraries | Update shared libraries and dependencies | May affect running applications |
| Network packages | Update network configuration components | Possible connectivity impact |
| Application packages | Update NGINX, database clients and other software | Possible application interruption |
| Firmware updates | Update supported firmware components | Require separate assessment |
A routine package update within Ubuntu 24.04 LTS is different from upgrading the operating system to a newer Ubuntu release.
For production environments, these should be treated as separate change-management activities.
Important: Do not run do-release-upgrade when your objective is simply to install the latest Ubuntu 24.04 patches.
2. Example Azure Ubuntu Server Environment
The following example reflects a typical Azure virtual machine used for application load balancing.
| Component | Configuration |
|---|---|
| Cloud platform | Microsoft Azure |
| Operating system | Ubuntu 24.04.4 LTS |
| Architecture | x86_64 |
| Kernel | Azure-optimised Linux kernel |
| Web server | NGINX |
| Package manager | APT |
| Networking | Azure virtual network |
| Update repositories | Ubuntu, Microsoft and NGINX |
| Patching method | Manual controlled maintenance |
During routine inspection, the operating system reported:
32 packages can be upgraded.It also indicated:
*** System restart required ***Although these messages are common, the patching procedure should begin with system validation and recovery planning.
3. Step 1 – Connect to the Azure Linux VM
Connect using SSH from an authorised administrative workstation:
ssh <username>@<server-ip>For virtual machines without public IP addresses, connect using Azure Bastion or an approved private network connection.
After connecting, confirm the current operating system:
hostnamectlcat /etc/os-releaseCheck the active kernel:
uname -rCheck server uptime:
uptimeCheck the last system boot:
who -bRecord these details before installing updates. They will be useful during post-patching validation and troubleshooting.
4. Step 2 – Perform Pre-Patching Health Checks
Before installing updates, verify that the operating system and applications are healthy.
Check disk space
df -hTAlso check inode availability:
df -ihPay particular attention to the following filesystems if configured:
//boot/var/var/log
Insufficient filesystem capacity can cause package installation failures.
Check memory
free -hCheck CPU load and uptime
uptimeIdentify failed services
systemctl --failedReview running services:
systemctl list-units \
--type=service \
--state=runningInvestigate any failed critical services before patching.
Check recent errors
sudo journalctl -p err -b \
--no-pager -n 100This establishes a baseline so that pre-existing problems are not incorrectly attributed to the patching activity.
5. Step 3 – Validate Application Services
Production Azure VMs often host applications that must remain accessible during maintenance.
For an NGINX server, check:
sudo systemctl status nginx --no-pagerVerify the current NGINX version:
nginx -vTest NGINX configuration:
sudo nginx -tA successful configuration test resembles:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfulCheck whether NGINX is enabled at startup:
systemctl is-enabled nginxIdentify listening ports:
sudo ss -tulpnFor load-balancing servers, verify that upstream applications are healthy and identify the mechanism used to drain or redirect traffic.
Production recommendation: If multiple load balancers are configured, drain traffic from the node being patched and confirm that the remaining node has sufficient capacity.
If no redundant load balancer exists, arrange a planned service outage.
A package upgrade can restart a service before the final server reboot, so service continuity must be considered throughout the maintenance window.
6. Step 4 – Validate Azure Network Configuration
Networking changes are particularly sensitive when patching remote Linux servers.
Display the current IP configuration:
ip -br addrDisplay the routing table:
ip routeReview Netplan configuration:
sudo netplan getValidate Netplan configuration generation:
sudo netplan generateThe netplan generate command processes the configuration without applying new network settings to the running interfaces.
Avoid running netplan apply unnecessarily while connected remotely to a production server.
Record the expected IP addresses, routes, DNS configuration and application connectivity requirements.
7. Step 5 – Create an Azure VM Backup
Before patching, ensure that a valid recovery point is available.
Create an on-demand backup through Azure Portal
Sign in to the Microsoft Azure portal.
Navigate to Virtual Machines.
Select the Ubuntu VM.
Open Backup.
Confirm that Azure Backup is configured.
Select Backup now.
Monitor the backup job.
Confirm that a successful recovery point has been created.
An Azure VM backup provides a recovery option if a serious operating system problem occurs during patching.
For business-critical systems, verify the recovery procedure and understand the implications of restoring a VM to an earlier point in time.
Back up the NGINX configuration
For an NGINX server, also create a local configuration archive:
sudo tar -czf \
/root/nginx-config-prepatch-$(date +%F).tar.gz \
/etc/nginxThis can help restore application configuration if it is unexpectedly changed.
A local configuration archive is not a substitute for Azure Backup.
8. Step 6 – Identify Available Ubuntu Updates
Refresh the APT package index:
sudo apt updateThis command downloads current package metadata from configured repositories.
It does not install the available updates.
List pending updates:
apt list --upgradableExample:
nginx/stable 1.30.5-1~noble
[upgradable from: 1.30.4-1~noble]
netplan.io/noble-updates
[upgradable from: previous version]
open-iscsi/noble-updates
[upgradable from: previous version]Review the packages carefully, especially those affecting:
Linux kernels
OpenSSH
Network configuration
NGINX and other application services
Authentication libraries
Storage connectivity
Azure guest agents
Also check whether any packages have been explicitly held:
apt-mark showholdAn intentionally held package is different from one deferred due to Ubuntu's phased update mechanism.
9. Step 7 – Simulate the Update Before Installation
APT allows administrators to simulate an upgrade without making changes.
Run:
sudo apt-get -s upgradeThis displays the packages and operations proposed by the upgrade.
For additional dependency analysis:
sudo apt-get -s dist-upgradeUnlike an ordinary upgrade, dist-upgrade may propose removing installed packages to resolve dependencies.
Do not execute a full dependency-changing upgrade automatically on a production server without reviewing the proposed changes.
Check for incomplete package installations:
sudo dpkg --auditCheck dependency consistency:
sudo apt-get checkIf the system reports broken dependencies, resolve them before proceeding.
10. Step 8 – Apply Ubuntu Security and Package Updates
Once the Azure backup is successful, the change is approved, and any required traffic draining has been completed, begin patch installation.
For a remote SSH session, consider using a persistent terminal such as tmux:
tmux new -s ubuntu-patchingIf tmux is not installed, use an approved terminal-management alternative rather than introducing unnecessary software during maintenance.
Refresh the package index:
sudo apt updateInstall the available updates:
sudo apt upgradeAPT displays the package operations and requests confirmation.
Review the summary before accepting.
During installation, Ubuntu may ask whether to keep an existing configuration file or install a package-maintainer version.
For production applications, inspect the differences and preserve required custom settings.
Do not blindly overwrite NGINX, SSH or network configurations.
After installation, check the package database:
sudo dpkg --auditsudo apt-get checkCheck for remaining updates:
apt list --upgradable11. Step 9 – Check Whether a Reboot Is Required
Ubuntu uses a reboot-required indicator when an installed update requires a system restart.
Check:
if [ -f /run/reboot-required ]; then
echo "Reboot required"
else
echo "No reboot currently required"
fiTo identify packages that requested a reboot:
if [ -f /run/reboot-required.pkgs ]; then
cat /run/reboot-required.pkgs
fiA reboot may be required after kernel updates or changes to important system components.
A missing reboot-required flag does not replace application-specific restart requirements or maintenance validation.
12. Step 10 – Reboot the Azure VM Safely
Before rebooting:
Confirm that the patch installation has completed.
Verify that the backup recovery point is available.
Confirm application traffic is drained or an outage is approved.
Check that administrative recovery access is available.
Notify the relevant operational teams.
Execute:
sudo systemctl rebootThe SSH session will disconnect.
Reconnect after the VM returns to service.
If SSH does not recover, investigate VM status, boot diagnostics, Azure Serial Console and network connectivity before attempting a forced restart.
13. Step 11 – Perform Post-Patching Validation
A successful reboot does not automatically mean the maintenance is complete.
Confirm the running kernel
uname -rCompare with the pre-patching result.
Check uptime
uptimeCheck system health
systemctl --faileddf -hfree -hValidate NGINX
sudo nginx -tsudo systemctl is-active nginxnginx -vCheck service logs:
sudo journalctl -u nginx \
-b --no-pager -n 100Verify application connectivity through the expected endpoints.
For an HTTPS endpoint:
curl -I https://your-application.example.comReplace the example address with the real application endpoint.
If the load balancer exposes TCP services, perform an appropriate end-to-end connection test.
Validate networking
ip -br addrip routeCheck that network interfaces, IP addresses, routes and backend connectivity match the expected configuration.
Validate Azure resources
In Azure Portal, verify:
VM running state
Azure VM Agent health
Azure Monitor metrics and alerts
Load Balancer health probes
Backend pool availability
Application response times
Relevant network and application logs
Only return the VM to active production traffic after service validation has succeeded.
14. Step 12 – Why Does Ubuntu Still Show Packages That Can Be Upgraded?
A common situation occurs after patching and rebooting.
An administrator executes:
sudo apt-get -s upgradeAnd receives:
The following upgrades have been deferred due to phasing:
libopeniscsiusr open-iscsi
0 upgraded, 0 newly installed,
0 to remove and 2 not upgraded.Running sudo apt upgrade produces the same result.
Does this indicate a failed patching exercise?
Not necessarily. This is normal behaviour when Ubuntu is gradually rolling out package updates.
Understanding Ubuntu phased updates
Ubuntu uses phased updates to deploy certain updates progressively rather than making them immediately available to every machine.
The purpose is to identify potential regressions before an update reaches the entire Ubuntu environment.
Ubuntu security updates are not phased in the same way as standard Stable Release Updates.
For production systems, phased updates can reduce the risk of immediately receiving a problematic non-security update.
Example: Deferred Open-iSCSI packages
In our patching example, the following two updates remained available:
| Package | Installed version | Available version |
|---|---|---|
| open-iscsi | 2.1.9-3ubuntu5.4 | 2.1.9-3ubuntu5.5 |
| libopeniscsiusr | 2.1.9-3ubuntu5.4 | 2.1.9-3ubuntu5.5 |
These packages relate to iSCSI storage connectivity.
Their appearance in the deferred list does not necessarily indicate an iSCSI problem or a failed upgrade.
Check phased update information
Run:
apt policy open-iscsi libopeniscsiusrThis displays the installed versions, candidate versions and repository information, including phasing details where available.
Check whether iSCSI is being used
sudo iscsiadm -m sessionReview configured targets:
sudo iscsiadm -m nodeIf iSCSI is actively used, assess the effect of storage-related updates before installation.
Should deferred updates be forced?
For most production servers, the recommended approach is to allow Ubuntu's phased rollout mechanism to operate normally.
Avoid manually forcing deferred packages simply to achieve an empty update list.
If there is an operational requirement to install a particular version, perform an additional risk assessment and confirm the relevant release notes or security advisory.
Key lesson: Two deferred packages do not automatically mean that an otherwise successful patching exercise has failed.
15. Step 13 – Investigate Firmware Update Notifications
Some Azure Ubuntu virtual machines may display:
1 device has a firmware upgrade available.Investigate using:
fwupdmgr get-devicesfwupdmgr get-upgradesDo not automatically execute a firmware upgrade without identifying the affected component and confirming the applicable Microsoft and Canonical guidance.
In Azure environments, firmware-related notifications may require specific attention to the supported virtual machine security configuration.
Treat these updates as a separate maintenance activity when appropriate.
16. Step 14 – Validate Patch Compliance
Once the VM has rebooted and application validation is complete, run:
sudo apt updateapt list --upgradablesudo apt-get checksudo dpkg --auditAlso confirm no additional reboot is requested:
test -f /run/reboot-required \
&& echo "Reboot required" \
|| echo "No reboot required"A production change record should capture:
| Validation item | Expected result |
|---|---|
| Package installation | Completed successfully |
| APT dependency check | No errors |
| Outstanding updates | None eligible, or documented exceptions |
| Server reboot | Completed where required |
| Critical services | Running normally |
| NGINX configuration | Valid |
| Network connectivity | Normal |
| Azure health probes | Healthy |
| Application testing | Successful |
| Outstanding phased updates | Documented |
| Backup and recovery | Verified |
Maintain the change record for troubleshooting, audit and compliance purposes.
17. Common Ubuntu Patching Problems and Troubleshooting
Problem: APT reports held-back packages
Check:
apt-mark showholdapt policy <package-name>Determine whether the package is explicitly held, deferred by phasing, or blocked by dependencies.
Problem: NGINX fails after an update
Check configuration:
sudo nginx -tInspect logs:
sudo journalctl -u nginx \
-b --no-pager -n 100Compare configuration against the pre-patching backup.
Do not repeatedly restart the service without identifying the cause.
Problem: Network connectivity fails after reboot
Use Azure Boot Diagnostics or Azure Serial Console where supported.
Inspect networking:
ip -br addr
ip route
sudo netplan getReview Netplan and relevant system logs before making changes.
Problem: APT package installation is incomplete
Check:
sudo dpkg --auditReview APT and dpkg logs:
sudo less /var/log/apt/history.logsudo less /var/log/dpkg.logDetermine the failing package and underlying error before applying corrective commands.
Problem: A kernel update causes boot failure
Investigate the Azure VM boot logs and available recovery options.
Depending on the failure, recovery may require boot diagnostics, serial console, an alternative boot environment, or restoring from an Azure backup recovery point.
Avoid removing kernels or modifying boot configuration without a verified recovery plan.
18. Best Practices for Production Ubuntu Patching on Azure
A reliable patching strategy should extend beyond ad hoc manual updates.
Establish regular patching windows. Schedule operating system updates based on the organisation's security policies and application availability requirements.
Use recovery points. Verify Azure Backup coverage and restoration procedures before major changes.
Test important updates. Where practical, validate changes in non-production environments before production rollout.
Patch redundant systems sequentially. Avoid rebooting every node of a load-balanced or high-availability service at the same time.
Review third-party repositories. Packages supplied by external vendors may follow different release and support policies from Ubuntu packages.
Monitor after maintenance. Validate business transactions, application logs and connectivity, not just basic VM availability.
Consider Azure Update Manager. Azure Update Manager can assist with patch assessment, scheduled installation, maintenance configurations and reporting across supported machines.
Maintain an audit trail. Record installed updates, outstanding exceptions, validation evidence and change approvals.
19. When Should You Consider Automated Azure VM Patching?
Manual patching works for a small number of servers, but it becomes difficult to manage consistently as an Azure environment grows.
Organisations operating tens or hundreds of Linux and Windows virtual machines should consider centralised patch management.
Microsoft Azure Update Manager can help with:
Scheduled patch maintenance- Patch assessment
- Installation monitoring
- Compliance reporting
- Maintenance windows
- Managing supported Azure and Azure Arc-enabled machines
Automation must still be designed around application dependencies, availability requirements, recovery procedures and maintenance approval.
It should not be treated as permission to reboot critical production servers without coordinating the affected services.
20. Conclusion
Patching Ubuntu 24.04 LTS on Microsoft Azure is relatively straightforward from a technical perspective, but production environments require additional operational controls.
The most important steps are to assess application dependencies, verify Azure backups, review the proposed APT transaction, apply patches in a controlled maintenance window, reboot where required and validate the complete application service afterward.
Our example also demonstrates that deferred phased updates are not necessarily a sign of failure.
Understanding Ubuntu's update mechanisms helps administrators avoid unnecessary package installation risks while maintaining a secure and stable environment.
By combining disciplined Linux patching procedures with Azure monitoring, backup and change management, organisations can reduce security exposure without introducing avoidable production outages.
Need Help Managing Your Azure Linux Infrastructure?
At Onsys Technologies, we help organisations across Australia and the Pacific manage, secure, troubleshoot and maintain their cloud and enterprise IT environments.
Our services include:
- Azure virtual machine administration and maintenance
- Linux and Windows server patching
- Azure infrastructure health assessments
- Application and database performance troubleshooting
- Azure networking and connectivity troubleshooting
- Backup, disaster recovery and business continuity
- Cloud infrastructure optimisation and modernisation
- Managed infrastructure and technical consulting
Whether you manage a single production Azure VM or a complex multi-server environment, Onsys can help establish secure, reliable and repeatable maintenance procedures.
Contact Onsys Technologies to discuss your Azure infrastructure support and maintenance requirements.
Website: https://onsys.com.au
Technical References
Ubuntu Server Documentation – Managing software: https://ubuntu.com/server/docs/tutorial/managing-software/
Ubuntu – About APT upgrade and phased updates: https://ubuntu.com/server/docs/about-apt-upgrade-and-phased-updates/
Ubuntu – Release upgrade guidance: https://ubuntu.com/server/docs/how-to-upgrade-your-release/
NGINX – Command-line parameters and configuration testing: https://nginx.org/en/docs/switches.html
Microsoft Learn – Azure Backup documentation: https://learn.microsoft.com/azure/backup/
Microsoft Learn – Azure Update Manager: https://learn.microsoft.com/azure/update-manager/
Disclaimer: The commands in this article are provided for technical guidance. Validate them against your environment, applicable support requirements and change-management policies before execution on production systems.

