Windows Service Install Ends in Rollback - windows-services

When I try to install a Windows service:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil
I get, what looks to be, some success messages and some failure messages. Part way down:
An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: The specified service has been marked for deletion
At the end:
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
The service is given an entry in the Services applet, but it is marked as "Disabled". When I attempt to change it to another state, I get a "marked for deletion" error message.
There are no messages in the Event Log. There is nothing useful in the log file created by installutil.exe (I believe it's written to the current working directory).
I have no direction to go with this. What do I do?

It turns out that the install might, or probably will, fail if that service is highlighted in the Services applet. It's safest to just close the Services applet, install the service, and then re-open the Services applet. It's really stupid.
Also, make sure to run the console as admin.

I experienced the same and the issue for me was that a service with the same name was already installed. So in order to install the new service I had to uninstall the older services. I am learning how to create and setup windows services and thus the naming conflicting. Tried uninstalling the service first through:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil -u servicename.exe
Once this statement executes successfully, install your service and it should succeed without any rollbacks.

Right Click on Command Prompt and choose RUN AS ADMINISTRATOR
Then copy and paste in: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe C:\TestService\bin\Debug\TestService.exe
Result in TestService.InstallLog is:
Installing service TestService...
Service TestService has been successfully installed.

Some times this happens due to permission issues.
Run the "Developer Command Prompt for VS 2012" as Administrator.
Then it will work.

Adding few more check's and points to solve this above issue.
Build service in release mode and take release folder files and kept in different path
Copy that path and go to visual studio command prompt window and run this bellow sample command to install the service.
Please close services.msc window if its opened , then run C:Program Files (x86)\Microsoft Visual Studio 11.0>InstallUtil.exe C:\RunLocationServices\TestService.exe
Go services.msc and select that service and click on start ,if it changed to "started" then your service running fine.
Still if issue exists then
Another Checkpoint & SOLUTION
When a service starts, the service communicates to the Service Control Manager how long the service must have to start (the time-out period for the service).
If the Service Control Manager does not receive a "service started" notice from the service within this time-out period,
the Service Control Manager terminates the process that hosts the service.
This time-out period is typically less than 30 seconds.
If you do not adjust this time-out period, the Service Control Manager ends the process.
To adjust this time-out period, follow these steps:
1.Go to Start > Run > and type regedit
2.Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
With the control folder selected, right click in the pane on the right and select new DWORD Value
3.Name the new DWORD: ServicesPipeTimeout
4.Right-click ServicesPipeTimeout, and then click Modify
Click Decimal, type '180000', and then click OK
5.Restart the computer
Still if issue exists then problem in your service code ,infinate loop may occur due to your methods/classes of service calling. Do code review of each line.

This problem is due to security, you'd better open developer command prompt for VS 2012:
RUN AS ADMINISTRATOR
and install your service. It will surely fix your problem.
I tried and the issue was resolved.

Related

Bot is getting stuck at "Download Dependencies" in A360

Automation Anywhere A360 BOT stuck in downloading dependencies, whenever I try to run the bot in dev server.
What I have tried:
Re-installing the Bot Agent with Admin role.
Restarting the Bot Agent Service and preloading the packages.
Stopping the Bot Agent Service and renaming the Global Cache Folder to some other name. Then Again starting the Bot Agent.
Sometimes I see this issue and I have remove the device from within the control room devices list, clear the global cache and then run through the device connection process again.

Cannot start Jenkins service in Windows after updates

I have Jenkins running on Windows as a service. Normally, it starts when machine starts.
After a Windows recommended update this afternoon, and a machine restart, my Jenkins just stopped working.
I start the service but it stops and shows the following warning:
"The Jenkins service on Local Computer started and then stopped. Some
services stop automatically if they are not in use by other services or
programs."
There is no "jenkins.err.log" file and if I start Jenkins with "java jenkins.war" It works fine.
Any tip whats going on? How to fix this? Please help.
Thank you very much.
I had the same problem. It appeared that the java runtime enviromment had been updated. In the jenkins installation folder there is as jenkins.wrapper.log. This contains logging from the jenkins.exe service wrapper. In my case it tried to start java from c:\Program Files\Java\jre1.8.0_144\bin.
This folder did not exist, instead, java was installed in c:\Program Files\Java\jre1.8.0_161\bin.
In the jenkins installation folder there is also a jenkins.xml. This contains the reference to the java installation in the tag. Change it to your current java installation and it will start again.
I also had this problem after each java update. But there is a version-independent absolute path, that can be used to start the java run-time: C:\ProgramData\Oracle\Java\javapath\java.exe.
I changed jenkins-slave.xml to use this path:
<executable>C:\ProgramData\Oracle\Java\javapath\java.exe</executable>
if your java path is correct, disable RunawayProcessKiller in jenkins.xml
extension enabled="**false**" className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension"
If the java.exe path is setup correctly in the jenkins.xml/jenkins-slave.xml file and the problem persists, then try to delete the jenkins_agent.pid file and restart the service.
In my case this happened after I installed some updates on my machine. After some research (jenkins.err.log) it turned out that some other application grabbed the port 8080 that was used by Jenkins up to this point.
I managed to identify the app (with TcpView) and disabled it.
Problem solved.
In my case, I installed JDK 17.0.2, but Jenkins requires version JDK 8 to 11.
Check error log under C:\Program Files\Jenkins\jenkins.err for exect error.
My issue was installation of an (unwanted) service that also listens on port 8080. That service failed to start on installation because Jenkins was running at the time, but after a reboot the rogue service started more quickly and nabbed the port. The fix was to disable the unwanted service.
from jenkins.err.log:
java.net.BindException: Address already in use: bind
Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
Your first stop should be the Windows Event Viewer logs to get a better idea of the underlying error. In my case the error read:
Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
at System.Diagnostics.Process.OpenProcessHandle(Int32 access)
at System.Diagnostics.Process.get_Handle()
at winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension.OnWrapperStarted()
at winsw.Extensions.WinSWExtensionManager.FireOnWrapperStarted()
at winsw.WrapperService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
You can examine your Jenkins configuration by looking at jenkins.xml. In my case this included configuration for a RunawayProcessExtension which terminates previous instances of Jenkins before starting the new instance. The <pidfile> entry stores the location of a text file with the PID of the last known instance of Jenkins.
In my case, this <pidfile> was pointing to a PID that was no longer used by a running Jenkins process. Instead, that slot had been taken over by a system process (csrss.exe), causing the RunawayProcessExtension to throw an exception with an "access denied" message when trying to terminate it. Jenkins itself was not starting because it was expecting the RunawayProcessExtension to terminate first.
The solution was to delete the <pidfile> and then restart the service.
It is happing as Jenkins is not able to find java(jdk) path. check jdk path in jenkins.xml file
Resolved this issues
java -version
where java
check jdk/bin -- copy this jdk path
Goto jenkin.xml file and change java path
To resolve this problem follow bellow steps -
Open window task manager(use CTRL + ALT + Delete button)
Navigate to service on the task manager
Click 'Services..' button on task manager
Services window gets opened > Search the Jenkins service and re-start/Start the Jenkins service
Refer Image - Jenkins Service
Now try accessing the Jenkins, problem re-solved
Jenkins service might be stoped.Find the jenkins service in window services and click start.I tried it many times.It worked

TFS 15 RC1 - Build agent not running/working - no agent pool found with identifier

We currently have upgraded our Team Foundation Server 2015 to Team foundation server 15, RC1.
But i cannot get our existing or new build agents running. The error we got is always the same.
No agent pool found with identifier 1 (or 2, ....).
I have checked the database and there is an agent pool with that ID.
Any idea anyone?
thanks.
If the build agent pool definitely exists, but the error is can't find the agent pool. Then the issue is very likely related to permissions.
When configuring the build agent(new created or existed), you need to make sure the account which running the configure command or script have enough permission.
The user account needs to be part of the Agent Pool Administrator Accounts.
Update
Try below ways to narrow down the issue:
First check in that if the build server is available and enabled in
TFS at https://YOURCOMPANYNAME:8080/tfs/_admin/_AgentQueue, and
your build agent should be “Green”.
Make sure the agent is in interactive mode.
Try to change a domain account which is a member of the Build
Agent Service Accounts group and belongs to "Agent Pool Service
Account" role, to see whether the agent would work or not.
Double check whether there are some Firewall interface block the
build, try to disable all related settings.
Update 2
Browse the Control Panel - Team Project Collection - Team Project- Agent queues- click agent pool - Roles- click Add... - Add your user ID and select Administrator in Role
After this try again.
Thanks for your time, however the issue is solved with Microsoft support.
It turned out that my default access level was stakeholder, while build permissions are in the basic. So i had to change the default access level to Basic.
That's obvious a bug in the new RC1, but like you said, it was some kind of a permission issue.
thanks again.
I had the exact same thing: an existing build server, which was working until somebody upgraded it. Error message in the .\BuildAgent_Diag\ folder kept saying
Failed to create session. Sleeping for 10 seconds before next retry
----------------------------------------
Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentPoolNotFoundException: No agent pool found with identifier 7.
I already had the service running as a domain account with "build admin" permissions.
The solution was to run 'ConfigureAgent' again: Open a command prompt as administrator. Change directory to your 'BuildAgent' folder (or where ever your 'ConfigureAgent.cmd' file is located) and run 'ConfigureAgent.cmd'. It will ask a few questions. I stayed with the current settings. I had to enter the password for the service account. Eventually the wizard completed and everything worked again.

SDL Tridion 2011 SP1 : Installing monitoring service

We are setting up Tridion 2011 SP1 CDS (.net based) on one of our servers.
We are sruck at point 'Installing Monitoring as a Wndows Service'.
Evern after running the batch file 'StartCDInstaller.bat' and following the procedure, we cannot locate the Tridion Monitoring Agent service in the windows services.
Are we missing something?
Also another question regarding CDS, can we change the location of config files (Deployer, Storage_conf etc) post Installation? Or do we need to re-run the installer?
Update:
The same error even after reinstalling the monitoring service.
"The Event log details: The description for Event ID 100 from source TCDmonitor cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted"
You can change the location of tridion folder structure by setting the System variable in environment variable(Control panel -> system and security -> System -> Advance -> Environment variables -> system variables) called "Tridion_Home" and value as "d:\tridion" (this is the path of the tridion folder ). You can test this after going to run and type %tridion_home% .
If for some reason the Tridion Monitoring Service was not installed by the installer, you can do it manually.
Locate the file cd_monitor.exe (it is on the installation CD in Content Delivery\roles\monitoring\windows).
Copy it to a location where you keep your executables (e.g. to the Tridion\bin folder)
Start a command prompt as administrator and type 'cd_monitor -install'
Go to the services console and start the monitoring service
Had a similar issue too, it was an x64 Content Delivery server with x64 Java installed. Manually installed the monitoring service but refused to start with:
The description for Event ID 100 from source TCDmonitor cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Could not load Java runtime libraries at
the message resource is present but the message is not found in the string/message table
The monitoring service requires 32bit Java, as soon as that is installed it started with no problem.
Hope that helps.
Scott

WiX uninstaller: restart service if present

Part of our app involves registering a plug-in to a third-party product. While the third-party service is running, it has our DLL loaded, so the files on disk are locked.
So when we uninstall our product, we need to begin by stopping the third-party service, and then restart it when we're done with the uninstall. (We also do the same stop/restart thing at install time, because if this is an upgrade, then the existing files are again locked.)
WiX has a command that handles the happy path, no problem:
<ServiceControl Id="SomeUniqueId" Name="NameOfTheirService"
Start="both" Stop="both"/>
I.e., stop the service at the beginning of both install and uninstall, and restart it at the end of both install and uninstall. So far so good.
The problem comes if the end-user uninstalls the third-party app first, and then tries to uninstall our app. Our app won't work with the third-party service, but if the user wants to uninstall them both, there's nothing to force them to do it in a particular order. However, if the third-party service is no longer installed, then our uninstaller:
Tries to stop the third-party service, fails because the service no longer exists, decides the failure isn't important, and continues.
Uninstalls our product.
Tries to restart the third-party service, fails because the service no longer exists, decides this failure is important, and brings up an error dialog saying, "Service 'NameOfTheirService' (NameOfTheirService) failed to start. Verify that you have sufficient privileges to start system services." (Retry / Cancel)
If the user clicks Retry, goto 3.
If the user clicks Cancel, roll back, and un-uninstall.
In other words, WiX's error handling is wrong. Stopping a service should be failure-tolerant, and it is. Starting a service after install can be failure-intolerant; that's fine: fail my install if the service won't start. But starting a service after uninstall should be failure-tolerant, and it is not.
How can I restart a service after uninstall, without failing the uninstall if that service no longer exists?
If you add the Wait attribute to the SeviceControl element and set it to no then as well as "Retry" and "Cancel" you'll also get an "Ignore" button that users can click to continue the Install/Uninstall without having started/stopped the service.

Resources