Cannot build database

For anyone trying to leave the /var/tmp, /tmp in tmpfs (to save SD card life) and get this to work, you might want to check your permissions. Somehow something was causing the /tmp to have 0755 which didn't allow anyone except root to write stuff. I followed this gist Fix ignored mode of tmpfs mount on /tmp and everything works as it should now.

This is my fstab. I will increase the size on demand if I encounter any errors with writing again.

tmpfs		/tmp		tmpfs   defaults,noatime,nosuid,size=100M    0 0
tmpfs		/var/tmp	tmpfs	nodev,nosuid,size=100M 0 0