Quicktip: esxcfg-boot Runs Forever
It is sometimes necessary to cause VMware ESX 3.x to recreate its bootloader. This is generally done by running the following command sequence:
esxcfg-boot -b
esxcfg-boot -p
esxcfg-boot -r
You might find that these commands run indefinitely on your ESX servers if you alias ‘cp’ or ‘mv’ to ‘cp -i’ or ‘mv -i’ respectively in your /root/.bashrc file. The ‘-i’ forces the command to run interactively meaning that you are prompted to copy or move the file(s) unless you use ‘-f’ to force the operation.
esxcfg-boot writes and runs scripts to recreate the bootloader, and it uses cp and mv in these scripts (at least it uses one of them, I’m not sure which). Since it doesn’t include a ‘-f’ in the script, the command appears to hang.
To complete the operation, type ‘y <enter>’ three times, wait ten seconds and type ‘y <enter>’ three times again. After that, remove the aliases from your /root/.bashrc file to prevent future issues.
Note that you can’t simply ‘unalias cp’ or ‘unalias mv’ prior to running esxcfg-boot, as esxcfg-boot spawns a sub-process to run the script and this process will run /root/.bashrc as part of it’s environment setup.
Thanks to Eric Michaelis, my friend and colleague, for this tip.
