Score:0

Service restarted at every apt upgrade

in flag

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?

kanehekili avatar
zw flag
hard to say - but you described your dependencies very clearly: network-online.target. During update of network components the target will stop.
assylias avatar
in flag
@kanehekili Thanks for this. In the end it was unrelated, see my answer.
Score:1
in flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.