0

Everytime I run apt upgrade and there is an actual upgrade, a service that I have created gets restarted. Typically, I get this message

┌────┤ Daemons using outdated libraries ├─────┐
│                                             │
│                                             │
│ Which services should be restarted?         │
│                                             │
│    [ ] unattended-upgrades.service          │
│    [*] wildfly.service                      │
│                                             │
│                                             │
│          <Ok>              <Cancel>  

This seems to be related to needrestart, see output below:

$sudo needrestart -u NeedRestart::UI::stdio -r l

Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Services to be restarted:
 systemctl restart wildfly.service

This is the service configuration:

[Unit]
Description=WildFly Application Server
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=wildfly
Group=wildfly

StandardOutput=null

ExecStart=/opt/wildfly/wildfly-26.1.1.Final/bin/standalone.sh
ExecReload=/opt/wildfly/wildfly-26.1.1.Final/bin/jboss-cli.sh --connect --commands="reload"
ExecStop=/opt/wildfly/wildfly-26.1.1.Final/bin/jboss-cli.sh --connect --commands="shutdown"

[Install]
WantedBy=multi-user.target

What do I need to change so that the service does not get restarted unnecessarily in the future?

2
  • hard to say - but you described your dependencies very clearly: network-online.target. During update of network components the target will stop.
    – kanehekili
    Jan 24, 2023 at 7:54
  • @kanehekili Thanks for this. In the end it was unrelated, see my answer.
    – assylias
    Jan 24, 2023 at 15:23

1 Answer 1

1

This was due to java archives (jar) files in the wildfly temporary deployment folder. This can be seen by running needrestart in verbose mode:

sudo needrestart -b -v

Since my custom service does not need to be restarted on upgrades, I added a exception by creating a wildfly.conf file in /etc/needrestart/conf.d/:

$nrconf{blacklist_rc} = [
    q(^wildfly) ,
];

Note: I got the idea from a related issue in Tomcat.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .