Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
stephen
Posts: 5
Joined: Wed 24. Jan 2024, 05:41

Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by stephen » Wed 24. Jan 2024, 06:55

We have project in Japan and we use PCAN-USB on our hardware

OS: Ubuntu 20.04 LTS, Kernel 5.13.0-30-generic

We try to install PCAN-USB driver for two hardware
- Tiger Lake (i5-1145G7E) - OK
- Alder Lake (i7-1255U) - Fail

The SOP we did is below:
[1] download peak-linux-driver-8.15.2.tar.gz, and unzip it
[2] install g++ and libpopt-dev
$ sudo apt-get install build-essential g++
$ sudo apt-get install libpopt-dev
[3] Regarding the directory of peak-linux-driver-8.15.2
$ make clean
$ make
$ [sudo] make -C driver install
$ [sudo] make -C lib install
$ [sudo] make -C test install
$ [sudo] make -C libpcanbasic install
[4] After installation
$ wget -q https://urldefense.com/v3/__http://www. ... Uz0L5CshEA$ -O- | sudo tee /etc/apt/sources.list.d/peak-system.list
$ wget -q https://urldefense.com/v3/__http://www. ... Uz1I9QS3eA$ -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install pcanview-ncurses
[5] We disable secure boot and restart the system
$ sudo modprobe pcan

We install the PCAN-USB into our PC and type pcanview, and start the system

We are unable to install driver in i7-1255U and the error message shown below:
make [1]: directory '/hom/ubuntu/peak-linux-driver-8.15.2/driver' に入ります
Makefile:131: *** "Unable to automatically find the Kernel headers. There are mandatory to build the pcan dirver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.". Stop
make [1]: directory '/hom/ubuntu/peak-linux-driver-8.15.2/driver' から出ます
make: *** [Makefile:84: all] Error 2

We try to install new driver 8.16.0 and the one you released on 2024/1/18 v8.17, but we failed to install on the new intel platform Alder Lake i7-1255U
the error message always show after we type SOP [3] $ make clean

is there anything we can do for SOP? we are able to install drivers on intel old platform tiger lake but failed to install drivers on intel i7-1255U, we hope you can give us some advices, thanks and regards,

Stephen

M.Maidhof
Support
Support
Posts: 1701
Joined: Wed 22. Sep 2010, 14:00

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by M.Maidhof » Wed 24. Jan 2024, 09:50

Hi,

the error is displayed. The kernel headers are missing. Please update the system, reboot once and try again, please also use latest driver 8.17:

sudo apt update
sudo apt upgrade
sudo reboot

If the kernel headers are still missing, post the output of "uname -a" to see which kernel is used on your system.

regards

Michael

stephen
Posts: 5
Joined: Wed 24. Jan 2024, 05:41

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by stephen » Tue 30. Jan 2024, 11:39

Hi, Michael

We tried update, upgrade and reboot, but we are not able to use latest driver 8.17
The kernel is 5.19.17-05917-generic

regards,

Stephen

M.Maidhof
Support
Support
Posts: 1701
Joined: Wed 22. Sep 2010, 14:00

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by M.Maidhof » Tue 30. Jan 2024, 13:17

Hi,

please post the output of the driver make process. Did you install the kernel headers?

regards

Michael

stephen
Posts: 5
Joined: Wed 24. Jan 2024, 05:41

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by stephen » Wed 31. Jan 2024, 11:12

Dear Michael:

Can you tell us how to build a Kernel headers? We tried old intel platform, we can install drivers without this issue. So we are not sure how to build a kernel headers.
We upgrate and upgrade and reboot, and this is the version information below, and the error message, please kindly check below:

Version information:
Linux ubuntu-QBiX-Pro-ADLA1255H 5.19.17-051917-generic
linux-generic-hwe-20.04 linux-headers-generic-hwe-20.04
linux-image-generic-hwe-20.04

g++ Version 4:9.3.0-1ubuntu2
build-essential Version 12.8ubuntu1.1
libpopt-dev Version 1.16-14

Error Message:
root@ubuntu-QBiX-Pro-ADLA1255H:~# cd /home/ubuntu/sugino/peak-linux-driver-8.17.0
root@ubuntu-QBiX-Pro-ADLA1255H:/home/ubuntu/sugino/peak-linux-driver-8.17.0# make clean
make[1]: ディレクトリ '/home/ubuntu/sugino/peak-linux-driver-8.17.0/driver' に入ります
Makefile:131: *** "Unable to automatically find the Kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.". 中止.
make[1]: ディレクトリ '/home/ubuntu/sugino/peak-linux-driver-8.17.0/driver' から出ます
make: *** [Makefile:95: clean] エラー 2
root@ubuntu-QBiX-Pro-ADLA1255H:/home/ubuntu/sugino/peak-linux-driver-8.17.0# make
make[1]: ディレクトリ '/home/ubuntu/sugino/peak-linux-driver-8.17.0/driver' に入ります
Makefile:131: *** "Unable to automatically find the Kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.". 中止.
make[1]: ディレクトリ '/home/ubuntu/sugino/peak-linux-driver-8.17.0/driver' から出ます
make: *** [Makefile:84: all] エラー 2
root@ubuntu-QBiX-Pro-ADLA1255H:/home/ubuntu/sugino/peak-linux-driver-8.17.0#

