im-0 / hpsahba

Tool to enable/disable HBA mode on some HP Smart Array controllers
GNU General Public License v2.0
128 stars 45 forks source link

dkms module will not build on Ubuntu 20.04.2 LTS #15

Open mjbrowns opened 3 years ago

mjbrowns commented 3 years ago

All looks good running patch.sh and I have installed dkms and the headers:

$ dpkg -l |grep -e dkms -e linux-headers-$(uname -r)
ii  dkms                                   2.8.1-5ubuntu2                      all          Dynamic Kernel Module Support Framework
ii  linux-headers-5.4.0-77-generic         5.4.0-77.86                         amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP

dkms add works fine, but the install fails:

$  sudo dkms add ./

Creating symlink /var/lib/dkms/hpsa-dkms/1.0/source ->
                 /usr/src/hpsa-dkms-1.0

DKMS: add completed.

$ sudo dkms install --force hpsa-dkms/1.0

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j24 KERNELRELEASE=5.4.0-77-generic...(bad exit status: 2)
ERROR (dkms apport): binary package for hpsa-dkms: 1.0 not found
Error! Bad return status for module build on kernel: 5.4.0-77-generic (x86_64)
Consult /var/lib/dkms/hpsa-dkms/1.0/build/make.log for more information.

Contents of make.log:

DKMS make.log for hpsa-dkms-1.0 for kernel 5.4.0-77-generic (x86_64)
Mon 12 Jul 2021 06:38:27 PM EDT
make -C /usr/lib/modules/5.4.0-77-generic/build M=/var/lib/dkms/hpsa-dkms/1.0/build modules
make[1]: *** /usr/lib/modules/5.4.0-77-generic/build: No such file or directory.  Stop.
make: *** [Makefile:14: default] Error 2

It seems that on Ubuntu 20.04.02 LTS there is no /usr/lib/modules directory. There is a /usr/lib/modules-load.d but there's nothing in it.

I'm very comfortable with linux but I really haven't done anything with dkms so I have no idea what to try to do here.

flippipe commented 2 years ago

Hi,

I also got stuck in that stage. Then I found the kernel modules are locate not in /usr/lib/ but in /lib/.

Then, I remove dkms previously added

# dkms remove hpsa-dkms/1.0 --all

Edit the make file to fix the path

KDIR := /lib/modules/$(KRELEASE)/build

Then, re run all the steps... and it build the module fine

# dkms install --force hpsa-dkms/1.0

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.4.0-89-generic.....
cleaning build area...

DKMS: build completed.

hpsa.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-89-generic/updates/dkms/

depmod.....

DKMS: install completed.

After module load, in dmesg the disks are shown

[Sat Nov  6 14:28:19 2021] hpsa 0000:02:00.0: NVRAM HBA flag: enabled
[Sat Nov  6 14:28:19 2021] hpsa 0000:02:00.0: scsi 2:0:0:0: added RAID              HP       P212             controller SSDSmartPathCap- En- Exp=1
[Sat Nov  6 14:28:19 2021] hpsa 0000:02:00.0: scsi 2:0:1:0: added Direct-Access     ATA      Hitachi HTS72323 PHYS DRV SSDSmartPathCap- En- Exp=1
[Sat Nov  6 14:28:19 2021] hpsa 0000:02:00.0: scsi 2:0:2:0: added Direct-Access     ATA      Hitachi HTS72503 PHYS DRV SSDSmartPathCap- En- Exp=1
[Sat Nov  6 14:28:19 2021] hpsa 0000:02:00.0: scsi 2:0:3:0: added Direct-Access     ATA      KINGSTON SV300S3 PHYS DRV SSDSmartPathCap- En- Exp=1

Cheers,

IPlayForHer commented 1 year ago

I think I found reason, the kernel version in

./patch.sh
VERSION=${1:-5.8}

is default 5.8, you have to change to your kernel version and add it then install