Re: exim update not responding to update-rc.d

2021-05-06 Thread Michael Biebl

Am 07.05.21 um 02:12 schrieb Michael Biebl:

exim4 is unfortunately still SysV-only and doesn't ship a native systemd
.service file. So the correct command is

"update-rc.d exim4 disable"


For the curious: you can run "systemctl disable exim4" as well.
This will just run the above command though via
/lib/systemd/systemd-sysv-install

It's a thin wrapper to make systemctl more convenient to use and you 
don't need to remember whether a service has a native .service unit file 
or still ships only a legacy SysV init script.




OpenPGP_signature
Description: OpenPGP digital signature


Re: exim update not responding to update-rc.d

2021-05-06 Thread Michael Biebl
exim4 is unfortunately still SysV-only and doesn't ship a native systemd
.service file. So the correct command is

"update-rc.d exim4 disable"

"update-rc.d exim4 remove" will remove the symlinks in /etc/rc?.d/ but on
the next package update, they will be recreated.

So if you want to make this a permanent change, use "disable"

man update-rc.d has a section "DISABLING INIT SCRIPT START LINKS"

Regards,
Michael


signature.asc
Description: This is a digitally signed message part


Re: exim update not responding to update-rc.d

2021-05-05 Thread Greg Wooledge
On Wed, May 05, 2021 at 05:27:13PM +0300, Andrei POPESCU wrote:
> On Mi, 05 mai 21, 07:46:03, Greg Wooledge wrote:
> > 
> > You're using a package that has not yet been converted to systemd.  It's
> > still using an old init.d script, and systemd is performing a conversion
> > on the fly.
> > 
> > The basic start and stop subcommands will work fine, but disable may
> > not work.  It's not clear from the systemd-sysv-generator man page, but my
> > guess is that the auto-generation of systemd units takes place in memory
> > at boot time, and applies to all the init.d scripts that systemd sees.
> > Doing a "disable" after this would only affect the generated services,
> > which are ephemeral and go away when you reboot.
> 
> As far as I recall (but it's been a while since I needed this) 
> update-rc.d is the correct tool and it should even take care of 
> synchronizing state between systemd and sysv-rc.

Hmm.  Well, I suppose it's possible, especially if the OP kept using the
wrong filename (exim vs. exim4).

I still wouldn't care to try it, personally.  Knowing that it's a native
init.d service, I would use the appropriate tools for that.

> In any case, masking should work as the symlink to /dev/null is in /etc.
> 
> systemctl mask exim4.service

That would, of course, prevent "start" and "stop" from working on it in
the future.  Which makes me wonder why on earth the OP wants to disable
exim4 in the first place.

I smell an X-Y problem here.



Re: exim update not responding to update-rc.d

2021-05-05 Thread Andrei POPESCU
On Mi, 05 mai 21, 07:46:03, Greg Wooledge wrote:
> 
> You're using a package that has not yet been converted to systemd.  It's
> still using an old init.d script, and systemd is performing a conversion
> on the fly.
> 
> The basic start and stop subcommands will work fine, but disable may
> not work.  It's not clear from the systemd-sysv-generator man page, but my
> guess is that the auto-generation of systemd units takes place in memory
> at boot time, and applies to all the init.d scripts that systemd sees.
> Doing a "disable" after this would only affect the generated services,
> which are ephemeral and go away when you reboot.

As far as I recall (but it's been a while since I needed this) 
update-rc.d is the correct tool and it should even take care of 
synchronizing state between systemd and sysv-rc.

> To permanently disable the starting of this service, you'll need to
> use the actual sysv-rc techniques (either removing or renaming symlinks,
> or using Debian's weird update-rc.d tool which relies on parsing comments
> inside the init.d script).

In any case, masking should work as the symlink to /dev/null is in /etc.

systemctl mask exim4.service


Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser


signature.asc
Description: PGP signature


Re: exim update not responding to update-rc.d

2021-05-05 Thread Greg Wooledge
On Wed, May 05, 2021 at 12:07:29PM +0100, Joe wrote:
> On Tue, 4 May 2021 18:44:12 -0400
> Greg Wooledge  wrote:
> > 
> > Could you kindly tell us what "systemctl status exim4.service" says
> > on this buster machine of yours?  Perhaps your command is turning up
> > one of the automatically converted init.d scripts.  If so, this will
> > be made clear in the systemctl status report.
> 
> ● exim4.service - LSB: exim Mail Transport Agent
>Loaded: loaded (/etc/init.d/exim4; generated)
>Active: active (running) since Wed 2021-03-31 08:38:00 BST; 1 months
> 4 days ago Docs: man:systemd-sysv-generator(8)
> Tasks: 1 (limit: 2062)
>CGroup: /system.slice/exim4.service
>└─6453 /usr/sbin/exim4 -bd -q30m

Yes, that's what I saw on my single buster exim4 system as well.  Note the
"Loaded:" line which shows that this is using a converted init.d script,
and not a native systemd unit.

It also tells you which man page to read, to learn more about the
automatic conversion of init.d scripts into systemd units.  Not that
this man page says very much, but at least it's there.

(Note that it also tells you the full name of the init.d script, in
this case "exim4".  Not "exim".)

> Probably worth mentioning that this is on a Raspberry Pi, the current
> version of RasPiOs (formerly Raspbian) with a default exim4
> installation.

Yes, thank you.  In this case it looks like they haven't changed the
startup configuration from the Debian packages, but you never know.

In the future, please refrain from calling non-Debian systems by
Debian release names.  It just adds another layer of confusion.

> all  configuration for the Exim MTA (v4) ii  exim4-daemon-light
> 4.92-8+deb10u5armhf
> lightweight Exim MTA (v4) daemon

Or they're literally using the Debian packages, and didn't even rebuild
them.

> I have the same service on my main server (stretch) where it is the
> network MTA and also on my sid workstation. Again, I didn't do anything
> to achieve this. Presumably it's using an init.d script, but it
> certainly works to start and stop exim4 via systemctl.

You're using a package that has not yet been converted to systemd.  It's
still using an old init.d script, and systemd is performing a conversion
on the fly.

The basic start and stop subcommands will work fine, but disable may
not work.  It's not clear from the systemd-sysv-generator man page, but my
guess is that the auto-generation of systemd units takes place in memory
at boot time, and applies to all the init.d scripts that systemd sees.
Doing a "disable" after this would only affect the generated services,
which are ephemeral and go away when you reboot.

To permanently disable the starting of this service, you'll need to
use the actual sysv-rc techniques (either removing or renaming symlinks,
or using Debian's weird update-rc.d tool which relies on parsing comments
inside the init.d script).



Re: exim update not responding to update-rc.d

2021-05-05 Thread Joe
On Tue, 4 May 2021 18:44:12 -0400
Greg Wooledge  wrote:

> On Tue, May 04, 2021 at 10:14:45PM +0100, Joe wrote:
> > ...and buster. It's exim4.service as stated by:
> >  systemctl --type=service | grep exim  
> 
> According to packages.debian.org[1] there is no such file in any
> package.
> 
> Of course, that's not proof of the nonexistence of such a file,
> because it might have been created by some postinst script.  In
> theory.
> 
> Could you kindly tell us what "systemctl status exim4.service" says
> on this buster machine of yours?  Perhaps your command is turning up
> one of the automatically converted init.d scripts.  If so, this will
> be made clear in the systemctl status report.

● exim4.service - LSB: exim Mail Transport Agent
   Loaded: loaded (/etc/init.d/exim4; generated)
   Active: active (running) since Wed 2021-03-31 08:38:00 BST; 1 months
4 days ago Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 2062)
   CGroup: /system.slice/exim4.service
   └─6453 /usr/sbin/exim4 -bd -q30m


> 
> It would also be helpful to know which of the multiple different exim4
> package sets you're working with. 

Probably worth mentioning that this is on a Raspberry Pi, the current
version of RasPiOs (formerly Raspbian) with a default exim4
installation.

sudo dpkg -l | grep exim
ii  exim4  4.92-8+deb10u5
 all  metapackage to ease Exim MTA (v4) installation ii
exim4-base 4.92-8+deb10u5
armhfsupport files for all Exim MTA (v4) packages ii
exim4-config   4.92-8+deb10u5
all  configuration for the Exim MTA (v4) ii  exim4-daemon-light
4.92-8+deb10u5armhf
lightweight Exim MTA (v4) daemon


> Perhaps this alleged exim4.service
> comes from the -heavy daemon package.  All I can tell you is that on
> the buster system that I checked, which is using the
> exim4-daemon-light package, there is *no* exim4.service, but there
> *is* an init.d script, and systemctl status exim4 shows this plainly.
> 
> [1]
> https://packages.debian.org/search?searchon=contents=exim4.service=exactfilename=stable=any
> 

I have the same service on my main server (stretch) where it is the
network MTA and also on my sid workstation. Again, I didn't do anything
to achieve this. Presumably it's using an init.d script, but it
certainly works to start and stop exim4 via systemctl.

-- 
Joe



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 10:14:45PM +0100, Joe wrote:
> ...and buster. It's exim4.service as stated by:
>  systemctl --type=service | grep exim

According to packages.debian.org[1] there is no such file in any
package.

Of course, that's not proof of the nonexistence of such a file, because
it might have been created by some postinst script.  In theory.

Could you kindly tell us what "systemctl status exim4.service" says
on this buster machine of yours?  Perhaps your command is turning up
one of the automatically converted init.d scripts.  If so, this will
be made clear in the systemctl status report.

It would also be helpful to know which of the multiple different exim4
package sets you're working with.  Perhaps this alleged exim4.service
comes from the -heavy daemon package.  All I can tell you is that on
the buster system that I checked, which is using the exim4-daemon-light
package, there is *no* exim4.service, but there *is* an init.d script,
and systemctl status exim4 shows this plainly.

[1] 
https://packages.debian.org/search?searchon=contents=exim4.service=exactfilename=stable=any



Re: exim update not responding to update-rc.d

2021-05-04 Thread Joe
On Tue, 4 May 2021 18:27:57 +0100
Joe  wrote:

> On Tue, 4 May 2021 13:15:51 -0400
> Greg Wooledge  wrote:
> 
> > On Tue, May 04, 2021 at 10:03:43AM -0700, John Conover wrote:  
> > > That was the question, Greg:
> > > 
> > > "Searching for exim in
> > > /etc/systemd/system/multi-user.target.wants/* and
> > > /lib/systemd/system/* yields nothing."
> > > 
> > > so, it wasn't there. Which service?, (or how to find out?)
> > 
> > So... I looked around for a buster system with exim.  It looks like
> > exim on buster was never converted to a systemd startup.  It's still
> > using legacy /etc/init.d/exim4 which is a big ol' honkin' script.
> > 
> > So, you need to apply sysv-rc methods to work with it.  Normally
> > this means you cd into /etc/rc2.d and rename the S* symlink so that
> > it won't start up.
> >   
> 
> It's a systemd service on stretch and sid.
> 

...and buster. It's exim4.service as stated by:
 systemctl --type=service | grep exim

-- 
Joe



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 01:46:29PM -0700, John Conover wrote:
> 
> Try:
> 
> man update-rc.d
> man 8 update-rc.d
> 

Please stop top-posting, and please reply to the list.


> Greg Wooledge writes:
> > On Tue, May 04, 2021 at 01:27:56PM -0700, John Conover wrote:
> > > As per the man page for System V init, to disable launching of exim:
> > > 
> > > update-rc.d -f exim remove
> > 
> > What man page is this allegedly from, exactly?

unicorn:~$ man update-rc.d | grep exim
unicorn:~$ man 8 update-rc.d | grep exim
unicorn:~$ 

I asked what man page it's from, because whatever man page is saying
that the name of the init.d script for exim4 is "exim" needs to be
fixed.  It's obviously "exim4", and a competent sysadmin would verify
this by LOOKING IN THE DIRECTORY.

But I'm getting the impression that this is *not* in fact a direct quote
from any Debian man page, but rather, a failed assumption on the part of
the OP.



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 01:27:56PM -0700, John Conover wrote:
> As per the man page for System V init, to disable launching of exim:
> 
> update-rc.d -f exim remove

What man page is this allegedly from, exactly?



Re: exim update not responding to update-rc.d

2021-05-04 Thread John Conover


For the archives, this issue was created by looking for penetration
vulnerabilities during the boot of a Debian Buster machine using
tcpdump(1) on a machine between Buster, and the it's Internet facing
router.

There was exim traffic when exim boots, but exim was SUPPOSED to be
disabled during boot by policy.

As per the man page for System V init, to disable launching of exim:

update-rc.d -f exim remove

which would be (re-)enabled with:

update-rc.d -f exim defaults

which installs the ln -s files in /etc/rc*.d, as appropriate.

The correct command on Buster is:

update-rc.d -f exim4 remove

It was discovered during routine security audit of iptables(1)
configuration, (specifically, IPv6.)

John

john doe writes:
> On 5/4/2021 7:28 PM, Erwan David wrote:
> > Le 04/05/2021 à 19:26, Joe a écrit :
> >> On Tue, 4 May 2021 10:03:43 -0700
> >> cono...@rahul.net (John Conover) wrote:
> >>
> >>> Greg Wooledge writes:
>  On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:
> > Searching for exim in
> > /etc/systemd/system/multi-user.target.wants/* and
> > /lib/systemd/system/* yields nothing.
> >
> > How do I stop exim from launching across boots?
>  Presumably there is a systemd service, which is enabled.  You will
>  want to disable it.
> 
> >>> That was the question, Greg:
> >>>
> >>>  "Searching for exim in
> >>>  /etc/systemd/system/multi-user.target.wants/* and
> >>>  /lib/systemd/system/* yields nothing."
> >>>
> >>> so, it wasn't there. Which service?, (or how to find out?) Or, maybe,
> >>> it is under /etc/init.d/exim4, which failed to work, so, I was looking
> >>> into the systemd control files.
> >>>
> >> Try exim4.service
> >>
> > apt-file tells me trhere is a exim4-base.service (from package exim4-base)
> >
> 
> You could look in the log for the service name then do 'systemctl
> disable '.
> 
> I just want to mention 'inserv' but you should use systemd.
> 
> --
> John Doe

-- 

John Conover, cono...@rahul.net, http://www.johncon.com/



Re: exim update not responding to update-rc.d

2021-05-04 Thread john doe

On 5/4/2021 7:28 PM, Erwan David wrote:

Le 04/05/2021 à 19:26, Joe a écrit :

On Tue, 4 May 2021 10:03:43 -0700
cono...@rahul.net (John Conover) wrote:


Greg Wooledge writes:

On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:

Searching for exim in
/etc/systemd/system/multi-user.target.wants/* and
/lib/systemd/system/* yields nothing.

How do I stop exim from launching across boots?

Presumably there is a systemd service, which is enabled.  You will
want to disable it.


That was the question, Greg:

 "Searching for exim in
 /etc/systemd/system/multi-user.target.wants/* and
 /lib/systemd/system/* yields nothing."

so, it wasn't there. Which service?, (or how to find out?) Or, maybe,
it is under /etc/init.d/exim4, which failed to work, so, I was looking
into the systemd control files.


Try exim4.service


apt-file tells me trhere is a exim4-base.service (from package exim4-base)



You could look in the log for the service name then do 'systemctl
disable '.

I just want to mention 'inserv' but you should use systemd.

--
John Doe



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 10:27:17AM -0700, John Conover wrote:
> 
> Thanks, Greg. "update-rc.d -f exim remove" is the command for
> /etc/init.d.  But its broken.

You forgot to reply to the list.

Nobody with any sense uses update-rc.d for system admin work.  It's
there for Debian packages to use, and god only knows what it will do
if you actually try to use it.

As a sysadmin, you're expected to handle the symlinks yourself.  So
just go to /etc/rc2.d/ and rename S04exim4 to something that doesn't
start with an S.  I personally use "disabled.S04exim4" or whatever,
so that I have the original name with its sequence number available
when I want to put it back to how it was originally.



Re: exim update not responding to update-rc.d

2021-05-04 Thread Erwan David
Le 04/05/2021 à 19:26, Joe a écrit :
> On Tue, 4 May 2021 10:03:43 -0700
> cono...@rahul.net (John Conover) wrote:
>
>> Greg Wooledge writes:
>>> On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:  
 Searching for exim in
 /etc/systemd/system/multi-user.target.wants/* and
 /lib/systemd/system/* yields nothing.

 How do I stop exim from launching across boots?  
>>> Presumably there is a systemd service, which is enabled.  You will
>>> want to disable it.
>>>  
>> That was the question, Greg:
>>
>> "Searching for exim in
>> /etc/systemd/system/multi-user.target.wants/* and
>> /lib/systemd/system/* yields nothing."
>>
>> so, it wasn't there. Which service?, (or how to find out?) Or, maybe,
>> it is under /etc/init.d/exim4, which failed to work, so, I was looking
>> into the systemd control files.
>>
> Try exim4.service
>
apt-file tells me trhere is a exim4-base.service (from package exim4-base)



Re: exim update not responding to update-rc.d

2021-05-04 Thread Joe
On Tue, 4 May 2021 13:15:51 -0400
Greg Wooledge  wrote:

> On Tue, May 04, 2021 at 10:03:43AM -0700, John Conover wrote:
> > That was the question, Greg:
> > 
> > "Searching for exim in
> > /etc/systemd/system/multi-user.target.wants/* and
> > /lib/systemd/system/* yields nothing."
> > 
> > so, it wasn't there. Which service?, (or how to find out?)  
> 
> So... I looked around for a buster system with exim.  It looks like
> exim on buster was never converted to a systemd startup.  It's still
> using legacy /etc/init.d/exim4 which is a big ol' honkin' script.
> 
> So, you need to apply sysv-rc methods to work with it.  Normally this
> means you cd into /etc/rc2.d and rename the S* symlink so that it
> won't start up.
> 

It's a systemd service on stretch and sid.

-- 
Joe



Re: exim update not responding to update-rc.d

2021-05-04 Thread Joe
On Tue, 4 May 2021 10:03:43 -0700
cono...@rahul.net (John Conover) wrote:

> Greg Wooledge writes:
> > On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:  
> > > Searching for exim in
> > > /etc/systemd/system/multi-user.target.wants/* and
> > > /lib/systemd/system/* yields nothing.
> > > 
> > > How do I stop exim from launching across boots?  
> > 
> > Presumably there is a systemd service, which is enabled.  You will
> > want to disable it.
> >  
> 
> That was the question, Greg:
> 
> "Searching for exim in
> /etc/systemd/system/multi-user.target.wants/* and
> /lib/systemd/system/* yields nothing."
> 
> so, it wasn't there. Which service?, (or how to find out?) Or, maybe,
> it is under /etc/init.d/exim4, which failed to work, so, I was looking
> into the systemd control files.
> 

Try exim4.service

-- 
Joe



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 10:03:43AM -0700, John Conover wrote:
> That was the question, Greg:
> 
> "Searching for exim in
> /etc/systemd/system/multi-user.target.wants/* and
> /lib/systemd/system/* yields nothing."
> 
> so, it wasn't there. Which service?, (or how to find out?)

So... I looked around for a buster system with exim.  It looks like
exim on buster was never converted to a systemd startup.  It's still
using legacy /etc/init.d/exim4 which is a big ol' honkin' script.

So, you need to apply sysv-rc methods to work with it.  Normally this
means you cd into /etc/rc2.d and rename the S* symlink so that it
won't start up.

Good luck.



Re: exim update not responding to update-rc.d

2021-05-04 Thread John Conover
Greg Wooledge writes:
> On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:
> > Searching for exim in /etc/systemd/system/multi-user.target.wants/*
> > and /lib/systemd/system/* yields nothing.
> > 
> > How do I stop exim from launching across boots?
> 
> Presumably there is a systemd service, which is enabled.  You will want
> to disable it.
>

That was the question, Greg:

"Searching for exim in
/etc/systemd/system/multi-user.target.wants/* and
/lib/systemd/system/* yields nothing."

so, it wasn't there. Which service?, (or how to find out?) Or, maybe,
it is under /etc/init.d/exim4, which failed to work, so, I was looking
into the systemd control files.

Thanks,

John

-- 

John Conover, cono...@rahul.net, http://www.johncon.com/



Re: exim update not responding to update-rc.d

2021-05-04 Thread Greg Wooledge
On Tue, May 04, 2021 at 09:17:38AM -0700, John Conover wrote:
> Searching for exim in /etc/systemd/system/multi-user.target.wants/*
> and /lib/systemd/system/* yields nothing.
> 
> How do I stop exim from launching across boots?

Presumably there is a systemd service, which is enabled.  You will want
to disable it.

So, figure out the name of this service (assuming it does in fact exist),
and then issue the command:

systemctl disable servicename

as root, of course.  That will make it refrain from starting up at the
next boot.  To stop it right now, also issue this command:

systemctl stop servicename

Or, if you prefer, you can combine the two:

systemctl --now disable servicename



exim update not responding to update-rc.d

2021-05-04 Thread John Conover


I use either exim or another MTA. When I want to use the other MTA,
"update-rc.d -f exim remove" does not remove exim from "ps eax" after
today's exim update.

Searching for exim in /etc/systemd/system/multi-user.target.wants/*
and /lib/systemd/system/* yields nothing.

How do I stop exim from launching across boots?

Thanks,

John

-- 

John Conover, cono...@rahul.net, http://www.johncon.com/