I have a problem with Bluetooth not working at startup, in Rasbian Stretch on RPi Zero W. On the desktop toolbar, Bluetooth says it's enabled. But when I try to use it through the blueST-SDK API in a Python script, it gives me a permissions error ("Bluetooth scanning requires root privilege", even though I am running as root). If I use the GUI button to turn Bluetooth off and then on, everything works.
I would like to cycle Bluetooth on and off in this same way with a shell command, so that my program will function in automated fashion, without having to manually cycle Bluetooth first. But everything I've tried in the terminal doesn't have the same effect. I've tried:
sudo systemctl stop bluetooth (+ start)
sudo /etc/init.d/bluetooth stop (+ start)
rfkill block bluetooth (+ unblock)
All of these fail to truly enable bluetooth in the end. Only using the GUI button actually works. Any clues about what I'm missing?