Unable to switch between graphics cards. Broken nvidia-prime with nvidia-384 driver.

I had nvidia gtx 1060 and kabylake igpu working fine with bumblebee until the the cuda driver rollback or something and ended up with nvidia-384 which started showing nvidia-persistance demon issues and to fix it I almost reinstalled ubuntu 16.04.3 + intel microcode + nvidia 384/375. None of the combination generated successful prime-select(along with prime select I have to work with secure boot too).

Is there any way it can be fixed?
All I need is to have nvidia for cuda(tensorflow/keras) and igpu for everything else

Here is the bug report: https://www.dropbox.com/s/r7by541rrpnv2rl/nvidia-bug-report.log?dl=0
Model: Alienware 13 r3/ kabylake / gtx 1060

According to the logs, everything is set up fine. What doesn’t work, i.e what are the symptoms?

I cant switch between nvidia and intel using prime. Choosing intel kills nvidia persistence demon and stucks until forced reboot. But it seems like enabling secure boot I can use intel using prime .yet to switch back to nvidia I have to disable secure boot which is annoying and I want to configure bumblebee. I can switch between nvidia/intel by adding and removing nogpumanager too.

I hope it could help. I installed all firmware patches before intel/nviidia installation. I installed ubuntu having secure boot disabled

Ok, this clarifies it a bit. I presume by ‘firmware patches’, you’re talking of an uefi aka bios update? Telling by the symptoms you might have run into this:
https://github.com/Bumblebee-Project/Bumblebee/issues/764
Please check if the workaround, using kernel parameters
acpi_osi=! acpi_osi=“Windows 2009”
works for you. Please run acpidump and attach the output file to your post so I can have a look at it.

Hi,
Thanks man. That works. but yet I am getting the same nvidia persistence demon error. It creates error pop ups too when i am logged in. can you explain what the demon do and how this error can be fixed?

Here is my acpidump log: https://www.dropbox.com/s/st0mxk53qnhk942/log?dl=0

I would love to set my laptop with bumblebee and if I could follow this[ https://hemenkapadia.github.io/blog/2016/11/11/Ubuntu-with-Nvidia-CUDA-Bumblebee.html ]
with this tweak in grub, I can use my laptop with igpu for everything unless I call optirun