Stuck During Ubuntu Upgrade? Try These Troubleshooting Steps!

Abstract: Resolve Ubuntu upgrade hangs by stopping the process, fixing broken packages with dpkg and apt, clearing the cache, and verifying disk space.

Created: 2026-09-03 by

When an Ubuntu upgrade hangs or fails, immediately stop the process with Ctrl+C, then run sudo dpkg --configure -a to fix broken packages. Clear the apt cache with sudo apt clean and update package lists using sudo apt update. If issues persist, check disk space with df -h and review logs in /var/log/apt/ for specific error codes.

Immediate Actions to Stop a Hanging Upgrade

The first step in resolving a stuck upgrade is to halt the current operation safely. Interrupting the process abruptly can leave the system in an inconsistent state, but continuing without intervention often leads to deeper corruption. Pressing Ctrl+C in the terminal sends a termination signal to the active process. This action stops the download or installation phase, allowing you to assess the situation. After stopping the process, it is crucial to ensure that no background package management tasks are still running. Sometimes, the initial command appears stopped, but background services continue to write to the database. You can verify this by checking for any running apt or dpkg processes using the ps aux | grep apt command. If any such processes are found, terminate them gracefully using kill -15 PID before proceeding. This ensures a clean slate for your troubleshooting efforts.

Fixing Broken Package Dependencies

Once the system is stable, the next priority is to repair any partially installed packages. The Debian package manager maintains a status database that can become corrupted if an upgrade is interrupted. Running sudo dpkg --configure -a instructs the system to configure all unpacked but unconfigured packages. This command iterates through the list of pending configurations and attempts to complete them. It is one of the most effective commands for recovering from a failed upgrade because it addresses the core issue of incomplete installations. If dpkg reports errors during configuration, you may need to force the removal of problematic packages. Use sudo apt --fix-broken install to allow the package manager to automatically resolve dependency issues. This command will attempt to remove packages that are causing conflicts or install missing dependencies required by other packages. It acts as a safety net, ensuring that the package database remains consistent even after significant changes.

Cleaning the APT Cache and Updating Lists

Corrupted or outdated package lists can cause upgrades to fail or hang indefinitely. The apt cache stores downloaded package files and metadata, which can become stale or damaged over time. Clearing this cache forces the system to re-download fresh data from the repositories. Execute sudo apt clean to remove all cached package files. This frees up disk space and eliminates potential sources of corruption. Following the cache cleanup, update the package lists to reflect the latest available versions. Run sudo apt update to fetch the current metadata from the configured repositories. This step ensures that your system knows about the latest security patches and feature updates. If the update process itself fails, it may indicate network issues or repository problems. In such cases, verify your internet connection and check the sources list in /etc/apt/sources.list. For users experiencing broader connectivity issues on virtual machines, reviewing guides on Ubuntu 22.04 VM Internet Connection Issues might provide additional context if network misconfiguration is suspected.

Checking Disk Space and System Resources

A common reason for upgrade failures is insufficient disk space. The upgrade process requires free space to download new packages and extract files. Before attempting another upgrade, check your available disk space using df -h. Look for the partition mounted at / (root) and ensure it has at least 10-20% free space. If the root partition is full, you must free up space before proceeding. You can identify large files consuming space using tools like du -sh /* to scan directories. Remove unnecessary temporary files, old kernels, or unused packages. Using sudo apt autoremove can help eliminate orphaned dependencies that are no longer needed. Additionally, check the size of the /var/log directory, as log files can grow significantly over time. Compressing or rotating logs can reclaim valuable storage space.

Analyzing Logs for Specific Errors

If the above steps do not resolve the issue, examining system logs is essential for diagnosing the root cause. The apt package manager records detailed information about its operations in the /var/log/apt/ directory. The file /var/log/apt/history.log shows previous upgrade actions, while /var/log/apt/term.log contains the terminal output. These logs can reveal specific error messages that explain why the upgrade failed. Look for keywords like "error," "failed," or "dependency" in these log files. They often point to conflicting packages or missing dependencies. If the error relates to a specific software component, searching for that component's name in the logs can provide targeted solutions. For instance, if you encountered issues with security monitoring tools during the upgrade, referencing documentation on Troubleshooting Wazuh Installation Error might be relevant if the failure was linked to agent conflicts. Understanding the exact error message allows for precise corrective actions rather than guesswork.

Reattempting the Upgrade Process

After completing all troubleshooting steps, you can safely reattempt the upgrade. Ensure that all previous commands have executed successfully without errors. Start with sudo apt update to refresh the package lists again. Then, run sudo apt upgrade to perform a standard upgrade. If you are performing a distribution upgrade, use sudo do-release-upgrade instead. Monitor the process closely and watch for any warnings or prompts. It is advisable to keep a backup of important data before starting the upgrade process again. While rare, upgrades can sometimes result in data loss or system instability. Having a recent snapshot or backup ensures that you can recover your system if something goes wrong. Once the upgrade completes successfully, reboot your system to apply all changes. Verify that all services are running correctly and that your applications function as expected.

Frequently Asked Questions

What should I do if my Ubuntu upgrade is stuck at 99%?

A hanging upgrade at 99% usually indicates a problem with configuring the final packages or restarting services. First, wait for a few minutes to see if the process completes, as some large configurations take time. If it remains stuck, interrupt the process with Ctrl+C and run sudo dpkg --configure -a to finish pending configurations. Check the logs in /var/log/apt/term.log for specific errors related to the last package being processed.

How can I clear the apt cache if I cannot access the terminal?

If the terminal is inaccessible due to a failed upgrade, you may need to boot into recovery mode. Select the recovery option from the GRUB menu and choose the root shell option. From there, mount the filesystem as read-write using mount -o remount,rw /. Then, execute sudo apt clean to clear the cache. This allows you to fix package issues even when the normal graphical interface is unavailable.

Why does sudo apt update fail with a GPG key error?

GPG key errors occur when the system cannot verify the authenticity of the package repositories. This often happens after a major version upgrade or if the keyring package is outdated. To fix this, try importing the missing keys manually or updating the ubuntu-keyring package. You can also check if the repository URLs in /etc/apt/sources.list are correct for your Ubuntu version. Removing invalid entries and adding the correct ones resolves most authentication issues.

Can I resume an interrupted upgrade where it left off?

No, you cannot directly resume an interrupted upgrade from the exact same point. The package manager needs to re-evaluate the entire state of the system. However, after fixing the underlying issues, running sudo apt upgrade will only reinstall or configure packages that were not fully processed. This makes the subsequent upgrade faster than starting from scratch, as many packages are already downloaded and ready.

What are the risks of forcing a package removal during a failed upgrade?

Forcing package removal can lead to dependency breaks, potentially rendering some applications unusable. It may also remove critical system components if not done carefully. Always review the list of packages that will be removed before confirming the action. Using sudo apt --fix-broken install is safer than manual removal because it attempts to resolve dependencies automatically. Only force removal if you are certain about the impact on your system.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More