[FOG 1.6] SQL Install by FOG



  • Hello,

    I have made a fresh install of FOG on Debian 10.
    I have only add SSH during OS install as it was said here : https://wiki.fogproject.org/wiki/index.php?title=Debian_8.

    First, I had message saying I had to have a proper root connection of something like that when using “su” to ring install script…
    I have to install sudo and add my user to sudoers to use “sudo -i”.

    Then, install of FOG installed MariaDB itself but without any password prompt.
    I end with an SQL root password problem and not possible MySQL login in command line.
    GIU was working but I had not idea of hte root password possibly set during install.
    Empty password login to MySQL wasn’t working either.

    I tried to set/reset it but after this install wasn’t ending since it doesn’t ask for root SQL password when .fogsettings exist.

    I had to remove then reinstall MariaDB to set root password before running new FOG install (deleting .fogsettings).

    Am I the only one having this problem ?


  • Senior Developer

    @jmeyer Just pushed the fixes to working-1.6 as well.



  • @Quazz Ok. I’ll use dev-branch.


  • Senior Developer

    @jmeyer Yeah, @Quazz is absolutely right. I did work in this and fixed it in dev-branch but haven’t found the time to do it for working-1.6 as well. Will do so soon!


  • Moderator

    @jmeyer It’s fixed in https://github.com/FOGProject/fogproject/commit/e0449fa268df2d10e3ea66cf78d4bc76da015afb dev-branch, but hasn’t been ported to working-1.6 it seems.



  • @Sebastian-Roth

    I know it’s not a common way to install fog but I still end with access denied for root not using password when using .fogsettings because install isn’t asking for root password when there is one set between two update.

    Not using the fogsetting looks to make install finish.
    Yet, i have few acces denied in error log during install. (5 for root and 1 for fogmaster).
    I hope this is not blocking some db install or update creating my other problem because just after sql & db setting up, mysqld is using all free CPU.


  • Senior Developer

    Finally I figured out that MariaDB version 10.3 behaves different to what I was used when testing the DB security stuff with MariaDB 10.1 and older as well as MySQL. When authentication was set to plugin unix_socket setting a password using mysqladmin just didn’t do anything. It was still password-less socket login as before. This behavior was kind of easy to work with in the installer but I fall in the trap when this changed with newer MariaDB version.

    Now I have changed the installer code to hopefully work across all currently known versions of MariaDB and MySQL in all the distros we support. This is

    Pushed the fix to dev-branch and as well to working-1.6 - so @jmeyer you might give the latest a try.

    In case anyone comes across this and needs to reset the DB root account’s password. Here is one way of doing it that should hopefully work with many versions (have not tested on all myself!):

    systemctl stop mariadb
    mysqld_safe --skip-grant-tables &
    mysql -u root
    mysql> set password='*F79BF61F47F82B65577C6EE20D7471014C4F694D';
    mysql> flush privileges;
    mysql> quit
    mysqladmin -u root shutdown
    systemctl start mariadb
    mysql -u root -p
    

    The password hash used above stands for password changePW!

    In case the above set password... doesn’t work you can try one of the following instead:

    • UPDATE mysql.user SET authentication_string='', password='', plugin='unix_socket' WHERE user='root';
    • ALTER USER root@localhost IDENTIFIED VIA unix_socket;
    • UPDATE mysql.user SET password=PASSWORD(‘changePW!’) WHERE user=’root’;

  • Senior Developer

    @jmeyer Turns out the mysql root lockout is happening on newer versions of MariaDB in Debian 10 and Ubuntu 19.10 (maybe even 19.04). Too bad I didn’t notice the change in behavior in newer versions when I developed the database security measures.

    Still need more time to find why this is actually different between the versions. Will update here soon.

    As a side note: FOG 1.5.8 doesn’t use the DB root account for it’s connection anymore. This is way the web UI is still working. Take a look at /var/www/html/fog/lib/fog/config.class.php to find the DB credentials used. I had a bit of an issue when trying to copy&paste the password to the mysql command in a SSH session. Not sure what exactly is causing this. Typing the password worked but copy&paste didn’t!


  • Senior Developer

    @jmeyer There are a few points. Let me try to answer those one by one.

    First, I had message saying I had to have a proper root connection of something like that when using “su” to ring install script…
    I have to install sudo and add my user to sudoers to use “sudo -i”.

    Using sudo -i is just one of two examples you can use. There is also su - (note that hyphen at the end is very important because it will load the root user’s profile which is needed to run tools like useradd - same will happen when you run sudo -i). I’ve just added a more thorough message to the installer to hopefully make this clear.
    If you switch to the root user with su only you won’t have /usr/sbin in your PATH environment variable and the installer can fail further down the road.

    Then, install of FOG installed MariaDB itself but without any password prompt.
    I end with an SQL root password problem and not possible MySQL login in command line.
    GIU was working but I had not idea of hte root password possibly set during install.
    Empty password login to MySQL wasn’t working either.
    I tried to set/reset it but after this install wasn’t ending since it doesn’t ask for root SQL password when .fogsettings exist.
    I had to remove then reinstall MariaDB to set root password before running new FOG install (deleting .fogsettings).
    Am I the only one having this problem ?

    I was able to replicate this and will see how we can fix it. Won’t be long I am sure.


Log in to reply
 

383
Online

7.4k
Users

14.5k
Topics

136.7k
Posts