I've found the following command line always works ok, first time, any time. Somethingabout First Mode seems rekey perhaps?
raspistill -t 1 -md 3 -bm -ex off -ag 1 --shutter 200000 -ISO 800 -st -o /home/astroberry/Desktop/long.jpg
Ok, done some testing today. Neither burst mode or hard setting a mode seems to help. Also I see that when I use raspistill to get a 5 s exposure it can take up to 45 seconds. That is really strange I think.
Yeah. That one had me stumped for a while. Seems that raspistill will go through several frames (around 7 of them) before it presents the final frame to the user. Each frame is the length of the exposure time that has been set. That is the very reason for implementing raspiraw in my driver after attempting to use raspistill.
For me, as written, the image is saved after about 1 second longer than the set exposure length. ie for a 5 second it takes 6.
If I remove the -bm, it gets a little longer.
if I remove -ex off, it does indeed get very much longer.
Just to make sure, when you say the image exposure does not change. You have turned of the stretch-button in the FITS-viewer then, otherwise the stretch function will normalize the exposure, with more or less noise as a side-effect.
I'm finding that if I start EKOS and go straight to the camera exposure tab, change gain first to anything 1 or higher, then change exposure to something long. It will give me a true long exposure straight away, and carry on doing so for the session.
Ive found you must not touch the exposure before the gain, as the moment exposure has been entered, a test image is captured automatically, which prevents future long exposures.
The command line I gave before still continues to be 'foolproof'.