Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get ixgbevf to build on current Ubuntu AMI

AWS docs state that you need to build the source to get enhanced networking enabled for Ubuntu AMIs: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sriov-networking.html#enhanced-networking-ubuntu

The current AMI for us-west-2 xenial, ami-835b4efa, fails with: Building module: cleaning build area.... cd src/; make BUILD_KERNEL=4.4.0-1020-aws....(bad exit status: 2) ERROR (dkms apport): binary package for ixgbevf: 3.1.2 not found Error! Bad return status for module build on kernel: 4.4.0-1020-aws (x86_64) Consult /var/lib/dkms/ixgbevf/3.1.2/build/make.log for more information.

like image 966
Bruce Edge Avatar asked Jun 29 '17 19:06

Bruce Edge


2 Answers

This is a problem with the AWS kernel naming convetion.

Looking at the log file:

root@ip-10-16-80-225:/home/ubuntu# cat /var/lib/dkms/ixgbevf/3.1.2/build/make.log
DKMS make.log for ixgbevf-3.1.2 for kernel 4.4.0-1020-aws (x86_64)
Wed Jun 28 15:34:22 PDT 2017
make -C /lib/modules/4.4.0-1020-aws/build SUBDIRS=/var/lib/dkms/ixgbevf/3.1.2/build/src modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-1020-aws'
  CC [M]  /var/lib/dkms/ixgbevf/3.1.2/build/src/ixgbevf_main.o
In file included from /var/lib/dkms/ixgbevf/3.1.2/build/src/ixgbevf.h:41:0,
                 from /var/lib/dkms/ixgbevf/3.1.2/build/src/ixgbevf_main.c:53:
/var/lib/dkms/ixgbevf/3.1.2/build/src/kcompat.h:755:2: error: #error UTS_UBUNTU_RELEASE_ABI is too large...
 #error UTS_UBUNTU_RELEASE_ABI is too large...
  ^
scripts/Makefile.build:258: recipe for target '/var/lib/dkms/ixgbevf/3.1.2/build/src/ixgbevf_main.o' failed

it's complaining about UTS_UBUNTU_RELEASE_ABI

Ubuntu kernel docs state that the kernel version's 4th number is the ABI, https://wiki.ubuntu.com/KernelTeam/BuildSystem/ABI, but the current AWS kernel version is: Linux ip-10-16-89-81 4.4.0-1020-aws

Looking at the offending code in /usr/src/ixgbevf/src/kcompat.h:

#if UTS_UBUNTU_RELEASE_ABI > 255
#error UTS_UBUNTU_RELEASE_ABI is too large...
#endif /* UTS_UBUNTU_RELEASE_ABI > 255 */

one can see this won't fly, 1020 being > than 255

Here's a script that I use as a custom package postinst to fix this. This script can also be run directly from a shell if you have the source tgz from here https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/3.1.2/ in ~/

%> cat src/deb/control/postinst
#!/bin/bash -e
[ "${DEBUG}" ] && set -x
cd ~/ixgbevf
ver="3.1.2"
tar -xzf ~/ixgbevf-${ver}.tar.gz
rm -rf /usr/src/ixgbevf-${ver}
mv ixgbevf-${ver} /usr/src/
touch /usr/src/ixgbevf-${ver}/dkms.conf
kernelver=$(uname -r)
cat <<-EOT > /usr/src/ixgbevf-${ver}/dkms.conf
PACKAGE_NAME="ixgbevf"
PACKAGE_VERSION="${ver}"
CLEAN="cd src/; make clean"
MAKE="cd src/; make BUILD_KERNEL=\${kernelver}"
BUILT_MODULE_LOCATION[0]="src/"
BUILT_MODULE_NAME[0]="ixgbevf"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_NAME[0]="ixgbevf"
AUTOINSTALL="yes"
EOT
# Hack for /usr/src/ixgbevf-3.1.2/src/kcompat.h:755:2: error: #error UTS_UBUNTU_RELEASE_ABI is too large...
# #if UTS_UBUNTU_RELEASE_ABI > 255
#
sed -i 's/#if UTS_UBUNTU_RELEASE_ABI > 255/#if UTS_UBUNTU_RELEASE_ABI > 99255/' /usr/src/ixgbevf-${ver}/src/kcompat.h
dkms remove ixgbevf -v ${ver} --all 2>/dev/null || true
dkms add -m ixgbevf -v ${ver}
dkms build -m ixgbevf -v ${ver}
dkms install -m ixgbevf --all
dkms autoinstall -m ixgbevf
update-initramfs -c -k all
modinfo ixgbevf

I've notified AWS of this, but in the interim, hopefully this will save someone else the WTF moment of 'this is not what I wanted to do today'

Edit:

Got a followup from AWS - They are pushing this out to the Intel driver support team. It's the driver's check that's assuming the ABI < 255 that is broken, not the AWS kernel versioning scheme.

like image 64
Bruce Edge Avatar answered Sep 26 '22 07:09

Bruce Edge


The workaround to this problem is to disable this checking by running the following command:

$ sudo sed -i '/#if UTS_UBUNTU_RELEASE_ABI > 255/c\/*#if UTS_UBUNTU_RELEASE_ABI > 255' /usr/src/ixgbevf-2.16.4/src/kcompat.h
like image 28
Taiwo Ayanleye Avatar answered Sep 26 '22 07:09

Taiwo Ayanleye