Lion Server | Quick and dirty way to solve “error reading settings”

“error reading settings”

If you ever had this message in Server App then you’re like me … and many others.

This is a pgsql database corruption. I’ve spent hours to solve this, cloned back entire systems etc… until I found this dirty but working method.

Symptoms are :

in Server.app
profile manager : "error reading settings"
wiki : "error reading settings"
web : "error reading settings" (not always)

you just can’t have ssh check box to be checked !

in Server Admin.app

DHCP refuse to start
DNS refuse to start

or in Terminal

any command like serveradmin start, stop status for
wiki devicemngr web dns dhcp postgre etc… shows something like “CANNOT_LOAD_BUNDLE_ERR”
sh-3.2# serveradmin start postgre
postgre:error = “CANNOT_LOAD_BUNDLE_ERR”

note1:

Even if it then states that DNS or DHCP is not working it is hopefully, meaning this leaves you some time to investigate act or come to the server to get your hands on it and try to fix things.
This is not true for the profile manager the wiki and sometimes the web service.

note2:

In other word, if when launching Server Admin DNS is greyed out and not green then you have a pb.
This is how I often realise the pb, as my monitoring App (Lithium5) is watching named service and as I said named works but DNS is stated not working and refuse to launch from Terminal or Server Admin app.

Anyway with time and lots of reading I went to a dirty way to get things back.

prerequities :

The first thing is that you must have allready a (known) good backup of the system. meaning a working profile manager etc… if you don’t, then most likely this dirty tip won’t help you.

So the idea is stopping all services (so all you users must be deconnected from file sharing etc…)
then mount/open/attach you backup image,
move corrupted datas (pgsql),
copy back good datas,
reboot,

note3:

By defaults Datas for pgsql and other services are in /Library/Server.
I first moved this in an other HD but with all th├Ęses annoying repeating rails I finally let them in the system disc.

  • The code below assumes that Server datas is /Library/Server
  • and that you have a backup spareimage or dmg of your system as I said above.

You can either copy paste command do them one by one by hand and then reboot or edit the script with correct path and Volume name and run it with admin privileges.

#!/bin/sh
#
#PGSQL SOS
#need a valid Backup
#mount valid backup cloned DMG
open /Volumes/path/to/your/known/good/server_backup.sparseimage


# stop services
serveradmin stop afp
serveradmin stop web
serveradmin stop devicemgr
serveradmin stop wiki

# restore pgsql part1
cd /private/var/
mv pgsql pgsql.bad

ditto -rsrcFork /Volumes/your_server_backup/private/var/pgsql /private/var/pgsql


# restore pgsql part2
# move to server data directory
# default is /Library/Server/
cd /Library/Server/PostgreSQL
mv Data Data.pre-restore-bad

ditto -rsrcFork /Volumes/your_server_backup/Library/Server/PostgreSQL/Data /Library/Server/PostgreSQL/Data

reboot now

Log back in, launch Server Admin
DHCP DNS should now be showing green dots.

if so, you’r good to go back to work and restart all services you need.

final Note :

this means that each time you do changes in profile manager or related services you should (must) clone the system.

I have daily, weekly and manual clones (with carbon copy cloner) of the system.
I use the manual clone just for that purpose. If you don’t do it, well the dirty trick is then really dirty has this may mess things up with profiles, so be aware !

Again this is a quick and dirty way, but this has saved me lot of pain.

Edit: 2013

I have not had the pb in Mountain Lion Server for now.
Lion Server was an intermediate server between MCX and profile manager and I consider it really buggy for that.

Olivier
About

Product and graphic designer turned to be a Mac SysAdmin.

Posted in Admin, Deploy, Mac, tips tricks scripts Tagged with: , , , , , , ,
2 comments on “Lion Server | Quick and dirty way to solve “error reading settings”
  1. Martinus says:

    Hi,
    Just used your tip to repair a corrupt PostgreSQL DB on a Lion server. I was able to restore a Time Machine backup of the /private/var/pgsql folder, and got the Wikiservice, DNS, Profile manager etc to work again.

    Had to strip the ACL’s from the folder using chmod -R -N /private/var/pgsql first though.

    And I didn’t have a /Library/Server/PostgreSQL/Data folder, as far as I could see from the output of
    serveradmin settings postgresql
    the data is inside the /private/var/pgsql as well (i didn’t check any further, as it worked again already).

    Cheers,
    Martinus

    • oem oem says:

      Hi Martinus,

      great !
      don’t forget it really dirty way to do so. THe older the backup the dirtier the method.
      It can also mess up profile Manager if the Backup is too old and you added stuff since.

      But it has saved me a bit more than once.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>