This packaging tool (nvidia-legacy340-kernel) is not properly maintained or tested, and latest 340.x legacy is not 340.104 but 340.107
See
here for
32bit and
64bit legacy drivers.
I did manually install the 340.107 module from .run file on 4.14.x and it works fine on all kernels from 4.14.80 to 4.14.104 (I don't use 4.4.x kernels, or packaging tools)