Fresh Install Debian 10, Installed fog getting "Database connection unavailable"



  • Looked at all the others links on this but none have worked for me.

    Using:
    Intel® Xeon® CPU X5450 @ 3.00GHz, 4 cores
    32gb Memory
    8TB drive space
    Debian 10
    Apache version 2.4.38
    MySQL version 10.4.6-MariaDB

    Have a password for MariaDB and it is in /opt/fog/.fogsettings from what I can tell it is not creating the db in MariaDB.

    I have used Fog for many years and it works great. This started when Ubuntu updated their files last week and I tried to fix before looking here… I saw the “Ubuntu is FOG’s enemy” link and moved to Debain and MariaDB as suggested but just cannot get it to run.

    Get this on fog page:
    72fa6220-dbb6-4f33-8dcd-970556bcbcb3-image.png

    It Fog Server does not fail on install.

    Let me know what you need and how to get it please. I can do basic stuff but not anywhere near an expert.

    Thank you, Moe.



  • Make as solved please, I can image. Thank you for the help.



  • Ok I will, ya the grant access one worked. this one:

    mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ IDENTIFIED BY “your-password”;
    mysql> FLUSH PRIVILEGES;


  • Senior Developer

    @MTrejo2019 Please open a new topic on this fresh issue. People will find answers more easily if we don’t discus several issues in one thread.

    Let us know if you manually installed and configured the DHCP server as well. Post config in the new topic.



  • Boot to network and get I get asked for TFTP server. I can enter the server ip and it continues. I am using ISC DHCPd version 4.4.1.


  • Senior Developer

    @MTrejo2019 Which one’s that? The GRANT ACCESS ...? Wouldn’t have expected that.



  • That command worked. Installed db and can get into interface, will let you know it I can image soon. Thanks for the help, Moe.

    42a0f669-e071-4163-942c-91f95f3eb224-image.png


  • Senior Developer

    @MTrejo2019 You seem to manually have installed a different MariaDB version. Mine says Server version: 10.3.15-MariaDB-1 Debian 10

    For my version I was able to set the password the following way:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY "your-password";
    mysql> FLUSH PRIVILEGES;
    

    This might not work with MariaDB >10.4. But give this a try: https://www.reddit.com/r/sysadmin/comments/avx1u6/how_to_change_the_root_password_with_mariadb_104/


  • Senior Developer

    @MTrejo2019 Yes, if you re-run the installer it tries to make a backup copy of the database and because the DB fog is not created yet it fails.



  • Found this in the apache2 error log:

    [Thu Jul 25 15:02:43.293072 2019] [proxy_fcgi:error] [pid 4063] [client 10.10.2.58:54110] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Exception: Connection to mysql failed with message: SQLSTATE[HY000] [1049] Unknown database ‘fog’ in /var/www/html/fog/lib/db/mysqldump.class.php:282\nStack trace:\n#0 /var/www/html/fog/lib/db/mysqldump.class.php(306): Mysqldump->connect()\n#1 /var/www/html/fog/lib/fog/schema.class.php(200): Mysqldump->start(’/tmp/fog_backup…’)\n#2 /var/www/html/fog/lib/fog/reportmaker.class.php(269): Schema->exportdb(‘fog_backup_2019…’)\n#3 /var/www/html/fog/maintenance/backup_db.php(23): ReportMaker->outputReport(3, true)\n#4 {main}\n thrown in /var/www/html/fog/lib/db/mysqldump.class.php on line 282’
    [Thu Jul 25 15:06:01.089717 2019] [mpm_prefork:notice] [pid 4060] AH00169: caught SIGTERM, shutting down


  • Senior Developer

    @MTrejo2019 Ok, this is not getting us anywhere. Give me some 20 minutes and I will spin up a Debian 10 server and try to figure this out.



  • this error:
    13438aaa-bb8f-41cf-ab23-3ec71d374628-image.png


  • Senior Developer

    @MTrejo2019 And you are able to login using that exact password on the mysql console?

    Please try resetting to the older authentication mechanism:

    mysql> ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'youpassword';
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';
    mysql> FLUSH PRIVILEGES;
    


  • yes it is set there also
    165f7634-7786-424f-9190-a5b79c55b776-image.png


  • Senior Developer

    @MTrejo2019 As I said, really ugly this DB password thing. Seems like MariaDB changed things in version 10.4 as well and this is not working as it used to.

    Please check /var/www/html/fog/lib/fog/config.class.php to see if it has the right password set in that as well. This is the config PHP is using to connect to the database.



  • I have a password set already in MariaDB but tried it and got this error, had to type my password not hit enter only as advised:

    5c0a9d9f-a1d9-45b3-9fae-34be744394c3-image.png

    the password is set in /opt/fog/fogsettings:
    c1fc5dbd-a128-454e-a86d-dd1cf53f9e8f-image.png

    Let me know what you need and I’ll try to get it. Thanks again.


  • Senior Developer

    @MTrejo2019 We have not pushed the changes @george1421 mentioned. We are working on this but it’s not out yet.

    So for now we are in the situation where you can’t install FOG with a database password given to the installer. Very unfortunate! 😞

    If you tell the installer to use a database password it just won’t set it in most cases because setting DB passwords is not working all the same across different versions of MySQL and MariaDB. Or to be more precise: the way it used to work with MySQL 5.7 and older does not work with newer MySQL and MariaDB (don’t quote me on that as I still have not had the time to setup enough different versions to really test). It’s really ugly and I fear we’ll see a lot of this coming down while most Linux systems still work on swapping out MySQL for MariaDB…

    So the best you can do for now with Debian 10 is to manually set the password on the command line - just hit ENTER when it asks for a password:

    shell> mysql -u root -p
    Password:
    ...
    mysql> use mysql;
    ...
    mysql> UPDATE mysql.user SET Password=PASSWORD('your-password-goes-here') WHERE User='root';
    ...
    mysql> FLUSH PRIVILEGES;
    ...
    

    After that you can hit ctrl-d to leave the mysql command shell. Now you should be able to visit the web UI and update the schema (create the database and tables).


  • Moderator

    From within the FOG server’s linux console, can you connect to mysql (MariaDB) via mysql -u root -p fog The password for root should be blank. I know there was talk about the fog installer setting root’s password but I don’t know if that change made it into the last release or not.


Log in to reply
 

402
Online

7.4k
Users

14.5k
Topics

136.7k
Posts