apt-get Sources List: Unable to Install Packages in Kali Linux

Abstract: Fix Kali Linux apt-get package installation failures caused by corrupted or outdated sources list configurations.

Created: 2026-09-09 by

Resolve apt-get sources list errors in Kali Linux by verifying your /etc/apt/sources.list configuration against the official Kali archive mirrors. Corrupted entries, outdated repository URLs, or missing GPG keys are the primary causes of failed package installations. Correcting these files restores connectivity to the package manager and allows successful updates.

Diagnosing the Source List Error

When you attempt to install a package using apt-get install or update your system with apt-get update, a failure often stems from the system being unable to reach the configured repositories. The error message typically includes phrases like "404 Not Found," "Hash Sum mismatch," or "The following signatures couldn't be verified." These symptoms indicate that the local package index is either stale, corrupted, or pointing to non-existent locations on the remote server. Before making any changes, it is crucial to identify which specific repository entry is causing the issue. Open a terminal and run sudo apt-get update. Carefully read the output for lines starting with E: (Error) or W: (Warning). The error line will usually specify the exact URL that failed to fetch data. For example, if you see an error related to kali-rolling, it suggests that the main rolling release repository is unreachable or misconfigured. If the error mentions a specific component like kali-experimental, you may have enabled an unstable repository that no longer exists in the current architecture. Understanding the structure of the sources list helps in troubleshooting. Each line in /etc/apt/sources.list follows the format: deb [arch=amd64] http://http.kali.org/kali kali-rolling main contrib non-free. Breaking this down, deb indicates a binary package repository. The URL points to the mirror, and kali-rolling is the distribution codename. The final part defines the components available. If any part of this string is malformed, the package manager cannot parse the request, leading to installation failures.

Checking Mirror Connectivity

Sometimes the issue is not with the file content but with network connectivity to the chosen mirror. You can test this by using wget to manually fetch a small file from the repository URL identified in your error logs. If wget fails with a connection timeout, the problem lies with your internet connection or firewall settings rather than the apt configuration. In such cases, refer to guides on updating Kali without WiFi or fixing interrupted sudo processes to ensure your network stack is stable before proceeding with package management fixes.

Editing the Sources List File

The primary file responsible for repository configuration is located at /etc/apt/sources.list. To edit this file safely, use a text editor with root privileges. The recommended command is sudo nano /etc/apt/sources.list. This opens the file in the Nano editor, allowing you to view and modify the contents directly. You should look for any lines that contain commented-out entries (prefixed with #) or duplicate entries. Kali Linux recommends using a single, clean entry for the rolling release. A correct, standard entry for most users looks like this:
deb http://http.kali.org/kali kali-rolling main contrib non-free
If your file contains multiple entries for different versions (such as kali-last-snapshot or older releases), remove them. Mixing different release versions can cause dependency conflicts and hash mismatches. Ensure that only one active line exists for the version of Kali you are running. If you are using a newer installation, verify that the URL uses http.kali.org rather than an old mirror address that may have been decommissioned. After making changes, save the file by pressing Ctrl+O, then Enter, and exit with Ctrl+X. It is good practice to back up the original file before editing. You can create a backup by running sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak. This allows you to restore the previous state if the new configuration causes further issues.

Refreshing Package Indexes and Keys

Once the sources list is corrected, you must refresh the local package database. Run sudo apt-get update again. This command downloads the latest package lists from the repositories defined in your sources list. If the previous errors were due to incorrect URLs, this step should now succeed without errors. However, even with correct URLs, package installation might still fail if the GPG keys used to sign the packages are missing or expired. Kali Linux uses cryptographic signatures to ensure package integrity. If you encounter signature verification errors, you need to install the keyring package. Execute the following command:
sudo apt-get install kali-archive-keyring
This package contains the public keys required to verify packages from the official Kali repositories. After installing the keyring, run sudo apt-get update once more to re-fetch the signed metadata. This ensures that your system trusts the new package lists.

Resolving Dependency Conflicts

In some cases, the sources list is correct, but the package installation fails due to broken dependencies. This often happens after an interrupted upgrade or when mixing third-party repositories. To fix broken dependencies, use the configure command:
sudo dpkg --configure -a
This command attempts to configure any packages that were unpacked but not fully configured. If this resolves the issue, you can proceed with normal installations. If problems persist, consider checking for known issues with specific software types. For instance, if you are trying to install Flatpak, you might face distinct challenges unrelated to the core apt sources, as detailed in our guide on error installing flatpak on Kali Linux.

Cleaning Up and Verification

After resolving the source list errors, it is advisable to clean up the local cache to prevent future hash mismatches. Run sudo apt-get clean to remove downloaded .deb files from the cache. Then, run sudo apt-get autoclean to remove obsolete package files. Finally, perform a full upgrade to ensure all installed packages are synchronized with the repository:
sudo apt-get dist-upgrade
This process installs new dependencies and removes obsolete packages, ensuring a clean and consistent system state. Always verify that your system is up to date regularly to avoid security vulnerabilities and compatibility issues.

Frequently Asked Questions

Why do I get a 404 error when updating Kali?

A 404 error means the repository URL specified in your sources list does not exist. This usually happens if you are using an outdated mirror or a deprecated release codename. Update your sources list to point to the current kali-rolling repository.

Can I use a custom mirror instead of the default Kali servers?

Yes, you can use a custom mirror by replacing the URL in your sources list. However, ensure the mirror is up-to-date and supports the same components (main, contrib, non-free) as the official server. Using an outdated mirror can lead to package installation failures.

What should I do if apt-get update fails due to GPG key errors?

Install the kali-archive-keyring package to add the necessary signing keys. After installation, run apt-get update again. If the error persists, check if your system clock is set correctly, as time discrepancies can cause signature verification failures.

How do I revert my sources list if I make a mistake?

If you backed up your original sources list file, you can restore it using sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list. If no backup exists, delete the current file and create a new one with the standard Kali rolling repository entry.

Is it safe to enable the kali-experimental repository?

Enabling kali-experimental is generally not recommended for production systems because it contains untested packages that may break dependencies. Only enable it if you specifically need a tool not available in the main rolling repository, and be prepared to resolve potential conflicts.

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