ybe
Posts: 14
Joined: Fri Oct 09, 2020 9:27 am

Service still running after uninstall

Fri Oct 15, 2021 11:54 am

Hello

I'm using Advanced Installer on my Application. My application has an agent that runs a service in the background. For some reason, when I uninstall the application, once it finishes uninstalling the service is still existing and even still running in the background.

So because the service is not uninstalled with the Application, it's not possible to install the application again after uninstalling it, unless you manually go in and stop the service.

How do I make sure that the service is stopped and deleted in the uninstall process?

Kind regards
Ybe

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Service still running after uninstall

Fri Oct 15, 2021 1:19 pm

Hello Ybe,
How do I make sure that the service is stopped and deleted in the uninstall process?
This can be easily set from the "Services" page, using a control operation.

If you do not use our support to launch the service, you can also use the "Stop service" custom action from the "Custom Actions" page and schedule it to be executed only on uninstall. You need to make sure that the service name you add is correct.
StopService.png
StopService.png (880.55KiB)Viewed 20887 times
So because the service is not uninstalled with the Application, it's not possible to install the application again after uninstalling it, unless you manually go in and stop the service.
Also, the above solution can work here too, in the newer version you can add the "Stop service" custom action.

Let me know if that helped you.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ybe
Posts: 14
Joined: Fri Oct 09, 2020 9:27 am

Re: Service still running after uninstall

Thu Oct 21, 2021 9:39 am

Hello

Thank you!

The Control Operation under Services was already set to stop and delete on uninstall, but it didn't work. however the "StopService" Custom Action made the service stop on uninstall. How do I delete the service using Custom Actions. I don't want to just stop it, I want to delete it also. The app should not leave services after uninstall. Is that something you can help with?

Kind regards
Ybe

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Service still running after uninstall

Thu Oct 21, 2021 2:41 pm

Hi Ybe,

This is quite strange. The service should be deleted, I'm not really sure why this happens.

In order for us to further investigate this issue, can you please send us by email to support at advancedinstaller dot com, the following resources:

1. the .AIP (setup project) file.
2. an uninstallation log.
3. a download link for your setup package.
so we can fully test this scenario.

In order to generate an uninstall log, you can use a command line as it follows:

Code: Select all

msiexec /x "C:\MyPackage\Example.msi" /L*V "C:\log\example.log"

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ybe
Posts: 14
Joined: Fri Oct 09, 2020 9:27 am

Re: Service still running after uninstall

Fri Oct 22, 2021 10:39 am

The mail is sent.

Kind Regards
Youssef

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Service still running after uninstall

Fri Oct 22, 2021 11:03 am

Hello Youssef,

I have replied to you over the email.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Anabertol
Posts: 2
Joined: Fri Oct 27, 2023 9:50 am

Re: Service still running after uninstall

Fri Oct 27, 2023 9:54 am

Hi ,

I am experiencing this exact same problem. The services I install during the installation of my product are not being uninstalled during uninstall even if I defined control actions to delete them during uninstall.

Unfortunately, this thread does not contain a solution nor a suggestion for solving it, so I would be glad if someone could help me.

Kind regards,
Ana

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Service still running after uninstall

Fri Oct 27, 2023 12:03 pm

Hello Ana and welcome to our forums,

For Youssef, the problem happened because of shared resources between multiple setups.

If you can notice in the uninstall log file, multiple lines like this:

Code: Select all

Disallowing uninstallation of component: {...} since another client exists
Allowing uninstallation of shared component: {...}. Other clients exist, but installed to a different location
Basically, this means that your files are somehow shared between multiple setups.

Every resource from an installation package has a component assigned. A component is a piece of the application or product to be installed. Examples of components include single files, a group of related files, registry keys, resources, etc.

If you find the above lines in the log file, then this is the reason why your files are not removed. Basically, this can happen if the same components are shared between multiple packages installed on the same machine. Windows Installer keeps a refcount (reference count) for the components and does not allow removing them until all the applications that use them are removed.

Please have a look at the Why files are left behind after package uninstall article for more information about this.

This may also happen when you are using the same project (or copies) to create different installation packages.

Please keep in mind that when you copy the .aip (project file) and reuse it to build another installer package all the GUIDs for product, components,etc. in the two projects will be identical and thus will conflict if you install it on the same machine. So, if you want to reuse an existing .aip file to build another installation package you should use our Save As Template... option.

If the software (the setup) is not yet distributed, there is a high chance that this may be particular to your developer machine only.

For testing purposes we always recommend using virtual machines with clean states so that when something goes wrong you can easily revert to a clean state of the virtual machine.

Are you able to reproduce this on a clean machine?

If you cannot resolve this problem, can you please send us by email to support at advancedinstaller dot com, the following resources:

1. the .AIP (setup project) file.
2. an uninstallation log.
3. a download link for your setup package.

so we can fully test this scenario.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Anabertol
Posts: 2
Joined: Fri Oct 27, 2023 9:50 am

Re: Service still running after uninstall

Tue Nov 07, 2023 8:52 am

Thank you very much for your help, Liviu. The shared components were indeed causing our problem. Updating the UUIDS of the executables associated to the services solved the problem we had with their deinstallation.

One problem remains there, though. We also create an environment variable during the installation which we have marked for removal during the uninstall. The variable does not get removed even if we updated the UUID of the associated component. For now, we are removing it using an inline powershell, so our uninstall workflow is complete, but do you have any idea why it is not being removed during uninstall?

I will definitely have a look at the "Save as Template" option you mentioned since I think this is going to be a very helpful feature for us.

Thanks again!
Ana

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Service still running after uninstall

Tue Nov 07, 2023 3:22 pm

Hello Ana,

I'm glad you solved the first problem.

Regarding the environment variable, I'm not sure why you encountered this behavior.

In order to have a better view about this, can you please send us the .AIP (project file) and a verbose log of the uninstall process to support at advancedinstaller dot com so we can investigate it? If it contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”