Comment out the chown in 40_firstrun.sh and then post the ownership set on the directories. Show /var/cache/zoneminder and the event, images, and temp directories. I don't understand how the ownership is changing. I suspect I shouldn't be checking just the /var/cache/zoneminder directory. I don't see that on my system.