Unable to update Kalilinux (Debian) with apt-get: Error and Solution

Abstract: Resolve Kali Linux apt-get update failures caused by expired or missing repository signing keys.

Created: 2026-10-09 by

The most common cause for apt-get update failures on Kali Linux is an expired or missing repository signing key. Modern versions of Debian and Kali have deprecated the apt-key tool, meaning you must now manage keys via files in the /etc/apt/trusted.gpg.d/ directory. Reinstalling the kali-archive-keyring package usually resolves this issue immediately without needing manual key downloads.

Understanding the Error Context

When you run sudo apt-get update and encounter errors such as NO_PUBKEY or messages stating that a repository cannot be authenticated, it indicates that the system no longer trusts the GPG key used to sign the packages in the Kali repositories. This often happens after a major version upgrade, if the kali-archive-keyring package was accidentally removed, or if the system clock is incorrect, causing signature validation to fail. It is critical to note that older tutorials may suggest using apt-key adv --keyserver ... to fix these issues. This approach is obsolete and will not work on current releases of Kali Linux (based on Debian 11 "Bullseye" or newer). The apt-key command has been removed from modern APT versions because managing keys globally was considered a security risk. Instead, keys must be stored as individual .gpg files in trusted directories. Attempting to use legacy methods can lead to further configuration errors or a broken package manager state.

Checking Your Kali Version

Before applying fixes, verify which version of Kali you are running. Open your terminal and execute:
cat /etc/os-release
Look for the VERSION_ID field. If you are on version 2023.x or later, you are definitely using a modern release where apt-key is unavailable. If you are on an extremely old version (like Kali 2019.x), upgrading is strongly recommended, as those versions are no longer supported and may have complex dependency issues that are difficult to resolve manually.

Solution 1: Reinstall the Keyring Package

The primary and most reliable solution is to ensure the official Kali archive keyring is correctly installed and up to date. This package contains the necessary public keys that allow APT to verify the integrity of packages downloaded from the official Kali repositories. Follow these steps carefully:
  1. Update the package list cache: Even if the update failed, try to refresh the local cache by running sudo apt update. Ignore any errors for a moment; we need to access the package database.
  2. Reinstall the keyring: Execute the following command to force reinstall the keyring package:
sudo apt install --reinstall kali-archive-keyring
  1. Verify the installation: After the command completes, run sudo apt-get update again. If the keys were the problem, the update should now proceed without authentication errors.
This method works because it restores the default trust anchors provided by the Kali Linux project. It does not require downloading external scripts or modifying system paths manually.

Solution 2: Verify Repository Sources

If reinstalling the keyring does not solve the problem, the issue may lie in your sources list configuration. The file /etc/apt/sources.list defines where APT looks for software. In modern Kali, this file is often minimal, with most configurations handled via the kali.list file in /etc/apt/sources.list.d/. Check if your sources list points to a valid mirror. You can view the active sources by running:
cat /etc/apt/sources.list.d/kali.list
Ensure the line begins with deb http://http.kali.org/kali kali-rolling main non-free contrib. If you see references to old codenames like kali-2021.1, they must be changed to kali-rolling. Using specific point-release names in the rolling distribution can cause mismatches and update failures. If you recently added third-party repositories, ensure their GPG keys are also placed in /etc/apt/trusted.gpg.d/. For example, if you added a custom repo, download its public key and save it as a .asc or .gpg file in that directory.

Handling Broken Dependencies

Sometimes, a failed update leaves the package database in an inconsistent state. If you see errors related to dpkg or half-installed packages, you should clean up the state before retrying. Run the following commands in sequence:
sudo dpkg --configure -a
sudo apt --fix-broken install
sudo apt-get update
The first command configures any unpacked but unconfigured packages. The second attempts to fix broken dependencies automatically. This combination often resolves cascading errors that prevent apt-get update from completing successfully.

Solution 3: Check System Clock and Network

GPG signature verification relies heavily on timestamps. If your system clock is significantly off—either ahead or behind—the digital signatures may appear invalid even if the keys are correct. Ensure your NTP service is running and synchronized. On Kali, this is typically managed by systemd-timesyncd. You can check the time synchronization status with:
timedatectl status
If the system is not synchronized, enable and start the service:
sudo systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd
Additionally, verify your network connectivity. Some corporate firewalls or ISP DNS servers may block or redirect HTTPS traffic, interfering with the secure connection to the Kali mirrors. Try switching to a different DNS server, such as Google's 8.8.8.8, temporarily to rule out DNS-related resolution issues. For more advanced troubleshooting involving package manager corruption, you might need to address deeper system errors. See Fixing E: Sub-process /usr/bin/dpkg returned an error code (1) on Kali Linux for guidance on resolving low-level dpkg conflicts that can stem from interrupted updates.

Frequently Asked Questions

Why did my apt-get update stop working after a reboot?

This usually indicates that the system clock drifted during shutdown or that a background service failed to initialize properly. Check your hardware clock battery if the time resets frequently, and ensure that systemd-timesyncd is enabled to maintain accurate time upon boot.

Can I manually add a GPG key using wget?

While you can download a key file using wget, you cannot use apt-key to import it. Instead, you must place the downloaded key file directly into the /etc/apt/trusted.gpg.d/ directory. APT will automatically recognize any GPG key stored in this folder as trusted for all repositories.

What should I do if I get a 404 Not Found error?

A 404 error means the requested package or metadata file does not exist at the specified URL. This often happens if you are using an outdated mirror or if the repository structure has changed. Switching to the main http.kali.org mirror and ensuring you are using kali-rolling in your sources list typically resolves this issue.

Is it safe to ignore NO_PUBKEY errors?

No, ignoring these errors is a significant security risk. It allows APT to install packages without verifying their authenticity, potentially exposing your system to tampered or malicious software. Always resolve key errors by installing the proper keyring package or adding the correct public key to the trusted directory.

How do I reset my apt configuration to defaults?

If your configuration is severely corrupted, you can back up your current sources list and restore the default one. Move your existing sources.list and kali.list files to a backup location, then recreate them with the standard Kali rolling repository lines. This forces APT to start fresh with known-good settings.

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