Unable to uninstall or install octopus tentacle

a bit of background: I had octopus polling tentacles running on a couple of servers and they have worked well with my cloud instance for a while. I recently received our cloud instances, but since then our tentacles keep failing their health checks and not responding.

I am attempting to reinstall the tentacles because I noticed new installations working correctly on my machine.

Can anyone help with uninstalling Octopus tentacle from my windows server?

I was following this, but I think I reached a broken state.

I have uninstalled the running tentacle instance. I have made a backup of my applications folder.

When I try to uninstall it from the control panel a progress bar opens and closes quickly, but the application is not uninstalled.

When I try to install a new version with Octopus.Tentacle.6.1.736-x64.msi I get
“The Octopus Deploy Tentacle Setup Wizard ended prematurely…”

Are there any logs that can help diagnose this further? The event viewer doesn’t say much.
Just that the installation failed and Installation success or error status: 1603. Which I believe just means fatal error.

Does anyone know how I can get out of this mess? Do I need to reset the server completely?

Thanks

Hi Aaron,

Thanks for getting in touch! A common method of uninstalling a broken Tentacle installation is to download the msi installer for the specific version of Tentacle you have installed, then run it from the command line with the uninstall flag. (I believe this is msiexec.exe /x “PathToTentacle.msi”)

If this is still failing for you, I believe the best next step would be to see if the MSI install logs contain any info.

Something like the below example:
msiexec.exe /x "PathToTentacle.msi" /L*V "C:\log\example.log"

Generally the manual uninstall from the command-line whilst using the specific msi that is currently installed will work. Though if it doesn’t, the logs may contain some more information about what exactly is going wrong during the uninstall. Feel free to attach the logs if they’re not helpful and you’re still having trouble.

Looking forward to hearing form you and getting to the bottom of this.:slight_smile:

Best regards,
Daniel

Hi Daniel

Thanks for the tip.

Here’s the section that seems to show the problem:

MSI (s) (AC!C4) [11:49:18:267]: PROPERTY CHANGE: Deleting WixQuietExecCmdLine property. Its current value is ‘“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -File “C:\Program Files\Octopus Deploy\Tentacle\Harden-InstallationDirectory.ps1”’.

Action start 11:49:18: HardenInstallationDirectory.
WixQuietExec:  Removing write permissions on C:\Program Files\Octopus Deploy\Tentacle for BUILTIN\Users
WixQuietExec:  Error 0x80070001: Command line returned an error.
WixQuietExec:  Error 0x80070001: QuietExec Failed
WixQuietExec:  Error 0x80070001: Failed in ExecCommon method
CustomAction HardenInstallationDirectory returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (AC:30) [11:49:19:870]: Note: 1: 2265 2:  3: -2147287035 

I may have impulsively ran the script… maybe that was a horrible idea…

But it appears to run fine…

Maybe I have ruined my installation somehow?

Thanks,

Hi Aaron,

Just stepping in for Daniel, thanks for providing the log entries.

The error is implying that it’s failing to remove the permissions on the “C:\Program Files\Octopus Deploy\Tentacle” folder. Could you confirm that the “SYSTEM” account has “FULL ACCESS” to the installation folder?

If that folder exists, could you please remove it and try the uninstall command again, sharing any log errors? Microsoft docs about this error are located here.

If you could please confirm the following for your system, deleting any registries or folders found, that will confirm that the Tentacle has been completely removed (taking backups of any data you wish to retain):

  1. No running ‘Octopus’ services or background processes running under “Task Manager” & “Services”.
  2. There are no Octopus programs listed under “Control Panel -> Uninstall a Program”.
  3. The folders “C:\Octopus” & “C:\Program Files\Octopus Deploy” are both not present.
  4. There are no registries under “HKEY_LOCAL_MACHINE\SOFTWARE\Octopus”.
  5. The folders “%ProgramData%\Octopus” and “%LocalAppData%\Octopus” are both not present.

Following this, reboot the instance and try to install the tentacle again. If you receive any errors please let me know. It might also be worth testing if you are able to install other programs or if this is just effecting Tentacle.

Feel free to let me know if you have any questions.

Best Regards,

Hi

Sorry for the delay.

So I cleared everything. (I originally was having trouble with number 2, but I cleared the registry key)

  1. Don’t see anything running. I also checked resource monitor for ‘octopus’ handles
  2. Eventually got cleared
  3. Backed up to a new location and gone.
  4. Gone
  5. Gone

I ran msiexec.exe /i {msi path} /L*V {log path}

I attached the log from my failed installation attempt. It still says it ended prematurely. I still don’t have anything in my program files folder, and now it complains that Harden-InstallationDirectory.ps1 does not exist (which makes sense, because the entire C:\Program Files\Octopus Deploy\Tentacle folder doesn’t exist). Does it expect the files to be all copied over at that point?

error.log (217.4 KB)

I am able to install 7 zip with its MSI with no problems.

Thanks

Hi Aaron,

That is unfortunate, the files should be bundled with the msi and we can see in the logs that it’s extracting ok!

I managed to get an engineer to have a look at this with me and we think there is a bug here.

