Clients state Error 8: Attempt to write to a readonly database

2,028 views
Skip to first unread message

zack.m...@bsd7.org

unread,
Jun 23, 2014, 6:22:41 PM6/23/14
to munki...@googlegroups.com
Ok, maybe I'm just dumb or maybe my head is foggier than normal (bad weekend and splitting headache as I type), but I adjust the config to read allow_migrate :TRUE. I copied the old Database into the new MunkiReport folder and rebooted server. I got this in a red banner at the top (something along these lines):

SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

What did I do wrong? (I'm assuming me, as most things tend to be user error ;P )

lists.mac

unread,
Jun 23, 2014, 10:30:28 PM6/23/14
to munki...@googlegroups.com
Make sure the apps/db directory is writeable by the web server.

Marnin



--
You received this message because you are subscribed to the Google Groups "munkireport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munkireport...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

zack.m...@bsd7.org

unread,
Jun 24, 2014, 10:31:33 AM6/24/14
to munki...@googlegroups.com
Whelp there it is. Stupid mistake by me xD.
Thanks for the wonderful help (easy spot I'm sure!).
Is there any way to update the Install Manual to have a little more information, it is a little empty to say the least (in terms of a full blow step by step guide), maybe something like so?

Sorry for the trouble!

A.E. van Bochoven

unread,
Jun 24, 2014, 12:29:53 PM6/24/14
to munki...@googlegroups.com
The webserver needs write permissions on the database file AND the folder that contains it.

-Arjen

zack.m...@bsd7.org

unread,
Jul 1, 2014, 5:02:15 PM7/1/14
to munki...@googlegroups.com
As stated stupid me. Thanks for the clarification of my short sighted mistake.

Attached is a script that works great for our munkireport updates. Modify as needed:
 
#Commands Needed for MunkiReport upgrade (NOTE: Make sure to have the config set to update database : True;)
#!/bin/bash
#Remove old backup
rm -rf /Path/to/munkireport_backup/
#Copy old MR-PHP Folder to backup location
cp -r /Library/Server/Web/Data/Sites/Default/munkireport /Path/to/munkireport_backup/;
#Remove all files (Fresh Clean PHP app)
rm -rf /Library/Server/Web/Data/Sites/Default/munkireport;
#Clone current version from Github
git clone https://github.com/munkireport/munkireport-php.git /Library/Server/Web/Data/Sites/Default;
#Copy old database and config into place
cp /Path/to/munkireport_backup/app/db/db.sqlite /Library/Server/Web/Data/Sites/Default/munkireport/app/db;
cp /Path/to/munkireport_backup/config.php /Library/Server/Web/Data/Sites/Default/munkireport;
#Establish permission rights ( ;P thanks to this article)
chown -R _www /Library/Server/Web/Data/Sites/Default/munkireport/app/db;
#Install the latest Munki Client
#Download the Install Plist to our Munki Repo Directory
curl -s http://example.com/munkireport/index.php?/install/plist -o /Path/to/munki_repo/pkgsinfo/Munki/MunkiReport.plist;

I am typing this up from a half thought, feel free to adjust. I haven't had a full chance to test it yet, but this should remove the old backup, create a backup then download new munki report from github, followed by moving the config and database back in before giving the correct perms. I'll test it here in a little bit, but it looks good to me.

A.E. van Bochoven

unread,
Jul 1, 2014, 5:05:42 PM7/1/14
to munki...@googlegroups.com
If you’re using git anyway, why not just do a git pull?

zack.m...@bsd7.org

unread,
Jul 1, 2014, 5:29:50 PM7/1/14
to munki...@googlegroups.com
By no means am I a git expert. This was just a solution that works for me, clearly not the best. I haven't really read fully up on using git (except to clone repos). I'll look more into that later today. This was just really a record of all the terminal commands I used last time I updated MR-PHP.
Reply all
Reply to author
Forward
0 new messages