Error 1396 while upgrading
-
@xburnerx00 said in Error 1396 while upgrading:
Yes, I re-ran installer making sure to use sudo
Don’t use sudo directly to call the installer. Switch to a full root user environment (e.g. via
sudo su -
orsudo -i
) and run the FOG installer from there.Just doesn’t make sense why it would say
Operation CREATE USER failed for ''@'localhost'
(username before the @ obviously being empty)!?Please run
cat /root/fogproject/tmp/fog-db-and-user-setup.sql
and post the full output here. Be aware there are two lines with a password in it - look forIDENTIFIED BY
and mask the passwords in the output. -
@sebastian-roth
I was already running installer with sudo -i, but I also went back and tried it with sudo su - but with same result. Ran command. I deleted the passwords for this post.[root@fogserver bin]# cat /root/fogproject/tmp/fog-db-and-user-setup.sql SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI' ; DELETE FROM mysql.user WHERE User='' ; DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1') ; DROP DATABASE IF EXISTS test ; DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; CREATE DATABASE IF NOT EXISTS fog ; USE fog ; DROP PROCEDURE IF EXISTS fog.create_user_if_not_exists ; DELIMITER 7061 CREATE PROCEDURE fog.create_user_if_not_exists() BEGIN DECLARE masteruser BIGINT DEFAULT 0 ; DECLARE storageuser BIGINT DEFAULT 0 ; SELECT COUNT(*) INTO masteruser FROM mysql.user WHERE User = '' and Host = 'localhost' ; IF masteruser > 0 THEN DROP USER ''@'localhost'; END IF ; CREATE USER ''@'localhost' IDENTIFIED BY '' ; GRANT ALL PRIVILEGES ON fog.* TO ''@'localhost' ; SELECT COUNT(*) INTO storageuser FROM mysql.user WHERE User = 'fogstorage' and Host = '%' ; IF storageuser > 0 THEN DROP USER 'fogstorage'@'%'; END IF ; CREATE USER 'fogstorage'@'%' IDENTIFIED BY '' ; END ;7061 DELIMITER ; CALL fog.create_user_if_not_exists() ; DROP PROCEDURE IF EXISTS fog.create_user_if_not_exists ; FLUSH PRIVILEGES ; SET SQL_MODE=@OLD_SQL_MODE ; [root@fogserver bin]#
-
@xburnerx00 I still am very much at a loss on why the DB username is empty while it shouldn’t be. I will go through the installer code again and see what I can find.
Did you extract the installer from ZIP or tar.gz or is this a repo clone from GitHub?
-
I have done an update before. I forget what the beginning version for me was, but I believe I may have done that install with tar.gz. I was following the installation instructions from the wiki. When I updated to 1.5.9RC1, just before last summer I believe, I did that one through github. I only say that because I remember asking to have that site open since our firewall was blocking it. Now I am using github to update. I ran these commands for the update I am attempting now from another post.
cd /root/fogproject
git checkout master
git pull
cd bin
./installfog.shSeparate thing I noticed was that I was trying to use the GUI to navigate to the .sql file but it has an X on the root folder.
Not sure if that means anything. I cannot open it. Forgive me for not being more in depth if needed, I am new to linux.
-
@xburnerx00 said in Error 1396 while upgrading:
[root@fogserver bin]# grep snmysqluser /opt/fog/.fogsettings
snmysqluser=‘fogstorage’I went over this too quickly because at first I expected the variable to be empty and so I didn’t quite notice it to be set to
fogstorage
which is not the default on a FOG master node but usually on a FOG storage node. Do you remember manually adjusting the DB username in/opt/fog/.fogsettings
at some point?While I still don’t understand why this would cause this exact error I am wondering what you get when running
grep DATABASE_USERNAME /var/www/html/fog/lib/fog/config.class.php
As well run
git status
to see if you have any local modifications in the repo. If the output is empty, it’s all fine.The git commands used seem fine and /root not being accessible in the GUI is right too.
-
I may have changed something during that first update, I vaguely remember changing a username.
[root@fogserver bin]# grep DATABASE_USERNAME /var/www/html/fog/lib/fog/config.class.php define('DATABASE_USERNAME', ''); You have new mail in /var/spool/mail/root [root@fogserver bin]#
[root@fogserver fogproject]# git status # On branch master nothing to commit, working directory clean
-
@xburnerx00 Please try the following: Edit
/opt/fog/.fogsettings
(as root) and setsnmysqluser='fogmaster'
. Then re-run the installer. -
@sebastian-roth
I changed snmysqluser to ‘fogmaster’. It was previously ‘foguser’. Re-ran installer. It stopped at same error.Failed! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! The installer was not able to run all the way to the end as !! !! something has caused it to fail. The following few lines are !! !! from the error log file which might help us figure out what's !! !! wrong. Please add this information when reporting an error. !! !! As well you might want to take a look at the full error log !! !! in /root/fogproject/bin/error_logs/fog_error_1.5.9.log !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! chsh: Shell not changed. Changing shell for fogproject. New password: Retype new password: Changing password for user fogproject. passwd: all authentication tokens updated successfully. ERROR 1396 (HY000) at line 31: Operation CREATE USER failed for ''@'localhost' [root@fogserver bin]#
-
@xburnerx00 said in Error 1396 while upgrading:
I changed snmysqluser to ‘fogmaster’. It was previously ‘foguser’.
I thought it was ‘fogstorage’?! Something is very strange here.
Now let’s see if we can get your FOG web UI back up by manually editing
/var/www/html/fog/lib/fog/config.class.php
. We saw the DATABASE_USERNAME was empty too. Put infogstorage
(as we had that in fogsettings initially I think), make sure a non-empty password is defined the line below the username, save the file and try to open the FOG web UI URL in your browser. No restart of services needed. -
@sebastian-roth
I set the name ‘fogstorage’. There was already a randomly generated password in the line below.No success opening WebUI.
private static function _dbSettings() { define('DATABASE_TYPE', 'mysql'); // mysql or oracle define('DATABASE_HOST', 'localhost'); define('DATABASE_NAME', 'fog'); define('DATABASE_USERNAME', 'fogstorage');
-
@xburnerx00 Do you know the DB root password? Can you login to the database in the console?
mysql -u root -p
(if you don’t know the DB root password try just ENTER for an empty password - but the 1.5.9-RC1 installer should have forced you to set one on CentOS I think)You can also try out different usernames in config.class.php… fogmaster, root - see if any of those works.
I am still scratching my head in what happened here.
-
Yes, I know the root password.
[root@fogserver ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
-
@xburnerx00 From the mysql root shell run this query and post results here:
SELECT * FROM mysql.user;
-
@sebastian-roth
I changed the passwords for this post.MariaDB [(none)]> SELECT * FROM mysql.user; +-----------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+ | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | +-----------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+ | localhost | root | *7FB1F1B8AD1B4CFD57ERT8E761B6ADFF70D04FA0 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | | | | 127.0.0.1 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | | ::1 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | | % | fogstorage | *35C8661957485DE278FFGH9B7C348770BB41AD4C | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | | | +-----------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]>
-
Found and fixed - the
.fogsettings
file was clearly corrupted causing this issue. Very sure this was due to manual editing.