salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] Failed to enable unit: Unit file /etc/systemd/system/salt-master.service is masked.

Open dseomn opened this issue 1 year ago • 8 comments

Description

When I try to install salt-master from the repo mentioned by https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/debian.html I get this error:

Setting up salt-master (3007.0) ...
/usr/bin/systemctl
Synchronizing state of salt-master.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable salt-master
Failed to enable unit: Unit file /etc/systemd/system/salt-master.service is masked.
dpkg: error processing package salt-master (--configure):
 installed salt-master package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 salt-master
Error: Sub-process /usr/bin/dpkg returned an error code (1)

I want the salt-run command from the salt-master package, but I don't want to run any salt services, so I masked salt-master.service. Shouldn't the install still work?

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • [x] on-prem machine
  • [ ] VM (Virtualbox, KVM, etc. please specify)
  • [ ] VM running on a cloud service, please be explicit and add details
  • [ ] container (Kubernetes, Docker, containerd, etc. please specify)
  • [ ] or a combination, please be explicit
  • [ ] jails if it is FreeBSD
  • [ ] classic packaging
  • [x] onedir packaging
  • [ ] used bootstrap to install

Steps to Reproduce the behavior

  1. Make /etc/systemd/system/salt-master.service a symlink to /dev/null.
  2. Install salt-master 3007.0 from https://repo.saltproject.io/salt/py3/debian/12/amd64/latest

Expected behavior

The package installs successfully, but does not enable or start the salt-master service.

Screenshots N/A

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3007.0
 
Python Version:
        Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.3
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.15.1
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian n/a trixie
        locale: utf-8
       machine: x86_64
       release: 6.7.12-amd64
        system: Linux
       version: Debian GNU/Linux n/a trixie

Additional context N/A

dseomn avatar May 12 '24 22:05 dseomn

I can confirm this:

systemctl mask salt-minion
systemctl mask salt-master

Works for the minion:

curl -L https://bootstrap.saltproject.io | sh -s -- -X -d onedir latest

Doesn't work for the master:

curl -L https://bootstrap.saltproject.io | sh -s -- -X -d -M onedir latest

max-arnold avatar May 14 '24 12:05 max-arnold

I had the same problem here:

When upgrading debian salt packages, the current status of the services are not managed:

  • previously disabled packages became enable
  • masked packages make the upgrade fail
