Early hostname change not working (win7)

  • Hello there,

    I’m looking for a deployment solution for a kind of special environment where I have to deploy an win7 image via multicast (works fine with fog) and have to change the hostname. The problem is that I am not able to prepare the computer before taking the image.

    As I understand the documentation right I can do this by using early hostname change without having to install any software into the image (proprietary solution like Symantec Ghost or Acronis Snap Deploy can do this, too).

    At the end of the download task the script states that the hostname change has been done. But when the system is booted up it still tells me the old hostname defined in the image file.

    Am I misunterstanding the process or is this feature not working as intended? I would appreciate any help, thank you very much.

  • Okay, I got the problem fixed. The issue really was the script only applying the hostname change to the last partition restored. These are the steps I’ve done:

    root@e21a101:~# cd /var/www/fog/service/ipxe/
    root@e21a101:/var/www/fog/service/ipxe# xz --decompress init.xz
    root@e21a101:/var/www/fog/service/ipxe# mkdir initmountdir
    root@e21a101:/var/www/fog/service/ipxe# mount -o loop init initmountdir
    root@e21a101:/var/www/fog/service/ipxe# vim initmountdir/bin/fog.download

    Then I added the changeHostname call to line 281 like the following:
    268 elif [ “$imgType” == “mps” ]; then
    269 parts=fogpartinfo --list-parts $hd 2>/dev/null;
    270 diskLength=expr length $hd;
    271 for part in $parts; do
    272 partNum=${part:$diskLength};
    273 echo " * Processing Partition: $part ($partNum)";
    274 sleep 2;
    275 imgpart="$imagePath/d1p$partNum.img";
    276 if [ ! -f $imgpart ]; then
    277 echo " * Partition File Missing: $imgpart";
    278 else
    279 writeImageMultiCast $part
    280 fi
    281 changeHostname;
    282 done

    root@e21a101:/var/www/fog/service/ipxe# umount initmountdir/
    root@e21a101:/var/www/fog/service/ipxe# rmdir initmountdir
    root@e21a101:/var/www/fog/service/ipxe# xz -z -9 -C crc32 init

    That’s it. This way it works perfectly for me. But keep in mind this is a rather quick and dirty fix and only applies to distribution by multicast with a mps type image (Multiple Partition Image - Single Disk (Not Resizable) - (2))! So let’s hope that there will be a clean change to the repos that targets all type of distributions and images.

  • Could it possibly be that i have to change some setting to run the hostname change task like mentioned in this thread? [url]http://fogproject.org/forum/threads/change-windows-hostname-early-just-after-imaging-before-booting.4348/[/url]

    I don’t think the last partition deployed is the windows partition, so if the default settings didn’t change this could be our problem. Can you tell me where to look at to solve this problem? I wasn’t able to find these settings as I don’t have the folder /bin/fog

  • We’ve have the same issue over here. None of our stations in Windows 7 is changing to the value registered in the FOG system. They keep the old one.

  • I just checked the registry and it still tells me the old hostname. A search for the new hostname inside the registry didn’t find any results, too.

  • I will check it tomorrow morning, I am currently not at the place anymore. Thanks already for all the help.

  • Developer

    could you please use regedit to check the values stored in [FONT=monospace][COLOR=#ba2121]HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName\ComputerName[/COLOR][/FONT]

  • I just use right click on Computer, Properties. But there I still get the unchanged old name.

  • Developer

    hostname change early should be working properly under those circumstances. how are you checking the hostname?

  • Well, I am not sure if there is more to registering a system than what I did. So here are exactly the steps I did.

    1. Set up ubuntu server.
    2. Follow the guide on the website to install fog.
    3. Log in to web interface and add new image file (win7, Multiple Partition Image - Single Disk (Not Resizable) - (2))
    4. Add new Host by Mac address and hostname (inserted the new name i wish to have, lets say NEW1) and added the image
    5. Checked that early hostname change is enabled (unchecked and rechecked to make sure there is no display error)
    6. created upload task, restarted system, uploaded image
    7. created download task, restarted system, downloaded image.
      result: hostname unchanged, expected NEW1, but still OLD1

    This should be the steps I took if i didn’t miss something. And the computer I’m testing with is not joined to a domain.

  • When you say the system is not prepared in anyway, is the uploaded image already joined to the domain? Is the hostname different.

    Your phrasing seems a we bit odd to me. Are these systems registered with FOG? They must be registered in order to change the hostname whether by the FOG Client or after the image. What’s the boot menu look like? Is hostname being sent and being sent properly?

  • Well, I mean that I did not perform any special preperation tasks for deployment with fog. I took an image from a system as it is being used, without any special preperation in terms of sysprep, etc. Just booted one of my systems into pxe and pulled the image. When I redeployed it I expected to get the hostname changed, didn’t happen.

  • Developer

    exactly what do you mean by “not being prepared in any way”
    the very fact that you have a prepared, pre-installed image of a computer that you’re deploying is “preparing” it, unless you’re deploying a factory created default image.

  • Is there any way to debug this problem / enable a helpful logfile for this function? I really like your project and would like to use it, but without the early hostname change it is not an option for me.

    I would really appreciate if you could give me some hint where to look out for the problem.

  • And the setting also seems to be enabled in the database:

    | 88 | FOG_CHANGE_HOSTNAME_EARLY | This is an experimental feature that will can be used to change the computers hostname right after imaging the box, without the need for the FOG service. (1 = enabled, 0 = disabled). | 1 | General Settings |

  • On the web interface FOG Configuration > FOG Settings > General Settings > FOG_CHANGE_HOSTNAME_EARLY is enabled.

    Which information has to be provided to register the hosts properly? Currently they are defined with mac address, hostname I want them to get and host image file (which is set to type win7, multiple partition image - single disk - not resizable).

    Anything else to set up?

  • I’m pretty sure this works as expected, is HOSTNAME_EARLY actually enabled? Are the hosts registered properly with FOG?

  • No, the system is not being prepared in any way as this is not possible in our environment. So no sysprep or anything.

    I am running a fresh install of fog 1.1.2 on ubuntu server 12.04.04 LTS.

  • This depends. How are you preparing the system? Is it sysprepped/generalized and set into an OOBE state? If this is the case, this is most likely why you’re not seeing the system change its name. Also, what version of FOG are you using?