Install linux-headers on debian unable to locate package
Asked Answered
S

7

29

I am trying to install the linux-headers for my Kernel Version 3.4.61+ and Debian Version 7.1

I typed this Commands:

apt-get update
apt-get install linux-headers-$(uname -r)

On the last command I always get an Error:

E: Unable to locate package linux-headers-3.4.61
E: Couldn't find any package by regex 'linux-headers-3.4.61'

btw: It´s all based on a Cubietruck/Cubieboard3

Serilda answered 4/3, 2014 at 7:49 Comment(9)
have you compiled the kernel on your own?Ahumada
Use "apt-cache search linux-headers-" to get a list of all available headers, then you can choose one that fits best.Homestretch
@Ahumada sorry i´m complete newb. how can i know that?Serilda
can you show the output of uname -a ?Ahumada
@Robert i got a list and i chose the first and installed it like that: apt-get install linux-headers-3.2.0-4-all I get this Error: You might want to run apt-get -f install to correct these: The following package have unmet dependencies: linux-headers-3.2.0-4-all: Depends: linux-headers-3.2.0-4-all-armhf (= 3.2.54-2) but it is not going to be installed openjdk-7-jre-headless: depends: tzdata-java but it is not going to be installed E: Unmet dependencies. Try apg-get -f install with no package (or specify a solution)Serilda
@Ahumada Linux cubieez 3.4.61+ #1 SMP PREEMPT Mon 23 12:44:19 CST 2013 armv7l GNU/LinuxSerilda
@Serilda Please update your question to include the result of apt-cache search linux-headers.Squamulose
@leeduhem i found the solution. i just typed apt-get -f install after that i tried again with apt-get install linux-headers-3.2.0-4-all voila it worked!Serilda
@Serilda Then it is a broken dependencies problem.Squamulose
O
48

Here's what you may need to do

sudo apt-get update # This will update the repositories list
sudo apt-get upgrade # This will update all the necessary packages on your system
sudo apt-get dist-upgrade # This will add/remove any needed packages
reboot # You may need this since sometimes after a upgrade/dist-upgrade, there are some left over entries that get fixed after a reboot
sudo apt-get install linux-headers-$(uname -r) # This should work now
Outherod answered 11/12, 2016 at 0:5 Comment(7)
1,000 times yes!Verona
I did all the things, but still I couldn't. root@h1:~# apt-get install linux-headers-$(uname -r) Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package linux-headers-5.4.34-1-pve E: Couldn't find any package by glob 'linux-headers-5.4.34-1-pve' E: Couldn't find any package by regex 'linux-headers-5.4.34-1-pve'Grow
root@h1:~# apt-get -y install pve-headers Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package pve-headersGrow
Was running into this in Vagrant, and this did the trick! I had to vagrant reload after running these commands.Tank
Thanks a lot man. It worked (y).Goulette
This along with this unix.stackexchange.com/questions/644073/… just solved a network unclaimed drivers issue for Realtek RTL8723DE wlan on debian 10 with kernel 5.10, which I've been battling with for months now.Derain
Thank you, works when working with Raspberry Pi.Roswald
S
23

You could search first, then choose the closest one.

For example, on my system:

$ apt-cache search linux-headers
linux-headers-3.2.0-4-all - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-all-amd64 - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-amd64 - Header files for Linux 3.2.0-4-amd64

So I can install any one of these three.

Squamulose answered 4/3, 2014 at 8:2 Comment(1)
tried to install the first line on my system. got an error posted in comment at my answer to RobertSerilda
D
3

Heres my experience with this problem:

I installed Kali Linux from a live memory stick. Whilst installing I didn't have an internet connection.

This meant that my sources.list file was set to "Default Off-line Install Values". This meant that when installing I was limited to just the packages and data from the memory stick I Initially installed from.

To fix this, you need to change your sources.list (called switching branches):

Open terminal:

nano /etc/apt/sources.list

This opens the sources file

Now at the top of the file paste in the following two lines:

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib

Press CTRL + X then Press Y and Enter to save the file.

Now you can type the following commands to update Kali:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
reboot

And finally, you should now be able to...

sudo apt-get install linux-headers-$(uname -r)

This is just my unique experience with this error stemming from an offline install. I hope this helps someone else out there.

Reference

Doak answered 9/5, 2020 at 11:20 Comment(0)
Q
1

Check the Source.list file to contain the repository entries. You can find them at - https://docs.kali.org/general-use/kali-linux-sources-list-repositories. After editing the file, save it and run "apt-get update && apt-get upgrade". Now run "apt-get install linux-headers-$(uname -r)"

Quantify answered 15/4, 2018 at 13:36 Comment(0)
R
1

For latest version of kali linux do the following to install vbox guest additions.

  1. Update the packages

    # apt-get update
    
  2. Command to install virtualbox guest additions

    # apt-get install -y virtualbox-guest-x11
    
  3. Reboot

    # reboot
    
  4. Enjoy!

Now you have successfully installed guest OS additions and you can verify that by toggling full-screen it should now stretch to your screen resolution.

Source: Kali Linux Official (Docs - VirtualBox guest additions)

Ramshackle answered 11/5, 2018 at 11:43 Comment(0)
D
1

Just Use:

sudo apt-get install linux-headers-generic

if you are on a Desktop installation. The apt-get will solve the dependencies and install the correct version of kernel headers.

Durrett answered 6/11, 2022 at 7:49 Comment(0)
Q
-1

Thank you everyone. I had this same issue. "Unable to locate linux-headers" After researching every where and trying out every things online it still didn't work. Only for me to discover that my internet connection was off when I was updating, upgrading and getting linux-headers. So for anyone experiencing this problem take this step: *Ensure you are connected to the internet. *type on your terminal "sudo apt-get update" Sudo apt-get upgrade" "sudo apt-get dist-upgrade" *After updating and upgrading. reboot the system, Then type "sudo apt-get install linux-headers-$(uname -r)

Quinby answered 3/7, 2024 at 12:10 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.