could not open the device file /dev/nvidiactl

I had exactly the same issues with the driver 340.29.

Tried changing permissions:

chmod 666 /dev/nvidia*

nvidia-smi was working for root but not for any other user. so eventually I had to modify /etc/modprobe.d/50-nvidia.conf

options nvidia NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=33 NVreg_DeviceFileMode=0666 NVreg_ModifyDeviceFiles=1

The problem was resolved with the last variable.

Remember to delete the files /dev/nvidia*

Then it works for all users