It isn’t that apt is “broken” – it’s simply that no package called
linux-headers-6.12.13-amd64 exists in the repositories your system currently knows about.
There are three common reasons and three corresponding fixes:
- You’re running a kernel that didn’t come from the distro repos
• Example: you installed a main-line tarball from kernel.org, Liquorix, XanMod, Proxmox, etc.
• Result: the matching headers live in that same third-party repo (or you have to build them yourself), so Debian/Ubuntu can’t see them.
How to fix
a) Find out where your kernel came from
dpkg -l | grep linux-image | grep 6.12.13
apt-cache policy linux-image-6.12.13-amd64
b) Add that repo’s entry and install the corresponding header meta-package.
• Liquorix example (Debian bookworm):
echo "deb http://liquorix.net/debian bookworm main" | sudo tee /etc/apt/sources.list.d/liquorix.list
sudo apt update
sudo apt install linux-headers-liquorix-amd64
• XanMod example (Ubuntu 22.04):
echo "deb http://deb.xanmod.org releases main" | sudo tee /etc/apt/sources.list.d/xanmod.list
wget -qO- https://dl.xanmod.org/gpg.key | sudo apt-key add -
sudo apt update
sudo apt install linux-xanmod-headers-6.2
- You compiled the kernel yourself
If you ran “make install” from a kernel source tree, headers were not installed automatically.
Run from inside the same source directory:
sudo make INSTALL_HDR_PATH=/usr headers_install
This populates /usr/include and /lib/modules/$(uname -r)/build/ with the proper header files.
- You upgraded to a bleeding-edge kernel but kept stable repos
Official Debian stable (bookworm) currently stops at 6.1.*; Ubuntu 22.04 LTS stops at 6.5 (HWE).
If you must stay on the distro repos only, fall back to a kernel version they actually ship:
# Debian example
sudo apt update
sudo apt install linux-image-amd64 linux-headers-amd64
sudo reboot
# Ubuntu example
sudo apt install linux-image-generic linux-headers-generic
sudo reboot
After rebooting into that kernel, uname -r will match a header package that exists.
Quick checklist
sudo apt update – always refresh lists first.
apt search linux-headers-$(uname -r) – triple-check availability.
- If search returns nothing, identify kernel origin ➜ add matching repo or downgrade.
- Once headers are installed, you can safely build out-of-tree modules (DKMS, VirtualBox, NVIDIA, etc.).
Hope that clears things up! If you’re unsure where your 6.12.13 kernel came from, paste the output of:
dpkg -l | grep 6.12.13
and we can pin it down together.