User avatar
S.Grosjean
Software Development
Software Development
Posts: 352
Joined: Wed 4. Jul 2012, 17:02

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by S.Grosjean » Wed 31. Jan 2024, 14:59

Hi,
root@ubuntu-QBiX-Pro-ADLA1255H:/home/ubuntu/sugino/peak-linux-driver-8.17.0# make
First, it's generally not a good idea to build the driver as root because PATH may be different.

Secondly, please give us the output of:

Code: Select all

$ dpkg --get-selections "linux-headers*"
So that we'll definitively know if linux headers package is or isn't installed.

Regards,
— Stéphane

stephen
Posts: 5
Joined: Wed 24. Jan 2024, 05:41

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by stephen » Mon 5. Feb 2024, 03:48

Dears:

We tested and the result is below:

ubuntu@ubuntu-QBiX-Pro-ADLA1255H:~$ sudo -i
[sudo] ubuntu のパスワード:
root@ubuntu-QBiX-Pro-ADLA1255H:~# dpkg --get-selections "linux-headers*"
linux-headers-5.11.0-27-generic install
linux-headers-5.15.0-91-generic install
linux-headers-5.15.0-92-generic install
linux-headers-5.15.0-94-generic install
linux-headers-5.19.17-051917 install
linux-headers-generic-hwe-20.04 install
root@ubuntu-QBiX-Pro-ADLA1255H:~#

Thanks and regards,

Stephen

User avatar
S.Grosjean
Software Development
Software Development
Posts: 352
Joined: Wed 4. Jul 2012, 17:02

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by S.Grosjean » Mon 5. Feb 2024, 11:48

Hi,

you wrote:
The kernel is 5.19.17-05917-generic
Therefore the Makefile is looking for linux headers of 5.19.17-05917-generic, which are generally installed when installing "linux-headers-5.19.17-05917-generic"...

... which is not installed according to:
root@ubuntu-QBiX-Pro-ADLA1255H:~# dpkg --get-selections "linux-headers*"
linux-headers-5.11.0-27-generic install
linux-headers-5.15.0-91-generic install
linux-headers-5.15.0-92-generic install
linux-headers-5.15.0-94-generic install
linux-headers-5.19.17-051917 install
linux-headers-generic-hwe-20.04 install
On the other hand, if you know where the headers of your hand-made kernel are stored, then as indicated, use the KERNEL_LOCATION variable on the make command line, something like:

Code: Select all

$ cd driver
$ make KERNEL_LOCATION=/usr/src/...
Regards,
— Stéphane

stephen
Posts: 5
Joined: Wed 24. Jan 2024, 05:41

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by stephen » Mon 19. Feb 2024, 07:30

Hi,

Do you mean 5.19.17-05917-generic is our kernel version, but what we install is linux-headers-5.19.17-051917 so it cause makefile failed?
Should we reinstall again?

I asked our client to try
$ cd driver
$ make KERNEL_LOCATION=/usr/src/...

the results shown below:
ubuntu@ubuntu-QBiX-Pro-ADLA1255H:~$ cd driver
bash: cd: driver: そのようなファイルやディレクトリはありません
ubuntu@ubuntu-QBiX-Pro-ADLA1255H:~$ cd /home/ubuntu/sugino/peak-linux-driver-8.17.0/driver
ubuntu@ubuntu-QBiX-Pro-ADLA1255H:~/sugino/peak-linux-driver-8.17.0/driver$ make KERNEL_LOCATION=/usr/src/
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Ubuntu v20.04
*** Host machine kernel version=5.19.17-051917-generic
*** Driver kernel version=5.19.17-051917-generic (5.19.17)
*** Path to kernel sources=/usr/src/
*** use KBUILD=yes
*** use DKMS=
*** gcc version=9
***
/bin/sh: 1: cannot create dkms.conf: Permission denied
make: *** [Makefile:587: dkms.conf] エラー 2
ubuntu@ubuntu-QBiX-Pro-ADLA1255H:~/sugino/peak-linux-driver-8.17.0/driver$

Stephen

User avatar
S.Grosjean
Software Development
Software Development
Posts: 352
Joined: Wed 4. Jul 2012, 17:02

Re: Ubuntu 20.04 LTS (kernel 5.13.0-30-generic): "Unable to automatically find the Kernel headers"

Post by S.Grosjean » Tue 20. Feb 2024, 09:51

Hi,

When I wrote:
$ cd driver
$ make KERNEL_LOCATION=/usr/src/...
"/usr/src/..." was an example, a template to put the actual directory of linux headers installed on your machine. I suppose that, in your case, you should write:

Code: Select all

$ cd driver
$ make KERNEL_LOCATION=/usr/src/linux-headers-5.19.17-05917-generic
even though your installation seems quite strange to me: you're running a 5.19.17-051917-generic kernel:
"*** Host machine kernel version=5.19.17-051917-generic"
so you should have installed the "linux-headers-5.19.17-051917-generic" package, but that's obviously not the case, as it doesn't appear in the list you gave me:
root@ubuntu-QBiX-Pro-ADLA1255H:~# dpkg --get-selections "linux-headers*"
linux-headers-5.11.0-27-generic install
linux-headers-5.15.0-91-generic install
linux-headers-5.15.0-92-generic install
linux-headers-5.15.0-94-generic install
linux-headers-5.19.17-051917 install
linux-headers-generic-hwe-20.04 install
Regards,
— Stéphane

Post Reply