Issue Upgrading Tentacles - Could not find part of the path [temp file]

I just upgraded from 2.6.0.749 to 2.6.0.778, and despite the major version not changing, it is prompting me on the environments page to upgrade all my tentacles. When I try to do so, more than half our tentacles are failing with the following:

Reconfiguring the Octopus Tentacle Windows Service to use path: C:\Octopus\Applications\.SQ-PHLVDQA58UPGR-8D8649B6\Octopus.Tentacle\2.6.0.778_1\Tentacle.exe
Tentacle instance: Tentacle
Octopus Deploy: Tentacle version 2.6.0.778
C:\Octopus\Applications\.SQ-PHLVDQA58UPGR-8D8649B6\Octopus.Tentacle\2.6.0.778_1\Deploy.ps1 : Tentacle.exe reconfigure returned exit code 100
Unable to configure the proxy server: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\50e2rs4p.tmp'.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\50e2rs4p.tmp'.

Server stack trace: 
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
   at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at Octopus.Shared.Configuration.XmlKeyValueStore.LoadSettings(IDictionary`2 settingsToFill) in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\XmlKeyValueStore.cs:line 22
   at Octopus.Shared.Configuration.DictionaryKeyValueStore.Load() in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\DictionaryKeyValueStore.cs:line 35
   at System.Lazy`1.CreateValue()
Exception rethrown at [0]: 
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
   at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at Octopus.Shared.Configuration.XmlKeyValueStore.LoadSettings(IDictionary`2 settingsToFill) in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\XmlKeyValueStore.cs:line 22
   at Octopus.Shared.Configuration.DictionaryKeyValueStore.Load() in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\DictionaryKeyValueStore.cs:line 35
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Octopus.Shared.Configuration.DictionaryKeyValueStore.Read(String key) in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\DictionaryKeyValueStore.cs:line 23
   at Octopus.Shared.Configuration.AbstractKeyValueStore.Get[TData](String name, TData defaultValue, Nullable`1 protectionScope) in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\AbstractKeyValueStore.cs:line 37
   at Octopus.Shared.Configuration.ProxyConfiguration.get_UseDefaultProxy() in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\ProxyConfiguration.cs:line 18
   at Octopus.Shared.Configuration.ProxyInitializer.InitializeProxy() in y:\work\refs\heads\release\source\Octopus.Shared\Configuration\ProxyInitializer.cs:line 35
-------------------------------------------------------------------------------
Error: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Temp\50e2rs4p.tmp'.
-------------------------------------------------------------------------------

I am still able to run scripts on these machines and deploy packages, but it is very confusing that all environments show the machines need upgraded, and I would like to resolve this now so that when I later need to upgrade them this doesn’t crop up again.

Hi,

Thanks for getting in touch! Can you do a couple of things for me.

  1. run a health check on one of these machines individually and see if it still lists as needing to be upgraded
  2. try and upgrade a Tentacle with the MSI installer and see if you get any similar errors

Thanks!
Vanessa

Hey Vanessa,

The health check returns a success, listing the old .749 release, with no mention of needing an upgrade.

Upgrading manually using the msi did not return a failure, but interestingly enough the server still lists it as running the old version of the tentacle. The health check still returns the .749 release.

In addition, when doing a deployment to any environment, the machines with the .749 release are listed in red, as though they were using an old release, and the .778 machines are listed in black. This caused some confusion with one of our techs.

It doesn’t seem, despite these issues, that it’s blocking any deployments, but I just want to make sure it won’t stop me from upgrading in the future.

[As a side note, I am using polling tentacles, in case that changes anything.]

Hi,

So I have terrible and crappy news. In .749 there was this thing that even prompted Paul to write a blog post: http://octopusdeploy.com/blog/temp-different-values-for-windows-service
So what this means for you is you will need to run the MSI on all of the tentacles to upgrade them. When we discovered this bug we got our next pre-release build out as fast as we could, but it seems not fast enough in this case. Once this has been completed please let me know if the version after health check is still not correct and we might have to dig deeper into that part - it sounds like a consequence to the first bug.

We are really sorry about you having to update your Tentacles manually.
Vanessa

So that… inconvenient. We have 101 tentacles attached, but if that’s the only solution, that’s what I get for going with the pre-release I guess.

That being said, manually running the MSI doesn’t seem to work. I tried then restarting the tentacle and the server, and it still lists the old version.

Hi Chris,

After installing the new MSI, on Tentacle Manager you’ll also need to click the Reinstall button to have the service point to the new Tentacle.exe binary. Then if you run a health check from Octopus, it should pick up the new version.

I’m really sorry for the broken pre-release.

Paul

Hey Paul,

No worries, I know this happens, and it’s the dangers of my taking pre-releases before they pass full QA.

Since I can currently do deployments until I upgrade the Server to a new Major or Minor version… Is there a way for me to package the MSI into a nuget package and have the tentacle run the install that way? Obviously I couldn’t just call it normally, as the tentacle would have to shut itself down, but is there a way I could, for example, mimic what a tentacle auto-upgrade does (i.e. spawning a powershell console to run the upgrade) but have it run a new MSI and call the reinstall?

I’m just trying to save myself having to log into a bunch of client machines.

Hi Chris,

You could do as you suggest. There is a library step that would help and we have a blog post about using it.


You could then run a step to stop and start the service. (Copy the path where tentacle.exe exists and service --stop service --start

Vanessa

(Hopefully) Last question: I can set it up to call the msi and stop/start the service from a separate spawned process so that it continues to run when the tentacle stops. Since I have to do a “Reinstall” though, is there a command line option to simulate that?

Hi Chris,

There is an --install option under the tentacle.exe service commands so tentacle service --install this may simulate the same thing as the reinstall button. Worth a shot?

Vanessa