Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #189321

Re: Re: Prevent apt/dpkg from automatically enabling services during the upgrade process.

From davidson <davidson@freevolt.org>
Newsgroups linux.debian.user
Subject Re: Re: Prevent apt/dpkg from automatically enabling services during the upgrade process.
Date 2017-11-26 22:00 +0100
Message-ID <uQcbU-4lv-5@gated-at.bofh.it> (permalink)
References <uwul4-Px-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 3 Oct 2017, cabezachumbo@gmail.com wrote:

> Hello!
> I guess that the script prevents from enabling currently disabled services.
> One more thing, what should I do if I also want that after installing a new
> service with "apt install service" it doesn't get enabled automatically in the
> installation process?

$ man -k systemd.preset
systemd.preset (5)   - Service enablement presets

$ man systemd.preset
---8<---
| DESCRIPTION
|   Preset files may be used to encode policy which units shall be
|   enabled by default and which ones shall be disabled. They are read
|   by systemctl preset (for more information see systemctl(1)) which
|   uses this information to enable or disable a unit according to
|   preset policy.  systemctl preset is used by the post install
|   scriptlets of RPM packages (or other OS package formats), to
|   enable/disable specific units by default on package installation,
|   enforcing distribution, spin or administrator preset policy. This
|   allows choosing a certain set of units to be enabled/disabled even
|   before installing the actual package.
---8<---
| EXAMPLE
---8<---
|  Example 3. Administrator policy /etc/systemd/system-preset/00-lennart.preset:

|      enable httpd.service
|      enable sshd.service
|      enable postfix.service
|      disable *

|  This enables three specific services and disables all others. This is
|  useful for administrators to specifically select the units to enable,
|  and disable all others. Due to the filename prefix "00-" it will be
|  read early and hence overrides all other preset policy files.
---8<---

The thread is from early October, and presumably the OP has resolved
the issue to their satisfaction. But it was not until today that I
stumbled across the systemd.preset man page, and noticed that it seems
to be saying "Hello, I am the solution to that very problem".

Maybe it will be of interest to somebody.

That is all.

> Thank you very much Reco.
> Regards.
>[Reco wrote:]
>> It's a hack, but it should work. Create an executable file called
>> /usr/sbin/policy-rc.d with the following contents:
>>
>> #!/bin/sh
>> /bin/systemctl --quiet is-enabled $1 && exit 0
>> echo All rc operations are disabled by policy: $1 $2
>> exit 101
>>
>> Reco

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Re: Prevent apt/dpkg from automatically enabling services during the upgrade process. cabezachumbo@gmail.com - 2017-10-03 14:20 +0200
  Re: Re: Prevent apt/dpkg from automatically enabling services during  the upgrade process. davidson <davidson@freevolt.org> - 2017-11-26 22:00 +0100
    Re: Re: Prevent apt/dpkg from automatically enabling services during  the upgrade process. davidson <davidson@freevolt.org> - 2017-11-26 22:10 +0100

csiph-web