[Fresh new installation] Your database connection appears to be invalid

  • Server
    • FOG Version: 1.3.4
    • OS: CentOS 7 (1611)
    • Service Version:
    • OS: Windows 7 Pro x64

    Good day,
    I’ve learned recently about FOG project and found it very promising - so much, that it would be nice, if it could solve our obsolete and tiring image deployment process at our university, which is in sore need of upgrade (we currently have obsolete version of Symantec Ghost Solution Suite - which does not support PXE, so running around whole campus with flash drive, setting up cloning client at each computer manually before new start of semester, then manually renaming the machines, … you get the idea).

    I’ve decided to go with CentOS 7 server - had already downloaded latest installation img file, so I didn’t bothered with another distro.

    I’ve also followed installation guide on wiki to the letter (please note; I do not have any experience with Linux systems whatsoever, though I would like to think, that I am not an complete idiot with Linux terminal) from start to end and after installation everything seems to run fine (though I did not try booting up another computer via PXE yet). But the problem start, when I reboot virtual machine - when OS boots up, web management does not work anymore and I get the “Your database connection appears to be invalid” message; installing whole thing to just start it up does not seem to be good solution - there must be an easier way to start FOG services (and web management) after reboot.

    So - any ideas where I’ve might gone wrong, or what can I do with this?

    Also - don’t get me wrong, I’ve already tried older threads with this problem - didn’t helped though (and let us hope that I - and my inexperience with Linux systems - am not the sole reason why FOG does not run properly after reboot).

    Thank you in advance.

  • Thank you guys, it seems like you kicked me in to the right direction. I remade whole server to be sure, reinstalled FOG using wiki guide and as far as the startup script go, I just needed to write this:

    sleep 30
    touch /var/lock/subsys/local
    systemctl start mysql
    exit 0

    I was just dumb enough to not realize, that you need to write this script only in case, when something does not work. Well, sorry about that :)

    Now everything seems to run fine - I don’t need to do a damn thing even after a reboot. Nice!

    As to why I needed to do these timing stuff in the first place - since you all claim that CentOS is otherwise rockstable - I seriously don’t know myself. If you want to look into it, I don’t mind to cooperate with you guys.

    Thank you guys!

  • @george1421 Right. Generally CentOS 7 has been rock solid. The installer does no such delay-magic. The delay stuff is only needed when services fail to start on boot.

  • Moderator

    @Wayne-Workman I would say I never heard of a timing issue for mysql (mariadb) with centos. My fog server is running on centos 7.3 as a VM and I didn’t have to do any of this delay start stuff (unless the installer is doing it behind the scenes).

  • @HaRD The steps to delay those services don’t include mysql, you would just add it into those steps.

    Read what the lines say. First one disables FOGMulticastManager, FOGSheduler, FOGSnapinReplicator, and FOGImageReplicator. The next line disables nfs-server, next one disables rpcbind. You just need to add mysql to the list.

    Same goes for /etc/rc.d/rc.local Just modify it to start mysql after 30 seconds too.

    Also, this would be the first time I’ve ever heard of a timing issue with MySQL on CentOS 7.

  • @Wayne-Workman Thank you for your reply; I just got to work and tried your advice as first step - an seems like you were right. After typing command for MySQL restart, web GUI works.

    Which means that I’ve done something wrong with that startup delay script you mentioned (I’ve said in the first post, that I’ve followed wiki instructions - including Post Config).

    I tried to follow those instructions again, doing this:

    I log in, open terminal, and then type this:

    sudo su
    <type in root pwd>

    Then I copy/paste from wiki these commands:

    systemctl disable FOG{MulticastManager,Scheduler,SnapinReplicator,ImageReplicator}
    systemctl disable nfs-server
    systemctl disable rpcbind

    I already have created script, which is mentioned in wiki, so I don’t bother with re-creating it anew and then I just put in:

    chmod +x /etc/rc.d/rc.local

    Then I close the terminal and reboot the system. And now system is stuck at booting with this (seems like script wasn’t running at all previously):
    1_1488454569610_Scr02.jpg 0_1488454569610_Scr01.jpg

    So, what went wrong this time?

  • @HaRD said in [Fresh new installation] Your database connection appears to be invalid:

    when OS boots up, web management does not work anymore and I get the “Your database connection appears to be invalid”

    That means apache is running fine because this message is delivered through the web interface.

    First thing to try is to restart mysql with systemctl restart mysql see if that fixes it. If so, you have a timing issue. All you need to do is delay mysql’s startup by maybe 30 seconds. There’s a writeup on how to do that in CentOS 7 for other services here, just put mysql into the list. https://wiki.fogproject.org/wiki/index.php?title=CentOS_7#Post_Config_.28Optional.29

  • @george1421 We’ll see. If it won’t work, then we can try something else. In any case, I will give a feedback; and either my problem will be succesfully solved, or not - and in that case I will humbly ask for another solution.

  • Moderator

    @HaRD Just be aware that it may not be the http (web server) that’s at fault, it may be instead the database server. In that case you would want to do a systemctl enable mysql and systemctl start mysql

  • @george1421 Ohh, that is nice. Sorry for the lame-ish question :-) I will give it a try and then report back - hopefully with my problem solved.

    Thank you and good night!

  • Moderator

    @HaRD Well these commands tell centos/rhel to start the web server on every reboot. That is the enable command.

    This command tells centos to set the http server to auto start.
    systemctl enable httpd

    and this command tells centos to restart the service now.
    systemctl restart httpd

    this command tells centos to stop the http start now.
    systemctl start httpd

    This command tells centos to stop the http service
    systemctl stop httpd

  • @george1421 Exactly - if I reinstall FOG, then the web GUI starts working fine, until another system reboot.
    Question (since I am already at home and I do not have working VPN setted up to try this) - if I do understand well enough, these commands are needed to enter after every reboot? Under assumption that this WILL work; can I just write these as part of startup script, which was mentioned in wiki ( https://wiki.fogproject.org/wiki/index.php?title=CentOS_7 - bottom of the page)?

    Thank you.

  • This post is deleted!

  • Moderator

    @HaRD Just to be clear here, if you “reinstall” FOG a second … third… time, the web gui is available until you reboot?

    If this IS the case then from the linux command prompt enter the following command:
    systemctl enable httpd

    and then to restart the web server (if needed)
    systemctl restart httpd

Log in to reply