Package: dkms
Version: 2.3-3
Severity: important

When I install package wireguard-dkms, it fails to compile the dkms.

I used the following install command:

$ echo "deb http://deb.debian.org/debian/ unstable main" > 
/etc/apt/sources.list.d/unstable.list
$ printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > 
/etc/apt/preferences.d/limit-unstable
$ apt update
$ apt install linux-headers-next-sunxi wireguard

The relevent dpkg output is:

Loading new wireguard-0.0.20180718-1 DKMS files...                              
     
dpkg: warning: version '3.4.113-sun8i     
4.14.18' has bad syntax: invalid character in revision number                   
     
Building for 4.14.18-sunxi                
Building initial module for 4.14.18-sunxi 
Error! Bad return status for module build on kernel: 4.14.18-sunxi (armv7l)     
     
Consult /var/lib/dkms/wireguard/0.0.20180718-1/build/make.log for more 
information.

The content of the make.log file is:

DKMS make.log for wireguard-0.0.20180718-1 for kernel 4.14.18-sunxi (armv7l)
Sun Jul 29 02:31:42 UTC 2018
make: Entering directory '/usr/src/linux-headers-4.14.18-sunxi'
Makefile:631: arch//Makefile: No such file or directory
make: *** No rule to make target 'arch//Makefile'.  Stop.
make: Leaving directory '/usr/src/linux-headers-4.14.18-sunxi'

However, I can compile and install that dkms module successfully by running 
`dkms build -m wireguard -v 0.0.20180718-1 -k 4.14.18-sunxi`.

Further investigation into the dkms package, I found the following script:

# dkms_common.postinst, line 227
if [ -n "$ARCH" ]; then
    if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then
        case $ARCH in
            amd64)
                ARCH="x86_64"
                ;;
            lpia|i?86)
                ARCH="i686"
                ;;
        esac
    fi
    echo "Building for architecture $ARCH"
    ARCH="-a $ARCH"
fi

which means if $ARCH is empty, it is going to be empty through the whole 
building process, passed into the Makefile, resulting in a build failure. This 
might be the problem I'm experiencing on an armv7l machine. 

I suggest that the $ARCH variable be unset if it exists and is empty in the 
postinst script, so dkms can figure out the arch itself. Also, why dpkg passed 
an empty string to the 4th argument of dkms_common.postinst (the $ARCH variable 
at dkms_common.postinst line 140) might need further investigation as it is 
likely to cause other issues if the installation is an upgrade rather than a 
new installation.

I am using Debian GNU/Linux 9.5 
(Armbian_5.38_Orangepipc_Debian_stretch_next_4.14.14), kernel 4.14.18-sunxi.

Reply via email to