When installing the nvidia-387 (387.26; package from http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/) I get this error:
Error! Bad return status for module build on kernel: 4.13.0-38-generic (x86_64)
Consult /var/lib/dkms/nvidia-387/387.26/build/make.log for more information.
the error in the log file:
./arch/x86/include/asm/processor.h:818:39: error: implicit declaration of function ‘task_stack_page’ [-Werror=implicit-function-declaration]
uname - Linux testvm-VirtualBox 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
gcc - gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Also when I tried to install the package in a docker environment to see what’s going on, I got this output -
update-alternatives: using /usr/lib/nvidia-387/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: warning: skip creation of /usr/share/grub-gfxpayload-lists/blacklist/10_proprietary-graphics-drivers because associated file /usr/share/nvidia-387/nvidia-387.grub-gfxpayload (of link group x86_64-linux-gnu_gl_conf) doesn’t exist
update-alternatives: error: error creating symbolic link ‘/usr/lib/nvidia/alternate-install-present.dpkg-tmp’: No such file or directory
dpkg: error processing package nvidia-387 (–configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of libcuda1-387:
libcuda1-387 depends on nvidia-387 (>= 387.26); however:
Package nvidia-387 is not configured yet.
dpkg: error processing package libcuda1-387 (–configure):
dependency problems - leaving unconfigured
This is caused by line 144 in the package’s postinst script (the last line of the update-alternatives command). Seems like the script incorrectly assumes that the folder /usr/lib/nvidia exists (it might not) and the package never actually creates this directory in neither installation scripts nor is it present in the data package.