@michael you have not loaded bbswitch.ko
modprobe bbswitch to verify
or you do not have bbswitch.ko
or your bbswitch.ko was not compiled with your kernel headers
do strings bbswitch.ko | grep vermagic and check with your "uname -r"
Try this modified prime version
https://sourceforge.net/projects/toysbox/files/bionic-nvidia/prime-alagras-richardson_1.gdm3-20200802-ubuntu-20.04_amd64.deb
if your display manager is gdm
or
https://sourceforge.net/projects/toysbox/files/bionic-nvidia/lprime-alagras-richardson_1.lightdm-20200730-xubuntu-18.04.4_amd64.deb
if display manager is lightdm
They both work on my live image without reboot (nvidia-450.57)
But turn off the dGPU on hdd installed ubuntu is another story ;
Even when you have your working module bbswitch.ko (compiled for your running kernel's version) and your nvidia driver well behaved installed ,there is still sometime funny things
Suppose by chance ,after boot your display driver is using intel ,so low power consumption ; you switch to nvidia to play game or fiddling with cuda you probably will never be able to switch off dGPU because it needs
1 all nvidia modules be unloaded
2 kernel power management be disabled
(never true on standard installation).
This prevents bbswitch.ko to switch off ( not "on")
... unless you reboot !
Now to make sure you boot with intel display, put blacklist-nvidia.conf in directory /lib/modprobe.d !
And if you want to experiment a lot with bbswitch
1 put bbswitch.ko into /etc/modules to get it loaded at boot
2 put an option pcie_port_pm=off on kernel cmdline for your grub.conf
to disable kernel power management (not really effective in all situations)
Then go into VT3-6 with ctrl-alt-f3(-6) play with
sudo tee /proc/acpi/bbswitch<<<ON (or OFF )
cat /proc/acpi/bbswitch to verify dGPU status
Experiment in various situations Xserver on / off ...and observe !do it with or without kernel power management option too
have fun