salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] Debian packages: salt-master is not restarted after package upgrade

Open gclinch opened this issue 1 year ago • 1 comments

Description The salt-master systemd service is not restarted during a Debian package upgrade, so the previously executing master process continues to run. This contrasts with the salt-minion, which is restarted during an upgrade.

Setup

These upgrades are not driven by salt (performed by apt upgrade/unattended-upgrades etc), so the salt configuration has no bearing.

Steps to Reproduce the behavior

$ # Download the deb package files and extract their control information
$ curl --silent --remote-name https://repo.saltproject.io/salt/py3/debian/12/amd64/latest/pool/salt-master_3006.7_amd64.deb --remote-name https://repo.saltproject.io/salt/py3/debian/12/amd64/latest/pool/salt-minion_3006.7_amd64.deb
$ dpkg-deb --control salt-master_3006.7_amd64.deb master
$ dpkg-deb --control salt-minion_3006.7_amd64.deb minion
$
$ # See that the master's postinst only enables the service but does not restart it (and that postinst is a custom script, not generated by debhelper)
$ fgrep system master/postinst
    if command -v systemctl; then systemctl enable salt-master; fi
$
$ # Compare with the minion's postinst, which is generated by debhelper and contains fragments to both enable and restart the service
$ fgrep system minion/postinst
# Automatically added by dh_systemd_enable/13.11.4
	deb-systemd-helper unmask 'salt-minion.service' >/dev/null || true
	if deb-systemd-helper --quiet was-enabled 'salt-minion.service'; then
		deb-systemd-helper enable 'salt-minion.service' >/dev/null || true
		deb-systemd-helper update-state 'salt-minion.service' >/dev/null || true
# Automatically added by dh_systemd_start/13.11.4
	if [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke $_dh_action 'salt-minion.service' >/dev/null || true
$ 

Expected behavior If the salt master is running before the package upgrade, it should be restarted during or after.

Versions Report

salt --versions-report
$ salt-master --versions-report
Salt Version:
          Salt: 3006.7
 
Python Version:
        Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.3
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.15.1
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 12 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-18-amd64
        system: Linux
       version: Debian GNU/Linux 12 bookworm

Additional context The cause is likely to be the existence of salt/pkg/debian/salt-master.postinst preventing debhelper from generating its standard fragment (there is no salt/pkg/debian/salt-minion.postinst, hence debhelper generates its own).

It is likely that this also affects salt-api, since that also has a custom postinst file.

gclinch avatar Feb 22 '24 11:02 gclinch

Will investigate this as part of the fixes for https://github.com/saltstack/salt/issues/65264, and PR https://github.com/saltstack/salt/pull/66218, since altering the files affected. Need to make sure ownership is preserved by these kinds of updates

dmurphy18 avatar Apr 30 '24 15:04 dmurphy18

Fixed with PR https://github.com/saltstack/salt/pull/66218

dmurphy18 avatar Jun 07 '24 19:06 dmurphy18

@gclinch Closing this since PR https://github.com/saltstack/salt/pull/66218 has been merged and should be available in 3006.9 which should be released very soon.

dmurphy18 avatar Jul 16 '24 16:07 dmurphy18