Status of the services before upgrade
○ salt-master.service - The Salt Master Server
     Loaded: loaded (/lib/systemd/system/salt-master.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:salt-master(1)
             file:///usr/share/doc/salt/html/contents.html
             https://docs.saltproject.io/en/latest/contents.html

○ salt-minion.service - The Salt Minion
     Loaded: loaded (/lib/systemd/system/salt-minion.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:salt-minion(1)
             file:///usr/share/doc/salt/html/contents.html
             https://docs.saltproject.io/en/latest/contents.html

○ salt-api.service
     Loaded: masked (Reason: Unit salt-api.service is masked.)
     Active: inactive (dead)
Error log during upgrade
Status of the services after failed upgrade
○ salt-master.service - The Salt Master Server
     Loaded: loaded (/lib/systemd/system/salt-master.service; enabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:salt-master(1)
             file:///usr/share/doc/salt/html/contents.html
             https://docs.saltproject.io/en/latest/contents.html

○ salt-minion.service - The Salt Minion
     Loaded: loaded (/lib/systemd/system/salt-minion.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:salt-minion(1)
             file:///usr/share/doc/salt/html/contents.html
             https://docs.saltproject.io/en/latest/contents.html

○ salt-api.service
     Loaded: masked (Reason: Unit salt-api.service is masked.)
     Active: inactive (dead)

Steps to Reproduce the behavior

On a Debian 12 Bookworm server

  1. install 3006.8 salt packages sh bootstrap-salt.sh -Q stable 3006.8
  2. install salt-api with apt install salt-api
  3. disable salt-master and salt-minion with systemctl disable --now salt-master.service salt-minion.service
  4. mask salt-api with systemctl mask --now salt-api.service
  5. update salt sources /etc/apt/sources.list.d/salt.list to switch to 3007.1 deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg] https://repo.saltproject.io/salt/py3/debian/12/amd64/minor/3007.1/ bookworm main
  6. upgrade packages with apt full-upgrade
salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3007.1
 
Python Version:
        Python: 3.10.14 (main, Apr  3 2024, 21:30:09) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.16.0
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian 12.6 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-22-amd64
        system: Linux
       version: Debian GNU/Linux 12.6 bookworm

I'll try to make a PR to update the deb script with actual Debian standards.

baby-gnu avatar Jul 03 '24 13:07 baby-gnu

My contribution in #66688 does the job

systemctl status salt-master.service salt-minion.service salt-api.service salt-syndic.service
○ salt-master.service
     Loaded: masked (Reason: Unit salt-master.service is masked.)
     Active: inactive (dead)

○ salt-minion.service
     Loaded: masked (Reason: Unit salt-minion.service is masked.)
     Active: inactive (dead)

○ salt-api.service
     Loaded: masked (Reason: Unit salt-api.service is masked.)
     Active: inactive (dead)

○ salt-syndic.service
     Loaded: masked (Reason: Unit salt-syndic.service is masked.)
     Active: inactive (dead)
apt install ./salt*.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'salt-api' instead of './salt-api_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-cloud' instead of './salt-cloud_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-common' instead of './salt-common_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-master' instead of './salt-master_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-minion' instead of './salt-minion_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-ssh' instead of './salt-ssh_3007.1+211.g477aae15c6_amd64.deb'
Note, selecting 'salt-syndic' instead of './salt-syndic_3007.1+211.g477aae15c6_amd64.deb'
The following packages will be upgraded:
  salt-api salt-cloud salt-common salt-master salt-minion salt-ssh salt-syndic
7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/34.3 MB of archives.
After this operation, 16.3 MB disk space will be freed.
Get:1 /root/salt/salt-syndic_3007.1+211.g477aae15c6_amd64.deb salt-syndic amd64 3007.1+211.g477aae15c6 [78.6 kB]
Get:2 /root/salt/salt-cloud_3007.1+211.g477aae15c6_amd64.deb salt-cloud amd64 3007.1+211.g477aae15c6 [81.3 kB]
Get:3 /root/salt/salt-ssh_3007.1+211.g477aae15c6_amd64.deb salt-ssh amd64 3007.1+211.g477aae15c6 [80.4 kB]
Get:4 /root/salt/salt-master_3007.1+211.g477aae15c6_amd64.deb salt-master amd64 3007.1+211.g477aae15c6 [107 kB]
Get:5 /root/salt/salt-common_3007.1+211.g477aae15c6_amd64.deb salt-common amd64 3007.1+211.g477aae15c6 [33.8 MB]
Get:6 /root/salt/salt-minion_3007.1+211.g477aae15c6_amd64.deb salt-minion amd64 3007.1+211.g477aae15c6 [94.0 kB]
Get:7 /root/salt/salt-api_3007.1+211.g477aae15c6_amd64.deb salt-api amd64 3007.1+211.g477aae15c6 [78.8 kB]
(Reading database ... 197699 files and directories currently installed.)
Preparing to unpack .../0-salt-syndic_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-syndic (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../1-salt-cloud_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-cloud (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../2-salt-ssh_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-ssh (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../3-salt-master_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-master (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../4-salt-common_3007.1+211.g477aae15c6_amd64.deb ...
usermod: no changes
Unpacking salt-common (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../5-salt-minion_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-minion (3007.1+211.g477aae15c6) over (3007.1) ...
Preparing to unpack .../6-salt-api_3007.1+211.g477aae15c6_amd64.deb ...
Unpacking salt-api (3007.1+211.g477aae15c6) over (3007.1) ...
Setting up salt-common (3007.1+211.g477aae15c6) ...
Setting up salt-ssh (3007.1+211.g477aae15c6) ...
Setting up salt-cloud (3007.1+211.g477aae15c6) ...
Setting up salt-minion (3007.1+211.g477aae15c6) ...
salt-minion.service is a disabled or a static unit not running, not starting it.
Setting up salt-master (3007.1+211.g477aae15c6) ...
Failed to preset unit, unit /etc/systemd/system/salt-master.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on salt-master.service: No such file or directory
salt-master.service is a disabled or a static unit not running, not starting it.
Setting up salt-syndic (3007.1+211.g477aae15c6) ...
salt-syndic.service is a disabled or a static unit not running, not starting it.
Setting up salt-api (3007.1+211.g477aae15c6) ...
Failed to preset unit, unit /etc/systemd/system/salt-api.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on salt-api.service: No such file or directory
salt-api.service is a disabled or a static unit not running, not starting it.
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.2) ...
Scanning processes...                                                                                                                                                                    
Scanning linux images...                                                                                                                                                                 

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
N: Download is performed unsandboxed as root as file '/root/salt/salt-syndic_3007.1+211.g477aae15c6_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
systemctl status salt-master.service salt-minion.service salt-api.service salt-syndic.service
○ salt-master.service
     Loaded: masked (Reason: Unit salt-master.service is masked.)
     Active: inactive (dead)

○ salt-minion.service
     Loaded: masked (Reason: Unit salt-minion.service is masked.)
     Active: inactive (dead)

○ salt-api.service
     Loaded: masked (Reason: Unit salt-api.service is masked.)
     Active: inactive (dead)

○ salt-syndic.service
     Loaded: masked (Reason: Unit salt-syndic.service is masked.)
     Active: inactive (dead)

baby-gnu avatar Jul 04 '24 09:07 baby-gnu

@dseomn FYI - the problem with systemd state being preserved or set correctly was fixed on the Salt 3006.x branch with https://github.com/saltstack/salt/pull/66218 along with pkg tests checking for various systemd enable/disable, active/inactive. It should be in the next release of Salt 3006.9, which should be getting released soon.

dmurphy18 avatar Jul 17 '24 16:07 dmurphy18