Skip to main content
DCHost / Practical guide

Update Ubuntu and Debian server packages safely

By the end: You will have reviewed the proposed changes, applied suitable updates and checked access and applications. A package is installed software or one of its components.

Current packages help address known vulnerabilities and software defects. However, updating a web server, database or SSH package can affect running services. This guide covers controlled package updates within the current operating system release.

Applies to: Ubuntu 24.04 LTS and Debian 13 using APT, with a sudo-enabled account. It does not cover distribution release upgrades, changing the selected kernel family, or updating components managed by a control panel such as cPanel. If you use a control panel, first follow its vendor's supported update procedure.

The screenshots show actual terminal output from a DCHost demo server running Ubuntu 24.04. Package counts and versions change over time; do not expect identical numbers on your server. If you are signed in as root, the sudo prefix is unnecessary.

Visual guidePrepare before updating

Check each result before moving to the next step.

  1. Backup and maintenance

    Prepare recovery, disk space, a maintenance time and recovery access.

  2. Review the plan

    Refresh package information; preview changes with apt -s upgrade.

  3. Apply the update

    If the plan is suitable, run apt upgrade and read confirmation and configuration prompts.

  4. Check again

    Test a new SSH connection, services and the application's essential operations.

Package updates can restart services; choose a suitable maintenance window in advance.

1. Prepare maintenance and recovery​

Complete four preparations before starting:

  1. Prepare a current backup you can restore.
  2. Confirm there is enough disk space.
  3. Choose a maintenance time suitable for affected customers.
  4. Verify a second SSH connection and a recovery method.

Not ready? Complete the missing preparation before running the update.

Check your application's supported versions and any third-party package repositories. Prepare a current backup and a tested restore path. Use the resource checks to confirm sufficient disk space. Choose a maintenance window because services may restart during updates.

If preparation shows No space left on device or high inode usage, first identify what is filling the filesystem. Confirm enough space to download and unpack packages before starting updates; do not delete package-manager records to make room.

Keep your SSH session open and verify a second connection. Before a possible reboot, establish the console or recovery method actually available for your service. If you do not have working recovery access, plan changes that affect connectivity with your administrator or support.

If your service includes snapshots, you can create a copy before updating through server management. Wait for creation to finish and the snapshot to appear ready in the list. Creating a snapshot does not prove that restoration has been tested or that it contains a consistent database backup; prepare your application backup separately.

DCHost customer portalVerify the snapshot before updating

The actual snapshot record after creation completed. The name is hidden.

Actual demo server · 15 October 2026
DCHost snapshot screen showing one record, its Current status and Memory State Not Included
A closer look
Check that the record exists — detail from the screenshot above

Step 1: Check that the record exists

  1. Check that the record exists

    Compare Total Snapshots in Snapshot Statistics with the record below. Clicking Create Snapshot alone is not enough.

    What you should see: One snapshot is listed in this example.

  2. Read the date and status

    The record should predate the update. The Current badge on this screen identifies the snapshot's current status.

    What you should see: A dated record and the Current badge are visible.

  3. Check whether memory is included

    Not Included under Memory State means running memory is not part of this snapshot. Prepare application and database backups separately.

The snapshot was created; Restore was not used. Creating a snapshot does not mean restoration was tested. Slot availability depends on your service.

2. Refresh package information and review changes​

Where? On the server, through SSH. Run each line in order. If one fails, resolve it before the next line.

CommandWhat it doesExpected result
sudo apt updateRefreshes repository package informationLists download without errors; software is not yet upgraded
apt list --upgradableLists available package updatesPackage/version list, or no packages to upgrade
sudo apt -s upgradePreviews the update without applying itSummary of proposed changes

sudo requests administrator privileges; -s means simulation. A repository is a source from which packages are downloaded.

Run these commands on the server. The first refreshes package information without yet upgrading installed software:

sudo apt update
apt list --upgradable
sudo apt -s upgrade

apt -s upgrade simulates the operation. Review new packages, components to be updated and the proposed changes. Resolve repository, signature or network errors from apt update before proceeding; do not disable signature verification.

If you see Temporary failure resolving, Could not resolve host or Network is unreachable, use the Linux internet and DNS guide to identify the failing stage. Verify repository access before continuing the update; disabling repository signature checks does not fix DNS.

Simulation does not test application compatibility. In particular, compare third-party database and runtime packages with your application's support requirements. For critical production systems, test in a comparable non-production environment first.

Linux terminalConfirm that package information was refreshed

apt update refreshes repository information. Installed software has not been upgraded yet.

