1

I have a Service (and an installer) that I am developing and need to update it (which I've done many times pas half a year and all went most of the time fine). The problems probably started with a bug that prevented the service from starting and some common issue with Services app blocking the uninstall process.

Now trying to uninstall from Programs I get error:

  • The installed product does not match the installation source(s). Untill...
  • When hit Cancel button, then another error shows up: The installation resource have not been found

I tried to apply this advice:

MsiExec.exe /I foo.msi REINSTALLMODE=voums REINSTALL=ALL

A Wizzard is opened and it offered me a Repair or Removal, but neither option seems to work fine. It shows some efforts to install/update files, than asks for credentials for the service and then throws an error:

Error 1001: Entered service already exists

Of course, I've been here before and tried sc delete Service a suggested in many posts.

And then in the last wizzard page it says The installer was interrupted before Service could be installed. You need to restart installer and try again.

I've been on this issue whole day. I once managed to get rid of the Service by manually removing all the related keys in registry and somehow installed it again only to run to the same issue. I tried every approach I found, but something is missing and it stays "broken". I feel I might need a more low level approach to purge the installation and bring things to a clean state. Suggestion appreciated.

Please note, that some of the messages were in native language and are translated into English and thus might not be exactly matching English Windows phrases.

Oak_3260548
  • 1,882
  • 3
  • 23
  • 41
  • 1
    Is this "in the wild" or something on your own box? You can [try the approaches described here to clean up your own box](https://stackoverflow.com/a/53876981/129130) - or a limited number of boxes. Try the [MS FixIt](https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed) first. If this is an issue with your installer and it affects all deployed versions you need to look at it more carefully - obviously. And do your testing on virtuals - that really helps - too bad when they are unavailable on site. – Stein Åsmul Dec 15 '21 at 03:33
  • Thank you for your suggestions. I do have a virtual (for the only test instance), but I also need a local service to be attached to the VS for debugging. I have issues with the VM too, but limited to service not starting (I can uninstall and install it) after some changes; that was a reason I wanted to debug locally. I'll try MS Fixit, looks like a proper tool for such cases. – Oak_3260548 Dec 15 '21 at 05:24
  • Unfortunately MS Fixit didn't help, though if I used it at the beginning of the problems, it could have helped (I'll remember to use it with future issues). It claims to works for the uninstalling part, but then during Service install attempt it again says `Error 1001: Entered service already exist`. So I tried MS Fixit for "Installing troubles" this time, but it requires to select a program from the list of installed software, which obviously doesn't contain my Service. – Oak_3260548 Dec 15 '21 at 05:43
  • I've just had the same error message on the VM, but simply closing `Services` and `Event Viewer` fixed the issue. None of this (and no `Task Manager`) is running on my local machine, it's basically fresh after a boot... – Oak_3260548 Dec 15 '21 at 06:02
  • 1
    This is definitely not a place you want to mess around, but services should be registered at: `HKLM\SYSTEM\CurrentControlSet\Services`. You could try to rename the entry you find there that matches your service. Don't do anything else! Export a backup of the key too (File => Export... with the right key selected - a text file is exported so you can add entries back). Then try to install fresh and see if that helps. You obviously need to determine what makes the service fail during upgrades and maintenance operations. – Stein Åsmul Dec 15 '21 at 08:04
  • I actually deleted the key as suggested by some posts. I did two things differently last time: Restart (log off should be fine according to posts) and also closed Visual Studio. Finally I was able to reinstall the service. – Oak_3260548 Dec 15 '21 at 08:10
  • Yes, that makes sense. Get rid of all files, then clean the registry and then reboot to update the service control manager and Visual Studio can certainly lock a lot of things. – Stein Åsmul Dec 15 '21 at 08:13

1 Answers1

0

I was finally able to reinstall the service, using tricks from different posts combined:

  • purging manually all relevant registry keys (using regedit), most importantly HKLM\SYSTEM\CurrentControlSet\Services\<service_name>
  • manually deleting application folder in C:\Program Files (x86)\
  • restart
  • ensuring that Task Manager, Event Manager, mmc (cmd tasklist | findstr mmc) and Services are not runnning
  • ensure Visual Studio is not running (simply put)
  • reinstallation

It seems that all those had to be carried out in my case, missing one caused the problem to stick.

Oak_3260548
  • 1,882
  • 3
  • 23
  • 41
  • 1
    OK, glad you are back to a working system. Throwing in a few more links: [Service Installation](https://stackoverflow.com/a/61903256/129130). [Windows Services FAQ](https://www.coretechnologies.com/WindowsServices/FAQ.html). Good luck figuring out what causes the problem in the first place - services can be hard to debug. I once created one that ran as an exe file in debug mode - that helped, but I am not sure that is possible anymore. – Stein Åsmul Dec 15 '21 at 08:08
  • Yes, I have the same feeling about services. Especially finding out why service is not starting can be difficult (no log entries generated, process cannot be attached to the VS), but at least I can now confirm it on two separate instances, having a different account locally (the service runs as functional user on the server, different from system account). – Oak_3260548 Dec 15 '21 at 08:20
  • 1
    `1)` [Error 1053: The service did not respond to the start or control request in a timely fashion](https://www.coretechnologies.com/WindowsServices/FAQ.html#Error1053), `2)` [Why doesn't my Windows Service start automatically after a reboot?](https://www.coretechnologies.com/WindowsServices/FAQ.html#NotStartingAtBoot), `3)` [Error 1069: The service did not start due to a logon failure](https://www.coretechnologies.com/WindowsServices/FAQ.html#Error1069), `4)` [Common application / service launch problems](https://stackoverflow.com/a/53530377/129130). – Stein Åsmul Dec 18 '21 at 19:52
  • 1
    Even more links: `1)` [Windows Services Frequently Asked Questions (FAQ)](https://www.coretechnologies.com/WindowsServices/FAQ.html). `2)` [Weird launch problem](https://stackoverflow.com/a/55087943/129130). `3)` [Service Launch problems](https://stackoverflow.com/questions/61145147/weird-issue-with-windows-service-service-timing-out/61149858#61149858). – Stein Åsmul Dec 18 '21 at 19:54