Hostname exists when it doesn't
-
What is the issue you’re seeing?
Is it giving a white page when you try to list host?
My guess is the hostMAC Table is slightly screwed up.
-
When I try the host list report I do only get a white page. When I run the Host and User report I get a list of Hostnames and Mac addresses and a users login period like I should. The issue is that on some machine I have a hostname but no MAC address. FOG can’t find the hostname when I search for it and it won’t let me add that particular hostname.
-
Do you have a utility for editing the mysql database visually? Such as phpmyadmin?
My guess is when adding the hosts through the import you stated, the mac’s were added, as well as the hostnames, but the related hostID’s weren’t pulled with the mac address associations.
So the MAC’s exist in the hostMAC table, but the associated Host ID is probably 0. Because a host is not valid until a MAC address is associated, and the table only allows one MAC address, the association of the MAC to the Host needs to be corrected for.
I can look at the import and just ensure that it is correct as well.
My guess is many of your hostMACs have a hostID field of 0 which is what’s creating your problem.
-
If the utility is built into ubuntu then I do have it, otherwise I should be able to get it easily enough. What file am I looking for to edit?
-
OK. I have phpmyadmin installed and I’m looking at the hostMAC table. I then sort the hmHostID column but nothing is set to zero in that column. Am I just sorting the wrong column or am I looking at the wrong table all together?
-
I’m working on another theory.
Can you remove all the hosts you added before.
Open the file you exported.
The E column should be the imageID, however, i saw an issue with the Description. It was separating the date that’s inside the description as separate fields.
For example:
Created by FOG Reg on August 1, 2014, 9:58 am
Would actually set the D column to
Created by FOG Reg on August 1
E would then be:
2014 (imageID which is unlikely the expectation)
F would then be 9:58 am
And G would contain the actual imageID.
My guess, then, is this is where the problem is occurring. I’ve fixed this issue in 2932, but if your export file is separated in such a manner, you can just remove the e-f columns and all should work. Of course the description wouldn’t contain the proper date information, but I don’t think this is too much of a loss. -
Part of the problem though is that FOG won’t let me see the imported hostname with no MAC tied to it. It’s only around 50 some machines that have this out of the ~400 that we imported. We also already have assigned about 3/4 to them into groups and I would prefer not to start over with that if possible, since deleting them will mean they will need to be re-added to groups. If I’m able to delete the host from the database and then just add them in manually through FOG that would be preferable. I just need to know where to look in the database so I know I’m deleting the correct one.
-
The hostMAC hostID field should match the same hostID in the hosts table.
You can see if it really is the “not found mac address” is the issue by using this.
Basically you need a join possibly to find out what’s going on, but I’d rather just see two tabs side by side, one showing the hosts table
and one showing the hostMAC table.Then, find the non mac assigned hosts based on that.
Just off the top of my head a method to find the non mac associated hosts in the DB could be:
SELECT * FROM hosts LEFT OUT JOIN hostMAC ON hosts.hostID != hostMAC.hostID
-
After some more browsing around I found my host in the hosts table with an ID of 3003. I tried to find that hostID in the hostMAC table but it didn’t exist so the MAC doesn’t seem to exist at all. Could I simply delete the host from the hosts table since it doesn’t seem to be connected to anything else? I’m very new to databases and would just like verification from an expert.
-
I’m no expert, but if the MAC Address doesn’t exist at all for the ID’s, then you should be safe to remove from the hosts table. But this doesn’t mean that the MAC Address for that host doesn’t exist in the hostMAC table, but rather the association between the two hasn’t occurred.
I’m currently testing a few SELECT statements to try providing you with all the hosts that have no associated hostMAC.
-
I tried searching for the proper MAC address and got 0 results back. I also saw a search query that you posted in the Latest FOG Development forum and got a 0 result hit back. I think none of those MAC address were actually added to the table.
-
SELECT hostID FROM hosts WHERE hostID NOT IN ( SELECT hostID FROM hostMAC )
-
Alright, then yes it should be safe to remove those hosts.
Before you attempt re-importing, can you verify that the E cell of the Table is not the Year the host was created?
-
I can confirm that the E column is the image id field.
-
Hello people!
Recently I had a similar problem. My FOG solution is:
- FOG version 1.2.0 revision 3246
- Ubuntu Desktop 13.10 i386
Working with Hosts Management section, creating a host, erasing this host and again creating the host with same MAC I had the trouble that FOG said me that this hostname already exists. In the Host Management section did not appear the host.
The solution is like Tom says. Thank you Tom!!
For me, deleting the registers in fog database with the [I]wrong[/I] host ([I]wrong[/I] means the created, then deleted and then tried to create) in [I]host[/I] and [I]hostMAC[/I] table was the solution.
- I searched how to manipulate fog database.
- I used phpMyAdmin (searching directly with Ubuntu Software Center).
- Then I configure to get access to the fog database (I used blank password in mysql).
- Edit /etc/phpmyadmin/config.inc.php
[INDENT=1]Uncomment this line:[/INDENT]
[INDENT=1][COLOR=#3366ff][SIZE=4]$cfg[‘Servers’][$i][‘AllowNoPassword’] = TRUE;[/SIZE][/COLOR][/INDENT]
[INDENT=1]Save file.[/INDENT] - Finally, search the tables [I]host[/I] and [I]hostMAC[/I] and delete the [I]wrong[/I] host registers.
I hope it helps. See you,
T. Capablo.