What we believe is happening is that the HardenInstallationDirectory script is possibly quarantined, or there is a policy not allowing the “quiet execution” of ps1 scripts. They will investigate ways to improve this script so that it’s not an issue.

In the meantime, you try installing an older version of Tentacle, which doesn’t have this script. This version of tentacle was the build before the script was introduced.

I’ve created a Github Issue here, so you can track the progress and get notified when a fix is available!

Feel free to let me know if you have any questions, interested in hearing if the earlier version installs ok!

Best Regards,

Okay, will try.

But the latest log I gave in my last post doesn’t match the git hub issue.

PROPERTY CHANGE: Deleting WixQuietExecCmdLine property. Its current value is ‘“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -File “C:\Program Files\Octopus Deploy\Tentacle\Harden-InstallationDirectory.ps1”’.
WixQuietExec: The argument ‘C:\Program Files\Octopus Deploy\Tentacle\Harden-InstallationDirectory.ps1’ to the -File parameter does not exist. Provide the path to an existing ‘.ps1’ file as an argument to the -File parameter.
WixQuietExec: Error 0xfffd0000: Command line returned an error.
WixQuietExec: Error 0xfffd0000: QuietExec Failed
WixQuietExec: Error 0xfffd0000: Failed in ExecCommon method

And I don’t have any C:\Program Files\Octopus Deploy\Tentacle folder still.

Thanks,

Hello

I tried the 6.0.390 version ( you can see it in the log), but I got the same issue.

Is there an older version I should try?

log3.txt (222.3 KB)

Thanks,

Hi Aaron,

That is strange indeed! That msi doesn’t contain the script and so I’m not sure exactly what’s going on for it to still be used. I’m thinking that there might be some system corruption…

Could you please run the System File Checker to try repair any corrupt system files?

I structured the GH issue around the previous logs you shared, as I’m seeing the same error “1603” in the current logs, though the point of failure is slightly different now. I felt the previous error was slightly more informative as it shows where the error 1603 occurred while the script was executing:

WixQuietExec: The argument ‘C:\Program Files\Octopus Deploy\Tentacle\Harden-InstallationDirectory.ps1’ to the -File parameter does not exist. Provide the path to an existing ‘.ps1’ file as an argument to the -File parameter.

vs

WixQuietExec:  Removing write permissions on C:\Program Files\Octopus Deploy\Tentacle for BUILTIN\Users

Apologies for any confusion, I’ll keep digging into this and keep you updated.

Best Regards,

Hi Aaron,

Our engineers have just managed to reproduce this and have found a way to potentially resolve it!

Could you please try looking inside the following registries for Octopus Tentacle entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

On my machine I found the following registries only:


Removing these, along with the previous suggestions should allow for the new install to work, but feel free to let me know if you have any questions. I’ll make sure to update our documentation/process so that others don’t run into this issue also.

Best Regards,

Hello

Sorry for the delayed response.
Thanks! We were able to install and run the tentacle.
It appears to be running fine, but I am still running into issues.

I keep seeing this error message when I try to run a script or health check. Any idea what could cause this? I think it might be some security software on our server, as I can run the tentacles properly on our normal machines, just not our deployment servers.

error:

Starting C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in working directory ‘C:\Octopus\Work\20210924150931-8089-109’ using ‘OEM United States’ encoding running as ‘NT AUTHORITY\SYSTEM’ with the same environment variables as the launching process
15:09:33 Verbose | Process C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in C:\Octopus\Work\20210924150931-8089-109 exited with code 1
15:09:33 Verbose | Exit code: 1
15:09:33 Fatal | The remote script failed with exit code 1
15:09:33 Verbose | The remote script failed with exit code 1
| Octopus.Server.Orchestration.Targets.Tasks.ActionHandlerFailedException: The remote script failed with exit code 1

Any ideas about what could cause this? Should I start a new topic?

Thanks

Hi @aaron.philips,

Great to hear the tentacle was able to be installed and is running ok! We’ve updated our docs so that the manual uninstallation now includes those Registries.

I’m not able to determine what the issue could be from the logs provided, if you could please upload the entire log here I’ll dive deeper into it and see if I can spot the issue.

I’ve seen problems running the tentacle as a SYSTEM service causing issues, I’ve linked the docs saying which permissions are required here.

Any questions or issues, feel free to let me know.

Best Regards,

Hi

I attached the whole log from the health check, but I think any deployment or using the console script also causes the same issue.

Let me know if there is any other logs that would be helpful

Thanks,

Hi Aaron,
Just stepping in for Finnian as he is working with another customer.
Thanks for sending the log through although it doesn’t show much in the way of why the script failed

You may be onto something about the security software. We have definitely seen issues with AntiVirus and other security restrictions causing problems running scripts. Although you have probably checked this already, for sanity sake it would be good to see if the set-execution policy is bypassed for PS scripts:

set-executionPolicy -scope Process -executionPolicy bypass

Let me know if any of the above hits the mark, otherwise we can dig a bit deeper.

Kind Regards,
Paraic

Hi

We were finally able to fix this. We were testing the remote script functionality. All PowerShell scripts always exited with code 1 unless we explicitly exited with code zero.

It was perplexing, but we updated PowerShell from I think 4 → 5.1 and now everything is fine.

Thanks.