ChefDK Powershell HOME environment variable error

Hello, I’m not sure if this is strictly a ChefDK issue but I’m hoping that knowledgeable Powershell Chef users might be able to help.

When I start the ChefDK on powershell I’m getting the following error:

The HOME (U:/) environment variable was not set, or was set to
an inaccessible location. Because this can prevent you from running many
of the programs included with ChefDK, we will attempt to find another
suitable location.

Falling back to using C:\Users\mattb as the home directory. If you would like
to use another directory as HOME, please set the HOME environment variable.

If you would not like ChefDK to try to fix the HOME environment variable,
check the CHEFDK_ENV_FIX environment variable. Setting this value to 0
prevent this modification to your HOME environment variable.

PowerShell 2.0 (Microsoft Windows NT 6.1.7600.0)
Ohai, welcome to ChefDK!

PS C:\Users\username\learn-chef>

The U: drive path is enforced by group policy and I’ve tried setting this with set-variable HOME “C:\users\username”. I’ve also created a Powershell profile, which is being read and contains the following line:

Set-Variable -name HOME -value “C:\Users\mattb” -force

knife commands still take an enourmous amount of time to run and repeat the initial error each time, even though as far as I can tell, HOME is now set correctly.

Thanks,

Matt

If you run knife with -V or -VV what is the output that things seem to hang on?

Set-Variable will set normal powershell variables but does not set environment variables. You can make sure this sets the HOME environment variable by using $env:HOME = "C:\Users\mattb"

Hello, I’m also receiving this error in Windows 10 (the message show the Z:/ drive for me instead of U:/) and I have not been able to figure out a way around this issue and the replies are not making sense to me.

I believe I need to modify the C:\opscode\chefdk\bin\start-chefdk.ps1 file, but I’m not sure where or how. After the “Try {” statement I added the line “Set-Variable -name ‘HOME’ -value $env:USERPROFILE -force”, but that is not working. Is this a known issue? How can I fix this? Thanks

1 Like

Hi briang,

I just got a new laptop and got the same error and happened to run into this thread. Yes, you are correct. At the start of the script upload the following lines and the issue should be resolved.

Set-Variable -Name $env:PATH -Value "C:\users<user name>" -Force
Set-Variable -Name $env:HOMEDRIVE -Value "C:" -Force
Set-Variable -Name $env:HOMEPATH -Value "C:\Users<user name>" -Force
Set-Variable -Name $env:CHEFDK_ENV_FIX -Value "0" -Force
Try {
$conemulocation = "$env:programfiles\ConEmu\Conemu64.exe"
....
....
....
etc

Thanks
Bharat