My database connection appears to be invalid?



  • Server
    • FOG Version: 1.3.0 RC19
    • OS: Centos 7
    Client
    • Service Version:
    • OS:
    Description

    I got a FOG server all set up over the weekend at home, using a Dell E6520 laptop connected to my home WiFi. I believe I configured the installer to use the Ethernet NIC to be the primary interface. Everything seemed to work when browsing the localhost/fog, I could log in etc. Shut the laptop down, and took it to work, and now I get the following error when I browse to the web interface.

    Your database connection appears to be invalid. FOG is unable to communicate with the database. There are many reasons why this could be the case. Please check your credentials in /var/www/html/fog/lib/fog/config.class.php. Also confirm that the database is indeed running. If credentials are correct, and if the Database service is running, check to ensure your filesystem has enough space.
    

    Hmm check to see if database service is running. The following command has a very large output, but I do not recall what database FOG uses. MySQL? MySQL and its daemon are enabled…

    sudo systemctl list-unit-files
    

    I never did setup a database to be activated/run on startup, looking at the install guide located on the wiki here


  • Moderator

    @AngryScientist It would be interesting to know if the contents of your .fogsettings file is messed up and then upgrading caused the installer to look at bad data again??

    My production server is running Centos 7, I think we are on RC34 and that upgraded cleanly.


  • Senior Developer

    @AngryScientist Are you sure it wasn’t:

    systemctl start mysql or even systemctl start mariadb?

    I’m trying to validate what the problem is here, and I’m fairly sure we’d have seen a bunch of issues with this operationally speaking. (We have a bunch of people using CentOS 7).



  • @Tom-Elliott

    Time to un-zombie the thread.

    I updated to RC-36, and same same. I had to sudo systemctl start mysqld to get the database connection running.


  • Senior Developer

    In very simple terms:

    https://wiki.fogproject.org/wiki/index.php?title=Upgrade_to_trunk

    Essentially, open a terminal.

    Cd to the installer directory.

    If you loaded the repo from git, make sure you’re on the dev-branch:

    git checkout dev-branch

    Ensure you’re environment is setup without customizations:

    git reset --hard

    Pull the latest:

    git pull

    Cd to the BIN directory:

    cd bin

    Install as normal.

    ./installfog.sh -y


  • Moderator



  • @Tom-Elliott
    I know how to do a git pull, but what is the official upgrade procedure?


  • Senior Developer

    RC-22 Officially released.

    Please update and hopefully you’ll see all the latest goodies and what not. (Hopefully this will be fixed for you too.)


  • Moderator

    @AngryScientist said in My database connection appears to be invalid?:

    Right now I am reveling in the wonders of 5GBps imagine speed. 1.2.0 on my old hardware topped out at 1.2GBps

    A lot of that has to do with the performance improvements of FOG 1.3.0 RC, a change was made to how the images are compressed and decompressed for imaging and some people reported 50 to 100% speed increases.



  • @Wayne-Workman

    systemctl enable mysqld
    

    Typo correction!

    I will reboot my FOG server later today and give you the results of your suggestions. Right now I am reveling in the wonders of 5GBps imagine speed. 1.2.0 on my old hardware topped out at 1.2GBps


  • Moderator

    In centos 7 the way to start maridadb on boot is probably:
    systemctl eanble mysqld

    I’m still waiting to hear back on the commands I posted.


  • Moderator

    This post is deleted!

  • Testers

    This post is deleted!

  • Testers

    This sounds like a mariaDB (aka mySql) issue. And it sounds like it’s just not configured to start on startup if systemctl start mysqld.service fixes it. This article might could help.
    https://mariadb.com/kb/en/mariadb/starting-and-stopping-mariadb-automatically/

    I thought that the database got configured to automatically start on the apt-get/yum install.
    I have cent os 7 and have never had to do any sort of configuration for fog services to run on startup.


  • Moderator

    This post is deleted!

  • Moderator

    @AngryScientist said in My database connection appears to be invalid?:

    @Wayne-Workman
    Okay, sorry Wayne, your post got lost in my text walls.

    [ullsadmin@localhost ~]$ mysql -D fog
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    

    This is beyond my knowledge…
    EDIT: Restarting mysqld fixed the issue. Now I will see if it stays after reboot…
    EDIT2: It does not stay, boooo.

    I have the exact same error now… great.

    @Tom-Elliott Moving this to bug reports.


  • Moderator

    @AngryScientist When it throws the error again, try these and see if one works:

    mysql -D fog -u root -h localhost

    mysql -D fog -u root -h 127.0.0.1



  • @Wayne-Workman
    Okay, sorry Wayne, your post got lost in my text walls.

    [ullsadmin@localhost ~]$ mysql -D fog
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    

    This is beyond my knowledge…
    EDIT: Restarting mysqld fixed the issue. Now I will see if it stays after reboot…
    EDIT2: It does not stay, boooo.


  • Moderator

    @AngryScientist In permissive mode, SELinux generates messages as it would in enforcing, but it doesn’t take any action to block anything whatsoever. Please try what I posted below.



  • Pulled from git for RC21, Fixed errors in the fogsettings file. During installation, a selinux alert was generated:

    SELinux is preventing /usr/bin/passwd from ioctl access on the file /home/ullsadmin/git/fogproject/bin/error_logs/fog_error_1.3.0-RC-21.log.
    
    *****  Plugin catchall (100. confidence) suggests   **************************
    
    If you believe that passwd should be allowed ioctl access on the fog_error_1.3.0-RC-21.log file by default.
    Then you should report this as a bug.
    You can generate a local policy module to allow this access.
    Do
    allow this access for now by executing:
    # grep passwd /var/log/audit/audit.log | audit2allow -M mypol
    # semodule -i mypol.pp
    
    Additional Information:
    Source Context                unconfined_u:unconfined_r:passwd_t:s0-s0:c0.c1023
    Target Context                unconfined_u:object_r:user_home_t:s0
    Target Objects                /home/ullsadmin/git/fogproject/bin/error_logs/fog_
                                  error_1.3.0-RC-21.log [ file ]
    Source                        passwd
    Source Path                   /usr/bin/passwd
    Port                          <Unknown>
    Host                          localhost.localdomain
    Source RPM Packages           passwd-0.79-4.el7.x86_64
    Target RPM Packages           
    Policy RPM                    selinux-policy-3.13.1-60.el7_2.9.noarch
    Selinux Enabled               True
    Policy Type                   targeted
    Enforcing Mode                Permissive
    Host Name                     localhost.localdomain
    Platform                      Linux localhost.localdomain
                                  3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24
                                  16:09:20 UTC 2016 x86_64 x86_64
    Alert Count                   2
    First Seen                    2016-11-05 22:11:37 EDT
    Last Seen                     2016-11-08 12:24:57 EST
    Local ID                      b2bddb79-8259-42e5-b4d2-2b432292d6b6
    
    Raw Audit Messages
    type=AVC msg=audit(1478625897.821:682): avc:  denied  { ioctl } for  pid=5594 comm="passwd" path="/home/ullsadmin/git/fogproject/bin/error_logs/fog_error_1.3.0-RC-21.log" dev="dm-0" ino=35560553 scontext=unconfined_u:unconfined_r:passwd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file
    
    
    type=SYSCALL msg=audit(1478625897.821:682): arch=x86_64 syscall=ioctl success=no exit=ENOTTY a0=1 a1=5401 a2=7ffd1070e6e0 a3=7ffd1070e670 items=0 ppid=5118 pid=5594 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=1 comm=passwd exe=/usr/bin/passwd subj=unconfined_u:unconfined_r:passwd_t:s0-s0:c0.c1023 key=(null)
    
    Hash: passwd,passwd_t,user_home_t,file,ioctl
    

    The file was still written however, and the last few entries indicate a problem with the database as well…

    --2016-11-08 12:49:27--  (try: 5)  http://10.6.6.6//fog//maintenance/backup_db.php
    Connecting to 10.6.6.6:80... connected.
    HTTP request sent, awaiting response... 
    

Log in to reply
 

412
Online

39002
Users

10717
Topics

101762
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.