Host Name/ Active Directory Issue



  • We are in the process of migrating from a old installation of fog .32 on Ubuntu 10.04 to fog 1.2.0 on Ubuntu 14.04. We exported our database and have imported them all on the new box and everything seems to have imported fine. However now we are having a problem with the process that changes machine names and adds them to active directory automatically. I can image machines using the hosts that I have imported and that works fine. But after windows finishes its setup that’s where it stops.

    However I have learned though various testing that if I remove the host from fog and then re-add it via the pxe menu, same name and everything, that it works. Those machines will get their name changed and then be added to the domain without a problem. It may also be important to mention I know that the Active Directory domain username has to be changed to just username not domain\user and I did do this to the machines I reimaged. Is there a solution to this issue?

    Thanks



  • I ended up just adding them to groups and changing them using the group active directory section. Thanks again for all you guy’s help!


  • Developer

    @Andrew134 Something you could do in MySQL as well. No guarantee this is working for all special cases. I only tested this with some values to make sure it usually works! Should not kill your entries if hostADUser has no \ in them. But better make a backup of the hosts table before trying this and/or add WHERE hostID = X to test on single entries first!!

     UPDATE hosts AS h1, hosts AS h2 SET h1.hostADUser = SUBSTR(h2.hostADUser, LOCATE('\\', h2.hostADUser)+1);
    


  • That seems to have done it thanks you guys.

    While I am asking questions, in .32 the domain username had to be in domain\username format, however in 1.2 it was updated to just need the username is there an easy way to update all the hosts or should I just change them when I reimage those machines?


  • Developer

    Thanks Tom! The other option would be to dismiss the WHERE clause altogether and have it set all the modules for all hosts:

    INSERT INTO moduleStatusByHost (msHostID, msModuleID, msState) SELECT hosts.hostID,modules.id,'1' from hosts,modules ORDER BY hosts.hostID,modules.id;
    

    As well I totally agree with what Wayne said about FOG 1.2.0 being dated and looking into FOG trunk or the near release would be a good idea. BUT you still want to have all your hosts and settings in the new system and therefore we better get your DB up and ready for FOG 1.2.0 first and then move on (after taking a full backup!).


  • Senior Developer

    This is needed because the word default is a MYSQL keyword. the backticks “escape” the caller.


  • Senior Developer

    @Sebastian-Roth said:

    INSERT INTO moduleStatusByHost (msHostID, msModuleID, msState) SELECT hosts.hostID,modules.id,‘1’ from hosts,modules WHERE modules.default = 1 ORDER BY hosts.hostID,modules.id;

    Change the line to:

    INSERT INTO `moduleStatusByHost` (`msHostID`, `msModuleID`, `msState`) SELECT `hosts`.`hostID`,`modules`.`id`,'1' from `hosts`,`modules` WHERE `modules`.`default` = 1 ORDER BY `hosts`.`hostID`,`modules`.`id`;
    


  • @Sebastian-Roth I keep getting this error message when I attempt to run the the last command.

    ERROR 1054 (42S22): Unknown column ‘modules.default’ in ‘where clause’

    Any ideas?


  • Developer

    @Andrew134 said:

    Update: went to old server and the modules table does not exist in the database.

    Ok, so now at least we know why… I don’t know the older FOG versions at all. I guess I could look into the code but it’s of no use because as a matter of fact you don’t seam to have the table(s) on the old database.

    I guess you better go for populating the missing DB tables yourself:

    mysql> INSERT INTO `modules` VALUES
        (1,'Directory Cleaner','dircleanup','This setting will enable or disable the directory cleaner service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (2,'User Cleanup','usercleanup','This setting will enable or disable the user cleaner service module on this specific host.  If the module is globally disabled, this setting is ignored.  The user clean up service will remove all stale users on the local machine, accept for user accounts that are whitelisted.  This is typically used when dynamic local users is implemented on the workstation.',1),
        (3,'Display Manager','displaymanager','This setting will enable or disable the display manager service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (4,'Auto Log Out','autologout','This setting will enable or disable the auto log out service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (5,'Green FOG','greenfog','This setting will enable or disable the green fog service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (6,'Snapins','snapinclient','This setting will enable or disable the snapin service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (7,'Client Updater','clientupdater','This setting will enable or disable the client updater service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (8,'Host Registration','hostregister','This setting will enable or disable the host register service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (9,'Hostname Changer','hostnamechanger','This setting will enable or disable the hostname changer module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (10,'Printer Manager','printermanager','This setting will enable or disable the printer manager service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (11,'Task Reboot','taskreboot','This setting will enable or disable the task reboot service module on this specific host.  If the module is globally disabled, this setting is ignored.',1),
        (12,'User Tracker','usertracker','This setting will enable or disable the user tracker service module on this specific host.  If the module is globally disabled, this setting is ignored.',1);
    

    and

    mysql> DELETE FROM moduleStatusByHost;
    mysql> INSERT INTO moduleStatusByHost (msHostID, msModuleID, msState) SELECT hosts.hostID,modules.id,'1' from hosts,modules WHERE modules.default = 1 ORDER BY hosts.hostID,modules.id;
    

    This will enable all the (default) modules for all your hosts in one go!


  • Moderator

    You can certainly continue on the road of installing 1.2.0, but it’s becoming dated. And a lot of newer devices will not work with it.

    Our senior developer, @Tom-Elliott says that you can upgrade to FOG Trunk from any version of fog without issue, even version 0.01. And newer hardware works with FOG Trunk, and it has better partition handling, and massive speed and performance improvements over past fog versions. We believe it’s close to release as well - but that being said, it’s the developmental version and there will be bugs, you just report them here and they are usually fixed in under an hour - the longest I’ve seen it take is a few days. (compare that to months with Google, half a year to a year with Microsoft)

    I’d say if you’re building a brand new server, try trunk?



  • @Sebastian-Roth You may be on to something. I ran the command with a old host and then one I re-added and got this.
    0_1459262584358_Modules_status.txt
    Any ideas on how to fix this? Or should we try again with the old database? We still have the old fog server in place where I can check for these records as well.

    Update: went to old server and the modules table does not exist in the database.


  • Developer

    @Andrew134 said:

    It may be important to note that when I re-added the host and let it boot up it changed the name and added the machine to AD without the need to reimage it again.

    Thanks for mentioning! I think this should lead us where to look for the reason. I have to admit that I don’t know FOG 0.32 much at all. That was long before I joined in. FOG 1.2.0 (as well as current FOG trunk) have a mysql table storing which services are enabled for each host. It’s called ‘moduleStatusByHost’. Maybe FOG 0.32 didn’t have that table or it was not ex/imported properly?! Check the host’s services settings either via web gui (Host Management -> select a host -> Service Settings (menu on the left)):

    mysql> SELECT modules.name,moduleStatusByHost.msState FROM modules,moduleStatusByHost
                  WHERE moduleStatusByHost.msModuleID = modules.id AND moduleStatusByHost.msHostID = 1738;
    +-------------------+---------+
    | name              | msState |
    +-------------------+---------+
    | Directory Cleaner | 1       |
    | Printer Manager   | 1       |
    | Task Reboot       | 1       |
    | User Tracker      | 1       |
    | Auto Log Out      | 1       |
    | Green FOG         | 1       |
    | Snapins           | 1       |
    | Client Updater    | 1       |
    | Host Registration | 1       |
    | Hostname Changer  | 1       |
    +-------------------+---------+
    10 rows in set (0.01 sec)
    

    You definitely want to see “Hostname Changer” enabled… Otherwise renaming (and AD join) won’t work.



  • @Tom-Elliott Here are the files requested
    0_1459194090504_Host_not_Working2.txt Before re-add
    0_1459194104393_Host_Working2.txt after re-add



  • This post is deleted!

  • Senior Developer

    @Andrew134 I know I’m asking a lot, but would you mind doing the same query, but instead of using ; as the ending can you use \G as the ending.

    It makes it much nicer to read and follow when there’s a TON of columns to print.



  • @Sebastian-Roth Here are the files from the command
    0_1459173168284_host_not_working.txt
    0_1459173182166_host_working.txt

    I was not able to locate any differences besides deployment times and hostImage. It may be important to note that when I re-added the host and let it boot up it changed the name and added the machine to AD without the need to reimage it again.


  • Developer

    @Andrew134 What I get from your description it seams like the only difference is the host information being imported at first (rename and AD not working) and then deleted/re-registered (rename IS working), right?!

    So I’d go and look exactly at what is in the database. Either use phpmyadmin or the command line client. Choose one of the imported hosts that you know is having the issue. Go to Host Management on the web interface and click that host for editing. You will see the host’s ID in the URL then! Note it down. Then go to the FOG server console (or SSH or whatever) and connect to the DB (credentials in /var/www/fog/lib/fog/Config.class.php):

    mysql --user=root --database=fog --table -p -e "SELECT * FROM hosts WHERE hostID=333;" >> host_not_working.txt
    Enter password:
    ...
    

    Then delete the host entry, re-register, check the hosts new ID in the web interface and run the same command with the new ID. Please take a close look at the host_not_working.txt file to see where there are differences. Upload the file here in the forum if you can’t find anything.


Log in to reply
 

389
Online

39.3k
Users

11.0k
Topics

104.4k
Posts

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