Actual demo server · 15 October 2026
Ubuntu terminal after sudo apt update, reporting 120 packages that can be upgraded
A closer look
Run the command on the server — detail from the screenshot above

Step 1: Run the command on the server

  1. Run the command on the server

    Run sudo apt update in your server's SSH session. This line shows the command used in the recording.

  2. Read the result

    Package-list processing finished with Done and 120 upgradable packages were reported. Your count may differ; these packages have not been installed yet.

    What you should see: Package information is current; the update plan can now be reviewed.

Resolve download, repository or signature errors before upgrading. Three of the 120 updates shown here were later deferred due to phased delivery.

Refreshing package information does not install the updates. In this example, the first screen reported 120 upgradable packages; the installation plan deferred three of them due to phased delivery.

Read the summary as follows:

On-screen phraseMeaning
upgradedInstalled packages that will move to newer versions
newly installedNew packages needed for the update
to removePackages scheduled for removal; do not approve unexpected removals
not upgradedPackages not updated in this operation; investigate why
Need to getTotal size of files to download

The demo server's plan showed 117 upgrades, 2 new packages, 0 removals and 3 packages not upgraded. APT explicitly identified the three packages as deferred due to phasing, meaning Ubuntu was distributing those updates in stages. We did not force their installation.

3. Run the update interactively​

This step changes software on the server. Run it only after preparing the backup and reviewing the plan. Read the confirmation summary; stop before agreeing if changes are unexpected.

If preparation and the simulation are satisfactory:

sudo apt upgrade
Linux terminalRead the confirmation before software changes

This frame was captured from the actual apt upgrade operation before y was entered.

Actual demo server · 15 October 2026
APT confirmation showing 117 upgrades, 2 new packages, 0 removals, 3 deferred packages and the Y/n prompt
A closer look
Compare the package counts — detail from the screenshot above

Step 1: Compare the package counts

  1. Compare the package counts

    Compare 117 upgraded, 2 newly installed, 0 to remove and 3 not upgraded with the reviewed plan. Do not approve unexpected changes.

  2. Check download and disk requirements

    This example downloads 81.6 MB and needs about 6.8 MB of additional disk space. Confirm the required space is available on your server.

  3. Enter y if the plan is suitable

    At Do you want to continue? [Y/n], type y and press Enter. Type n and press Enter to cancel. After confirming, wait until installation finishes.

This is a confirmation screen, not evidence that installation finished. The phasing line explains the three deferred packages; the suggested autoremove command was not run.

  1. Review the list for unexpected packages, removals or disk requirements.
  2. At Do you want to continue? [Y/n], type y and press Enter if the plan is suitable. To cancel, type n and press Enter.
  3. Wait for downloading and installation to finish. Unpacking means package files are being extracted; Setting up means the package is being configured.
  4. Read any additional prompt before answering. Do not close the window or reboot the server while the operation is running.

Compare the confirmation summary with the changes you expect. Leaving out -y allows you to review package manager prompts. If asked to replace a configuration file, inspect the differences between your settings and the new version instead of blindly replacing everything.

apt upgrade can hold back an update if it requires removing installed packages. Do not immediately run full-upgrade for remaining updates; review its new plan, including removals, separately. autoremove removes dependencies considered no longer required; it does not upgrade held-back packages. Review its removal list separately too. An operating system release upgrade needs its own migration plan.

4. Check the result and running services​

Check on the server. Run these commands in order, then test the application too.

CheckWhat should you see?
apt list --upgradableRemaining updates; investigate why any remain
systemctl --failed --no-pagerFailed units; investigate any reported errors
uname -rThe kernel version currently running
sudo dpkg --auditNo incomplete package installation problems; normally produces no output

The kernel is the operating system's core. Installing a new kernel package does not mean that version is already running.

apt list --upgradable
systemctl --failed --no-pager
uname -r
sudo dpkg --audit

Confirm that the package operation completed without errors. Investigate remaining updates: phased delivery, held packages or dependencies may be involved. Even if systemctl --failed lists nothing, test the web service, database and application flows. Open a fresh SSH connection; a surviving old session does not prove that new connections work.

On Ubuntu, /var/run/reboot-required may indicate that a reboot is needed. Its absence is not definitive on every system. Follow package notifications and distribution guidance. If a reboot is required, wait until the maintenance window, package operations are complete and recovery is ready. Afterwards, verify the running kernel, SSH access and application again.

5. Reboot if needed and connect again​

On Ubuntu, check the reboot indicator with:

if test -f /var/run/reboot-required; then
cat /var/run/reboot-required
else
printf 'Reboot required: no\n'
fi

If you see *** System restart required ***, review your maintenance preparation. Once package operations are complete, fresh SSH access works and recovery is ready, run this during the planned maintenance window:

sudo reboot

This restarts the server and may disconnect the current SSH session. After allowing time for startup, open a new SSH connection from your computer. An old terminal remaining open is not sufficient. After reconnecting, run:

uname -r
systemctl is-active ssh
systemctl --failed --no-pager
sudo dpkg --audit
apt list --upgradable
Linux terminalVerify the result after restarting

This output comes from a new SSH connection opened after the reboot.

Actual demo server · 15 October 2026
Fresh SSH session showing kernel 6.8.0-147-generic, SSH active, zero failed units and Reboot required no
A closer look
Check the running kernel and SSH — detail from the screenshot above

Step 1: Check the running kernel and SSH

  1. Check the running kernel and SSH

    uname -r now reports 6.8.0-147-generic. The active line below shows SSH is running. Establishing this new session also confirms a fresh connection works.

  2. Check for failed units

    0 loaded units listed under systemctl --failed means no failed units were found in this check. Test your application separately as well.

  3. Read remaining updates and reboot status

    Three updates remain because of phased delivery. Reboot required: no means the reboot indicator was absent during this check.

    What you should see: Package installation completed and SSH access works on the newer kernel.

No control panel or customer application was installed in this example. This screen does not establish that your own website or database is working.

In the fresh SSH connection, the demo server was verified to be running kernel 6.8.0-147-generic, with SSH active and 0 failed units. The reboot-required indicator was gone. Comparing package inventories confirmed 117 version changes, 2 new packages and no package removals. These results apply to the demo server. Test your own website, database and application separately.

After completion:

  1. Open a new SSH connection from a separate window on your computer.
  2. Check the website and the application's essential operation.
  3. Verify the relevant database and services.
  4. Record the result and time.

Actual terminal recording​

Step-by-step videoUbuntu package update: confirmation through installation

Recorded on an actual demo server. Long waits are shortened while the operation order is preserved. Rebooting and fresh SSH verification are shown in the separate step above.

Video transcript​

  1. apt upgrade runs on the demo server. The recorded user is root, so the command does not need a sudo prefix.
  2. APT shows 117 packages to upgrade, 2 new packages and no removals. The download size is 81.6 MB; 3 updates are deferred due to phased delivery.
  3. After the plan is reviewed, y is entered and Enter is pressed. Packages are downloaded, unpacked and configured.
  4. Services restart during installation. The final check reports that the server needs to restart to use the newer kernel.
  5. The package operation completes with exit code 0. Rebooting happens as a separate operation outside this recording, followed by verification in a fresh SSH connection.

No configuration-file replacement prompt appeared in this recording. If one appears on your server, review the differences between the old and new settings before answering.

If an update reports Killed, check OOM records and available memory before immediately retrying. Identify which process stopped, when and why; exit code 137 alone does not establish memory exhaustion.

If CPU usage rises during an update, check the process and load measurements to see whether package unpacking or configuration is progressing normally. Do not terminate APT or dpkg solely because of a high percentage; inspect progress and resource use during the same interval.

Common errors and recovery​

An APT lock error may mean another package operation or automatic update is running. Do not delete lock files or arbitrarily kill package manager processes; identify the active operation and allow it to finish. If disk space runs out, perform the disk checks instead of deleting large files at random.

There is no single general-purpose command that safely undoes every failed update. Inspect package logs, service errors and the current data state, then follow your application or system restore plan. Before reverting to an earlier copy, decide how to preserve records created since that copy.

Automatic update behavior depends on the image and configuration. Do not assume it is enabled. Check allowed repositories, notifications and reboot policy separately.

Why do packages remain after a completed update?​

If APT says deferred due to phasing, Ubuntu is gradually making that update available to machines. In this example, apparmor, libapparmor1 and open-vm-tools were deferred for this reason. Do not disable phased delivery simply to empty the list. For packages kept back for other reasons, use apt-mark showhold to inspect explicit holds and apt-cache policy PACKAGE_NAME to inspect the candidate version; replace PACKAGE_NAME with the actual name in the list.

Does updating Ubuntu 24.04 move me to a different release?​

The apt upgrade operation in this guide updates packages from the existing Ubuntu 24.04 repositories. Moving from 24.04 to another Ubuntu release needs a separate compatibility and migration plan. Do not change repository release names arbitrarily.