Fail to upgrade Jenkins on windows

999 views
Skip to first unread message

Alessandro Ferrucci

unread,
Jan 20, 2022, 11:52:47 AM1/20/22
to jenkins...@googlegroups.com
I'm running jenkins on windows locally and whenever I try to upgrade it via the UI, it errors out with this:

jenkins.war
Failure -

java.nio.file.FileSystemException: C:\stuff\jenkins\jenkins.war: The process cannot access the file because it is being used by another process.

at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:164)
at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:283)
at java.base/java.nio.file.Files.copy(Files.java:1295)
at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:850)
at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:756)
at hudson.lifecycle.Lifecycle.rewriteHudsonWar(Lifecycle.java:167)
at hudson.model.UpdateCenter$HudsonUpgradeJob.replace(UpdateCenter.java:2482)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.install(UpdateCenter.java:1340)
at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1875)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1846)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121)
at java.base/java.lang.Thread.run(Thread.java:834)

I'm running Jenkins via java -jar jenkins.war

The error makes complete sense since of course I'm running Jenkins at the time that it tries to update the war file, however this begs the question, how do other people update Jenkins while it's running?

Thank you

Jonathan Mackenzie

unread,
Jan 20, 2022, 12:18:03 PM1/20/22
to jenkins...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMgh6pLUGHuo7JuS%2BNrPeqPTdVzOwD2uHswT%2BW4%3Djq7MvRkPHw%40mail.gmail.com.

Muhammed Akcal

unread,
Jan 20, 2022, 1:06:10 PM1/20/22
to jenkins...@googlegroups.com
Hi,

Have you added all plugins(Windows) to the Jenkins?

20 Oca 2022 Per 18:17 tarihinde Jonathan Mackenzie <jonathan....@gmail.com> şunu yazdı:

Dirk Heinrichs

unread,
Jan 21, 2022, 4:05:58 AM1/21/22
to jenkins...@googlegroups.com
Am Donnerstag, dem 20.01.2022 um 11:52 -0500 schrieb Alessandro Ferrucci:

The process cannot access the file because it is being used by another process.

That's hat you get when you run servers on Windows. Unlike Linux, Windows can't overwrite executables while they run (in this case your jenkins.war). You need to shutdown Jenkins, rpelace the file, start Jenkins.

Bye...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

James Nord

unread,
Feb 2, 2022, 6:36:12 PM2/2/22
to Jenkins Users
Jenkins can upgrade itself when run as a service in windows 

It can not when launched manually, at the same time it should not offer to update itself either.

You can install the service most simply with the msi installer, but then if you install is a package you should upgrade via a package to

So possibly install on a throw away VM then copy files and register the service manually.  I think there may even be some docs on jenkins.io to say how to do this.

Dirk Heinrichs

unread,
Feb 4, 2022, 2:22:23 AM2/4/22
to jenkins...@googlegroups.com
Am Mittwoch, dem 02.02.2022 um 15:36 -0800 schrieb James Nord:

Jenkins can upgrade itself when run as a service in windows 

It never worked back when we were running Jenkins on Windows (Server 2008 R2, as service). Fortunately we switched our controller to Linux some years ago...

christop...@googlemail.com

unread,
Feb 4, 2022, 2:32:49 AM2/4/22
to Jenkins Users
For me it does upgrade itself perfectly well (Server 2016, Zulu Java, currently jenkins 2.319.2 running as service).
 Only issue: I better manually restart the service after that because sometimes my builds start getting awfully slow.
Reply all
Reply to author
Forward
0 new messages