How to resolve the "/lib/modules/3.13.0-27-generic/build: No such file or directory" error message?

89,644

Solution 1

I was using a kernel (v3.13) that is not meant to be used with the distro version I'm using (Ubuntu 14.10).

So I installed the latest possible kernel for my distro by running the following command:

sudo apt-get install linux-generic

It fixed my brightness issue too !

Solution 2

you need to install linux-headers-3.13.0-27-generic package

sudo apt-get install linux-headers-3.13.0-27-generic

or better

sudo apt-get install linux-headers-`uname -r`

this will provide the link /lib/modules/3.13.0-27-generic/build

Solution 3

Find where your build-essentials are kept

find / | grep include/generated/autoconf.h

Mine returned

/usr/src/linux-headers-4.19.0-5-amd64/include/generated/autoconf.h

If you followed the guides online and they didn't work, replace

/lib/modules/`uname -r`/build

With the result from above - in my case

/usr/src/linux-headers-`uname -r`

So, in total

obj-m += hello-1.o

all:
    make -C /usr/src/linux-headers-$(shell uname -r) M=$(PWD) modules

clean:
    make -C /usr/src/linux-headers-$(shell uname -r) M=$(PWD) clean
Share:
89,644
Muhammad Gelbana
Author by

Muhammad Gelbana

Updated on September 18, 2022

Comments

  • Muhammad Gelbana
    Muhammad Gelbana over 1 year

    I'm following the instructions on this page so I can submit enough information about my machine to this bug report module.

    I'm stuck in running some of the following commands

    git clone git://github.com/Lekensteyn/acpi-stuff.git
    cd acpi-stuff/acpi_dump_info
    make
    sudo make load
    cat /proc/acpi/dump_info > handles.txt
    

    I cloned the Git repository but I can't run the make command, I'm getting the following error messages:

    mg@MG-7520SE:~/workspace/HybridGraphicsCards$ cd acpi-stuff/acpi_dump_info
    mg@MG-7520SE:~/workspace/HybridGraphicsCards/acpi-stuff/acpi_dump_info$ make
    make -C /lib/modules/3.13.0-27-generic/build M=/home/mg/workspace/HybridGraphicsCards/acpi-stuff/acpi_dump_info modules
    make[1]: *** /lib/modules/3.13.0-27-generic/build: No such file or directory.  Stop.
    Makefile:9: recipe for target 'default' failed
    make: *** [default] Error 2
    mg@MG-7520SE:~/workspace/HybridGraphicsCards/acpi-stuff/acpi_dump_info$ sudo make
    [sudo] password for mg: 
    make -C /lib/modules/3.13.0-27-generic/build M=/home/mg/workspace/HybridGraphicsCards/acpi-stuff/acpi_dump_info modules
    make[1]: *** /lib/modules/3.13.0-27-generic/build: No such file or directory.  Stop.
    Makefile:9: recipe for target 'default' failed
    make: *** [default] Error 2
    

    So after cloning the Git repository, I access the specified directory acpi-stuff/acpi_dump_info and ran make but it didn't work. I tried running it as sudo it still didn't work.

    I noticed its complaining because there is not build directory under the /lib/modules/3.13.0-27-generic/ directory. I'm not sure what this is exactly but from the looks of it, the make command needed a compiled version of my kernel but didn't find one. But I know nothing about that anyway.

    I tried installing linux headers by running the commands

    1. sudo apt-get install linux-headers-3.13.0-27-generic
    2. sudo apt-get install linux-headers-uname -r`

    ..but they both failed and had the same output

    mg@MG-7520SE:~$ sudo apt-get install linux-headers-3.13.0-27-generic
    [sudo] password for mg: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package linux-headers-3.13.0-27-generic is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'linux-headers-3.13.0-27-generic' has no installation candidate
    

    My system infomration:

    mg@MG-7520SE:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 14.10
    Release:    14.10
    Codename:   utopic
    mg@MG-7520SE:~$ uname -a
    Linux MG-7520SE 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    

    So what should I do to be able to run the make command successfully under this directory ?

  • Muhammad Gelbana
    Muhammad Gelbana over 9 years
    It didn't work. Check my question for the output of running these commands.
  • solsTiCe
    solsTiCe over 9 years
    what are you running ? ubuntu ? debian ? mint ? try running sudo apt-get update && apt-get dist-upgrade before
  • Muhammad Gelbana
    Muhammad Gelbana over 9 years
    (Ubuntu 14.10) uname -a: Linux MG-7520SE 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux, lsb_release -a: No LSB modules are available, Distributor ID: Ubuntu, Description: Ubuntu 14.10, Release: 14.10, Codename: utopic
  • jzonthemtn
    jzonthemtn over 8 years
    Can someone please explain why this answer is downvoted?
  • Mark Jeronimus
    Mark Jeronimus almost 4 years
    uname -r or $(uname -r) doesn't work. The header I need is 4.4.0-154-generic but the command results in 4.4.154. Moreover, I had to edit Makefile because it also (ab)uses uname