# Problems With Plugin Upgrade Script

**URL:** <https://community.jenkins.io/t/problems-with-plugin-upgrade-script/34179>\
**Category:** Ask a question\
**Created:** [July 22, 2025, 12:29pm UTC](https://community.jenkins.io/t/problems-with-plugin-upgrade-script/34179 "2025-07-22T12:29:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drwhitehouse](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/drwhitehouse/32/16037_2.png) [@drwhitehouse](https://community.jenkins.io/u/drwhitehouse)\
**Post date:** [July 22, 2025, 12:29pm UTC](https://community.jenkins.io/t/problems-with-plugin-upgrade-script/34179/1 "2025-07-22T12:29:24Z")

</div>

Hi,  
I am working with the following Jenkins setup:

## Jenkins: 2.504.3 OS: Linux - 5.14.0-503.33.1.el9\_5.x86\_64 Java: 17.0.16 - Red Hat, Inc. (OpenJDK 64-Bit Server VM)

ant:513.vde9e7b\_a\_0da\_0f  
antisamy-markup-formatter:173.v680e3a\_b\_69ff3  
apache-httpcomponents-client-4-api:4.5.14-269.vfa\_2321039a\_83  
asm-api:9.8-135.vb\_2239d08ee90  
authentication-tokens:1.131.v7199556c3004  
bootstrap5-api:5.3.7-1  
bouncycastle-api:2.30.1.80-261.v00c0e2618ec3  
branch-api:2.1233.vfb\_6b\_2b\_3ed499  
build-timeout:1.38  
caffeine-api:3.2.0-166.v72a\_6d74b\_870f  
checks-api:373.vfe7645102093  
cloudbees-folder:6.1036.vb\_94fd035b\_287  
command-launcher:123.v37cfdc92ef67  
commons-lang3-api:3.18.0-98.v3a\_674c06072d  
commons-text-api:1.13.1-176.v74d88f22034b\_  
credentials:1415.v831096eb\_5534  
credentials-binding:696.v256688029804  
data-tables-api:2.3.2-3  
display-url-api:2.209.v582ed814ff2f  
docker-commons:457.v0f62a\_94f11a\_3  
docker-workflow:621.va\_73f881d9232  
durable-task:587.v84b\_877235b\_45  
echarts-api:5.6.0-5  
eddsa-api:0.3.0.1-19.vc432d923e5ee  
email-ext:1916.vc954a\_f86ff21  
external-monitor-job:223.vb\_fddcf42c9b\_3  
font-awesome-api:6.7.2-1  
git:5.7.0  
git-client:6.2.0  
git-server:137.ve0060b\_432302  
github:1.43.0  
github-api:1.321-488.v9b\_c0da\_9533f8  
github-branch-source:1824.v046257273408  
gradle:2.15  
gson-api:2.13.1-139.v4569c2ef303f  
instance-identity:203.v15e81a\_1b\_7a\_38  
ionicons-api:88.va\_4187cb\_eddf1  
jackson2-api:2.19.0-404.vb\_b\_0fd2fea\_e10  
jakarta-activation-api:2.1.3-2  
jakarta-mail-api:2.1.3-2  
javadoc:327.vdfe586651ee0  
javax-activation-api:1.2.0-8  
javax-mail-api:1.6.2-11  
jaxb:2.3.9-133.vb\_ec76a\_73f706  
jdk-tool:83.v417146707a\_3d  
jjwt-api:0.11.5-120.v0268cf544b\_89  
jnr-posix-api:3.1.20-138.vdb\_9db\_a\_39182f  
joda-time-api:2.14.0-127.v7d9da\_295a\_d51  
jquery3-api:3.7.1-3  
jsch:0.2.16-95.v3eecb\_55fa\_b\_78  
json-api:20250517-153.vc8a\_a\_d87c0ce3  
json-path-api:2.9.0-148.v22a\_7ffe323ce  
jsoup:1.21.1-52.v96e4041b\_60fd  
junit:1335.v6b\_a\_a\_e18534e1  
ldap:780.vcb\_33c9a\_e4332  
lockable-resources:1408.vb\_7d1f371781d  
mailer:509.vc54d23fc427e  
mapdb-api:1.0.9-44.va\_1e1310c9118  
matrix-auth:3.2.6  
matrix-project:849.v0cd64ed7e531  
mina-sshd-api-common:2.15.0-161.vb\_200831a\_c15b\_  
mina-sshd-api-core:2.15.0-161.vb\_200831a\_c15b\_  
okhttp-api:4.11.0-189.v976fa\_d3379d6  
pam-auth:1.12  
pipeline-build-step:571.v08a\_fffd4b\_0ce  
pipeline-github-lib:65.v203688e7727e  
pipeline-graph-analysis:241.vc3d48fb\_b\_2582  
pipeline-groovy-lib:752.vdddedf804e72  
pipeline-input-step:527.vd61b\_1d3c5078  
pipeline-milestone-step:138.v78ca\_76831a\_43  
pipeline-model-api:2.2255.v56a\_15e805f12  
pipeline-model-definition:2.2255.v56a\_15e805f12  
pipeline-model-extensions:2.2255.v56a\_15e805f12  
pipeline-rest-api:2.38  
pipeline-stage-step:322.vecffa\_99f371c  
pipeline-stage-tags-metadata:2.2255.v56a\_15e805f12  
pipeline-stage-view:2.38  
plain-credentials:199.v9f8e1f741799  
plugin-util-api:6.1.0  
resource-disposer:0.25  
scm-api:704.v3ce5c542825a\_  
script-security:1373.vb\_b\_4a\_a\_c26fa\_00  
snakeyaml-api:2.3-125.v4d77857a\_b\_402  
ssh-credentials:359.v2191c4cf635f  
ssh-slaves:3.1071.v0d059c7b\_c555  
sshd:3.372.v5d04a\_e92d8cf  
structs:350.v3b\_30f09f2363  
subversion:1287.vd2d507146906  
timestamper:1.30  
token-macro:444.v52de7e9c573d  
trilead-api:2.209.v0e69b\_c43c245  
variant:70.va\_d9f17f859e0  
workflow-aggregator:608.v67378e9d3db\_1  
workflow-api:1380.ve03e7a\_63d139  
workflow-basic-steps:1079.vce64b\_a\_929c5a\_  
workflow-cps:4168.v7ea\_f89c358b\_d  
workflow-durable-task-step:1434.v1b\_595c29ddd7  
workflow-job:1540.v295eccc9778f  
workflow-multibranch:806.vb\_b\_688f609ee9  
workflow-scm-step:437.v05a\_f66b\_e5ef8  
workflow-step-api:704.ve4f0967e98fa\_  
workflow-support:968.v8f17397e87b\_8  
ws-cleanup:0.48

We have a cron job which runs on the server and looks like this:

```auto
#!/bin/bash
UPDATE_LIST=$( ssh -l admin -p 8022 localhost list-plugins | grep -e ')$' | awk '{ print $1 }' )

if [-n "$UPDATE_LIST"]; then
    logger "The following Jenkins plugins will be updated: $UPDATE_LIST"
    ssh -l admin -p 8022 localhost install-plugin ${UPDATE_LIST}
    # Jenkins doens't seem to restart properly after an update
    # Restart it twice to attempt to clear the issues
    ssh -l admin -p 8022 localhost safe-restart
    sleep 1m
    ssh -l admin -p 8022 localhost safe-restart
fi

```

We’ve recently included the sleep and the second “safe-restart” because after this script runs every night, we get spurious error messages about Java trust anchors and issues with git like this:

```auto
05:02:00 ERROR: Error cloning remote repo 'origin'
05:02:00 hudson.plugins.git.GitException: Could not init /var/lib/jenkins/workspace/amphora-el9
05:02:00 at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1085)
05:02:00 at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:831)
05:02:00 at PluginClassLoader for git//hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1221)
05:02:00 at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1311)
05:02:00 at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1278)
05:02:00 at hudson.scm.SCM.checkout(SCM.java:540)

```

It’s like the environment is trashed in some way and various things (including “git”) cannot be found:

```auto
05:02:00 Caused by: java.io.IOException: Cannot run program "git" (in directory "/var/lib/jenkins/workspace/amphora-el9"): error=2, No such file or directory

```

We can work around this by issuing:

```auto
systemctl restart jenkins.service 

```

However we dont want to “automate” this incase a job is running.  
Any advice would be appreciated.
