• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Renaming Host with Web UI

Scheduled Pinned Locked Moved Solved
FOG Problems
2
6
344
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    mgoh
    last edited by george1421 Jun 9, 2022, 12:31 PM Jun 9, 2022, 4:09 PM

    Hello,

    Recently I’ve been playing with my host naming convention for manageability on my Ubuntu 20.04 based FOG server.

    One of the actions I did is to rename the host (e.g. from name1 to name2) using the Web UI. Then I want to revert to name1; and the Web UI popped up with a message saying that the host with name1 already exists. However, looking at the Web UI’s list of host, name1 is not there. I also tried removing name2 from host list followed by re-adding that same host with name1. Unfortunately this leads to the same error message.

    I suspect that there’s something in Ubuntu terminal that needs to be manually removed to allow renaming the host (i.e. similar to removing OS images - removing both in Web UI and in Linux directory).

    Would anyone know which file to edit? Also, what’s the BKM for renaming host to avoid this problem in the future?

    Thanks,
    -M

    G 1 Reply Last reply Jun 9, 2022, 4:52 PM Reply Quote 0
    • G
      george1421 Moderator @mgoh
      last edited by Jun 9, 2022, 4:52 PM

      @mgoh Off the top of my head I think that maybe fog is marking the host as deleted in the database (and not showing it in the web ui). This is only a guess since I don’t have immediate access to a fog server to verify.

      If you know sql query syntax, through the FOG server’s linux console you can connect to the mysql database as root then access the fog database. The command you would do to login to the cli version of the mysql query tool is mysql -u root The password is a bit tricky, because if it was originally blank when fog was installed the installer will ask you to set root’s password. This value is only used to initially setup fog and is not recorded anywhere. This password is not ever used in FOG except for the initial setup of FOG. If you don’t know what you set it to there are instructions on the internet that show you how to reset the password. Then the login command would be mysql -u root -p and then it will prompt you for root’s password.

      Once you get logged into mysql then issue.

      use fog;
      select * from hosts;
      

      That will list all of the hosts in the FOG hosts table. As I said above I don’t have immediate access to a fog server to verify it so this next query is a guess because I might not have the field name correct.

      to limit the response to only the host in question use this query.

      select * from hosts where name = 'name1';
      

      See if name1 (understand that name1 represents the original name of a specific host) is still listed in the database even though you changed its name.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      M 1 Reply Last reply Jun 9, 2022, 5:32 PM Reply Quote 0
      • M
        mgoh @george1421
        last edited by Jun 9, 2022, 5:32 PM

        @george1421 Thanks. The column name is very close (hostName). The output is below, and the offending name is there (A40C6604DBF9).

        I assume the command to delete is:

        DELETE FROM hosts WHERE hostName = ‘A40C6604DBF9’;

        Let me know if this is correct.

        958236e9-3766-4157-89c3-29e303615323-image.png

        G 1 Reply Last reply Jun 9, 2022, 6:00 PM Reply Quote 0
        • G
          george1421 Moderator @mgoh
          last edited by Jun 9, 2022, 6:00 PM

          @mgoh Well the short answer is if you run that command it will delete the host from the database. But I’m not seeing a field that would say delete the host or not make it show up in the web ui.

          I think before I would do anything I would run this command from the FOG server linux console.

          mysqldump -B fog -u root -p > /new/fogdb.sql
          ref: https://wiki.fogproject.org/wiki/index.php?title=Migrate_FOG

          That way if something goes horribly wrong you can fix it.

          If you remove the host from the host table it will be gone from the web ui (note because of database caching you might need to restart apache to flush the web server cache). The risk is potentially leaving records in other tables that reference host ID 12 that is no longer there. It shouldn’t hurt anything to leave these referenced table since hots ID 12 will never be used a second time.

          I think if it was me and I was in a hackie mindset (with a proper backup) I would delete the record as you have it defined and see if it gives you the results you need. If not restore the database and we can think about another approach.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          M 1 Reply Last reply Jun 9, 2022, 6:25 PM Reply Quote 0
          • M
            mgoh @george1421
            last edited by Jun 9, 2022, 6:25 PM

            @george1421 This works. I did a backup as you suggested, and I did the command: DELETE FROM hosts WHERE hostName = ‘name1’;

            Thank you. I noticed I didn’t put the title of this thread correctly (I hit “send” too early). I’ll create another thread so it’s searchable, if I can’t figure out how to rename the post.

            Thanks,
            -M

            G 1 Reply Last reply Jun 9, 2022, 6:31 PM Reply Quote 0
            • G
              george1421 Moderator @mgoh
              last edited by Jun 9, 2022, 6:31 PM

              @mgoh I think I can fix the thread for you. Glad you found a solution.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                3/6
                Last post

              154

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project