That's because your previous version had the restart in it. The restart unfortunately happens when the package is uninstalled, and thus applies to the previous version, not the new version. There isn't much you can do about that you will just need to be careful.

-Paul Edmon-

On 2/4/26 1:08 PM, Ron Gould via slurm-users wrote:
I modified the "slurm.spec" file in the TAR.BZ2 file by prepending "###" to the

`%systemd_postun_with_restart slurmdbd.service`

line at the end, in the "%postun" section and added

`%systemd_postun slurmdbd.service`

That didn't seem to work.

I still ended up with a postuninstall script that tries to restart the slurmdbd 
service:

```
# rpm -q --scripts 
"rpmbuild.20260204/RPMS/x86_64/slurm-slurmdbd-22.05.4-1.el8.x86_64.rpm"
postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then
         # Initial installation
         systemctl --no-reload preset slurmdbd.service &>/dev/null || :
fi
preuninstall scriptlet (using /bin/sh):

if [ $1 -eq 0 ] ; then
         # Package removal, not upgrade
         systemctl --no-reload disable --now slurmdbd.service &>/dev/null || :
fi
postuninstall scriptlet (using /bin/sh):
###
if [ $1 -ge 1 ] ; then
         # Package upgrade, not uninstall
         systemctl try-restart slurmdbd.service &>/dev/null || :
fi
```

The prepended "###" on that line might've been the problem. If I just changed 
the SPEC file to

```
...
%post slurmdbd
%systemd_post slurmdbd.service
%preun slurmdbd
%systemd_preun slurmdbd.service
%postun slurmdbd
%systemd_postun slurmdbd.service
```
,

I then get a better looking postuninstall script:

```
# rpm -q --scripts "rpmbuild.20260204 Modified SPEC 
v1/RPMS/x86_64/slurm-slurmdbd-22.05.4-1.el8.x86_64.rpm"
postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then
         # Initial installation
         systemctl --no-reload preset slurmdbd.service &>/dev/null || :
fi
preuninstall scriptlet (using /bin/sh):

if [ $1 -eq 0 ] ; then
         # Package removal, not upgrade
         systemctl --no-reload disable --now slurmdbd.service &>/dev/null || :
fi
postuninstall program: /bin/sh
```

Is having an empty "postuninstall program: /bin/sh" entry okay?


--
slurm-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to