23

When installing Jenkins (LTS) on windows 10 via the installer, after choosing the JDK folder - an error pops when the service is trying to start.

The error reads: "Jenkins failed to start - Verify that you have sufficient privileges to start system services"

enter image description here

Let me make it clear that I DO have sufficient privileges, yet something is not working.

I tried many different suggestions to fix this issue, and read many posts but none helped. Also, a lot of these posts are getting old and I'm not sure how relevant they are these days.

I found a way to fix this issue, and I'll post it as a suggested answer. This could also work for other installers, but it was only tested with the Jenkins installer.

However, if anyone knows a better way to fix this - please share it with us.

Hope this method will help many people!

Oron Werner
  • 1,211
  • 1
  • 7
  • 14

6 Answers6

72

Important: If you retried the installation too many times, skip down to "Option 2". The local user account that runs Jenkins may be locked. You will need to unlock that account before attempting either fix below.


This is how I fixed the problem.

Option 1: Re-enter credentials for jenkins user

Please read it all before executing and follow the steps in order:

  1. Delete any Jenkins installation leftovers you currently have
  2. Start the installation process, input your credentials when asked, and continue with the on-screen instructions (including choosing the JDK folder) up until the point where the error is raised.
  3. When the error is raised, >>> DO NOT DO ANYTHING! <<< leave it as it is shown in my question
  4. Now (and only now), open "Services"
  5. Search for the "Jenkins" service. It should be set to "Automatic", but it might be "Disabled" enter image description here
  6. Open the "Jenkins" properties, and go to the "Log On" tab enter image description here
  7. Make sure you choose the "This account" radio button, delete the account name and password fields, and enter them AGAIN
  8. Click "Apply"
  9. Go back to the installer and click "Retry"

If everything is according to plan - The installation will now continue without a problem.

This method was tested on a local and VM / AWS computer and worked!

If you still encounter a problem, try changing the startup in step 5 to "Automatic" and make sure you only open "Services" on step 4. "Services" will not update while it is open.

Option 2: Unlock jenkins user account and manually start service

If you encounter the "Service 'Jenkins' failed to start" error too many times, the account on your computer that should run Jenkins will become locked. You will need to unlock that local account first. Keep the Jenkins installation window open with the error message, and then perform the following steps:

  1. Open the "Local Users and Groups" application.
  2. Go into the "Users" folder.
  3. Right-click on the user who will run the Jenkins service, and click "Properties".
  4. Uncheck "Account is locked out". And while you are at it, make sure "Account is disabled" is unchecked as well.
  5. Click OK.
  6. Open the "Services" app on your computer.
  7. Make sure the Jenkins service is set to start automatically.
  8. Right-click the Jenkins service and click "Start". The service should start successfully.
  9. Switch back to the Jenkins installation window with the "insufficient privileges" message still showing.
  10. Click the "Retry" button in the "insufficient privileges" message box. The installer should recognize that the Jenkins service has started.

You should be able to finish the installation.

E_net4
  • 27,810
  • 13
  • 101
  • 139
Oron Werner
  • 1,211
  • 1
  • 7
  • 14
  • I found this post useful and it solved my problem. In my case, step 1 was not necessary. (I did remove the installation, but there were a few files still hanging around.) For me, the key point was step 6 - re-enter Log On credentials. – GeoffH Oct 18 '20 at 01:56
  • @GeoffH That's great to hear! Thanks for your response. This confirms that the solution works on other computers. – Oron Werner Oct 18 '20 at 18:24
  • Thank you so much for providing us the steps. I'm not sure what I needed to delete in step 1 so I skipped that. I followed the steps 2-9 and it worked. Thanks – zara Oct 28 '20 at 18:29
  • Kya zugaad h, bhai waah – Yogesh Seralia Nov 14 '20 at 06:25
  • 1
    Thank, it worked! and java version must be 8 or 11, use 15 it cannot work – L.T Apr 25 '21 at 08:44
  • For me, I had to click on the radio Local System Account, and give it the right to open sessions as a service under  "Computer Configuration > Windows Settings > Security Settings > Local Policies >User Rights Assignment." – Ayoub Omari Jun 03 '21 at 06:44
  • 1
    Re-entering the credentials did not help in my case, but right-clicking the Jenkins service and starting it did. – honey_badger Aug 04 '21 at 16:02
  • I encountered an additional problem. After seeing the error message box too many times, the local user account that runs Jenkins became locked. I edited this answer to include info about that. Basically, option 1 will not work if the jenkins user account is locked. Unlock that account. Starting the Jenkins service manually and then clicking "Retry" should do the trick. – Greg Burghardt Aug 17 '21 at 16:23
  • Also, the installer does not ask for administrative privileges from Windows. I think this is the root cause. The installer runs as whatever account your Windows login uses. If that account does not have permissions to start services, you will get the error message described in the question. I tried running the installer from an elevated command prompt, and still got the same error. – Greg Burghardt Aug 17 '21 at 16:27
  • @GregBurghardt that happened to me too. I resolved that after I realized that the installer msi file was located in a different drive than my Windows drive (in my case C drive). I just moved the installer file to C drive and ran it from there and then it asked me for administrative privileges. I hoped that helps. – Eyal Gerber Aug 22 '21 at 10:47
  • Thank you for the answer. Option 1 worked for me! – Melkjot Aug 25 '21 at 17:23
  • I know this is getting old but I’m having the same error on aws windows server 2016 core. It has no gui so I can’t just go to services, all steps must be via cmd or powershell. Can you walk through those same steps for powershell? – John Nov 22 '22 at 07:22
4

It didn't work for me until I installed Java Runtime Environment (JRE) 11.

  • Guys, please check the error log files of jenkins, it worked for me as I found out Jenkins v2.265 requires JDK [8,11]. And I installed JDK 15. – Yogesh Seralia Nov 14 '20 at 06:02
  • I hava the same error, I also use java 15 , change to 11 it work – L.T Apr 25 '21 at 08:45
0

For me wasn't working because java installed was jre-8u301-windows-x64.exe

I installed x86, jdk-8u301-windows-i586.exe and it worked

Carlos
  • 1
0

I had the same issue, I have both jre8, jdk 8 and jdk 11 corretto, I think there are some compatibility issues using these versions of java. I was able to fix it by installing jre mentioned above by @maksym which is this. The Jenkins versions that I am trying to install are 2.332.2 LTS and 2.345. I am able to successfully install 2.332.2 LTS

0

I fix it with:

  1. Uninstall all thing what linked with jenkins: foldert where i try to install and installer
  2. Download again the jenkins installer
  3. When i started reinstall next time, i had another issue with not correct jdk version, i downloaded 17.0.4.1 version After that steps i didn't have previous error (Jenkins failed to start) again
Alex
  • 1
0

Open cmd prompt as admin

Run

net user administrator

If the property value of Active in the response is No then Run

net user administrator /active:yes

This fixed the issue for me

Fedor
  • 17,146
  • 13
  • 40
  • 131