Re: How to inform users package is ready to use systemd

2025-04-05 Thread Carles Pina i Estany

Hi Marc,

On 02 Apr 2025 at 08:55:25, Marc Haber wrote:
> On Wed, Apr 02, 2025 at 07:20:32AM +0100, Carles Pina i Estany wrote:
> > I applied some of the suggestions of this thread in my package, thanks
> > very much.
> > 
> > On the other hand, while doing something else, I saw a package that had
> > a po-debconf template asking something similar to:
> > 
> > "Enable  at boot time?"
> > 
> > (or perhaps was "Enable  via a service in systemd?" (or equivalent
> > question).
> 
> This is wildly considered an antipattern. Don't do that.

I didn't see your email until now. Now: after I found two packages doing
that, so sorry if I'm finger-pointing! (it was just two nice phrases).
> 
> Policy 9.3 say that packages providing system services "should" arrange for
> those services to be automatically started. It is stil valid to arrange for
> the service not to be automatically started, see policy 9.3.3.1. The header
> of that section still says "managing the links", but I'd say that those
> things apply analogously to systemd.

I will review that policy, thanks very much.

> > For a package that is usually interesting to run it from systemd, but
> > some user might want to opt-out... is there any policy on against
> > asking?
> 
> It used to be common to have a setting in /etc/default/package, but that's
> also an antipattern. Users who don't want a service running should use the
> methods offered by the init system to disable those things (policy 9.3.3.1,
> near the end).
> 
> For packages starting and stopping system services, systemd integration is
> mandatory, so this is nothing to brag about (policy 9.3.1) explicitly. If a
> package runs a service that might be unexpected, that could of course be
> mentioned in the package description.
> 
> Greetings
> Marc
> 
> P.S.: Maybe I should mention in atop's description that the package arranges
> for an atop daemon running in the background. Thanks for bringing this up.

this is an example of a package that I wouldn't expect it.

I will look into the package, but I see that atop has:
Pre-Depends: init-system-helpers (>= 1.54~)

is this in order to use the systemd service?

To me, as a user, this give me a clue about that.

Should all packages using systemd try to have anything like that?
(retorical question if you want, I will look in why not a common
pattern).

Thank you,

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-04-04 Thread Carles Pina i Estany

Hi,

On 05 Apr 2025 at 07:24:27, Carles Pina i Estany wrote:
> 
> Hi,
> 
> Thanks all for the ideas in this thread about how to notify users that a
> package is ready to be used via systemd service and not used manually.
> Some users of simplemonitor missed it and it complicated their lifes.
> 
> On 26 Feb 2025 at 10:20:24, Jérémy Lal wrote:
> > Le mer. 26 févr. 2025 à 10:09, lorenzo  a écrit :
> > 
> > > On Wed, 26 Feb 2025 06:37:43 +0100
> > > Carles Pina i Estany  wrote:
> > >
> > > > So I still think that there is room to inform users that a package is
> > > > systemd ready and the name of the service and I wondered if there is a
> > > > way to do it.
> > >
> > > then you can use the package description to mention that the package
> > > include a simplemonitor systemd service
> > >
> > 
> >  And/or explain what needs to be done to work in README.Debian,
> > which is somewhat missing, btw, in the syncthing package.
> 
> Since I asked, I saw at least three packages that ask a question in the
> postinst via po-debconf. The last one that I see asking this type of
> question (I am reviewing/managing some po-debconf translations) is
> mopidy. I haven't checked the implementation and wether is a systemd
> integration but the question is:
> 
> """
> You have the option of starting the Mopidy server automatically on
> system boot. If in doubt, it is suggested to not start it automatically
> on boot.
> """

Another example in the mpdscribble package:
"""
You can install mpdscribble as a system daemon.  The mpdscribble service
will be started on boot. Note that is not necessary to run mpd as a
system service as it runs fine when started manually using a regular
user account.
"""

To me, this type of question is the most explicit way to inform the user
that there is a systemd integration.

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-04-04 Thread Carles Pina i Estany

Hi,

Thanks all for the ideas in this thread about how to notify users that a
package is ready to be used via systemd service and not used manually.
Some users of simplemonitor missed it and it complicated their lifes.

On 26 Feb 2025 at 10:20:24, Jérémy Lal wrote:
> Le mer. 26 févr. 2025 à 10:09, lorenzo  a écrit :
> 
> > On Wed, 26 Feb 2025 06:37:43 +0100
> > Carles Pina i Estany  wrote:
> >
> > > So I still think that there is room to inform users that a package is
> > > systemd ready and the name of the service and I wondered if there is a
> > > way to do it.
> >
> > then you can use the package description to mention that the package
> > include a simplemonitor systemd service
> >
> 
>  And/or explain what needs to be done to work in README.Debian,
> which is somewhat missing, btw, in the syncthing package.

Since I asked, I saw at least three packages that ask a question in the
postinst via po-debconf. The last one that I see asking this type of
question (I am reviewing/managing some po-debconf translations) is
mopidy. I haven't checked the implementation and wether is a systemd
integration but the question is:

"""
You have the option of starting the Mopidy server automatically on
system boot. If in doubt, it is suggested to not start it automatically
on boot.
"""

So, what do you think if a package asked if you want to enable (default)
or disable being ran from systemd at boot time? (and perhaps show how to
enable/disable/restart at that step?).

It seems that users would not miss it, they can choose, they know, etc.

I wonder why is not more common in the packages carrying systemd
integration. Specially for the ones that are not that clearly a server
(e.g. syncthing might be an example that someone might not expect to be
ran from systemd, probably everyone expects apache/etc.?)

Cheers,

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-04-02 Thread Marc Haber

On Wed, Apr 02, 2025 at 07:20:32AM +0100, Carles Pina i Estany wrote:

I applied some of the suggestions of this thread in my package, thanks
very much.

On the other hand, while doing something else, I saw a package that had
a po-debconf template asking something similar to:

"Enable  at boot time?"

(or perhaps was "Enable  via a service in systemd?" (or equivalent
question).


This is wildly considered an antipattern. Don't do that.

Policy 9.3 say that packages providing system services "should" arrange 
for those services to be automatically started. It is stil valid to 
arrange for the service not to be automatically started, see policy 
9.3.3.1. The header of that section still says "managing the links", but 
I'd say that those things apply analogously to systemd.



For a package that is usually interesting to run it from systemd, but
some user might want to opt-out... is there any policy on against
asking?


It used to be common to have a setting in /etc/default/package, but 
that's also an antipattern. Users who don't want a service running 
should use the methods offered by the init system to disable those 
things (policy 9.3.3.1, near the end).


For packages starting and stopping system services, systemd integration 
is mandatory, so this is nothing to brag about (policy 9.3.1) 
explicitly. If a package runs a service that might be unexpected, that 
could of course be mentioned in the package description.


Greetings
Marc

P.S.: Maybe I should mention in atop's description that the package 
arranges for an atop daemon running in the background. Thanks for 
bringing this up.


--
-
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany|  lose things."Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421



Re: How to inform users package is ready to use systemd

2025-04-01 Thread Carles Pina i Estany

Hi,

On 26 Feb 2025 at 09:52:28, lorenzo wrote:
> On Wed, 26 Feb 2025 06:37:43 +0100
> Carles Pina i Estany  wrote:
> 
> > So I still think that there is room to inform users that a package is
> > systemd ready and the name of the service and I wondered if there is a
> > way to do it.
> 
> then you can use the package description to mention that the package
> include a simplemonitor systemd service

I applied some of the suggestions of this thread in my package, thanks
very much.

On the other hand, while doing something else, I saw a package that had
a po-debconf template asking something similar to:

"Enable  at boot time?"

(or perhaps was "Enable  via a service in systemd?" (or equivalent
question).

I cannot find out which package it was now, I wanted to check the
implementation.

For a package that is usually interesting to run it from systemd, but
some user might want to opt-out... is there any policy on against
asking?

Can anyone think of a package doing this? (to see the implementation).

Thank you,

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-02-26 Thread Jérémy Lal
Le mer. 26 févr. 2025 à 10:09, lorenzo  a écrit :

> On Wed, 26 Feb 2025 06:37:43 +0100
> Carles Pina i Estany  wrote:
>
> > So I still think that there is room to inform users that a package is
> > systemd ready and the name of the service and I wondered if there is a
> > way to do it.
>
> then you can use the package description to mention that the package
> include a simplemonitor systemd service
>

 And/or explain what needs to be done to work in README.Debian,
which is somewhat missing, btw, in the syncthing package.


Re: How to inform users package is ready to use systemd

2025-02-26 Thread lorenzo
On Wed, 26 Feb 2025 06:37:43 +0100
Carles Pina i Estany  wrote:

> So I still think that there is room to inform users that a package is
> systemd ready and the name of the service and I wondered if there is a
> way to do it.

then you can use the package description to mention that the package
include a simplemonitor systemd service



Re: How to inform users package is ready to use systemd

2025-02-25 Thread Carles Pina i Estany

Hi,

On 25 Feb 2025 at 22:59:20, lorenzo wrote:
> Hi,
> 
> On Tue, 25 Feb 2025 06:57:36 +0100
> Carles Pina i Estany  wrote:
> 
> > Unpacking simplemonitor (1.13.0-1) ...
> > Setting up simplemonitor (1.13.0-1) ...
> > Created symlink
> > '/etc/systemd/system/multi-user.target.wants/simplemonitor.service' →
> > '/usr/lib/systemd/system/simplemonitor.service'. Processing triggers
> > for man-db (2.13.0-1) ... -
> > 
> > When you said "that should be enough.": do you mean that for a user to
> > know that the package is systemd ready this is enough?
> > 
> > Thank you very much,
> 
> Well, I don't use systemd so I'm not able to tell the exact command
> but just looking at the man page I think the user can try
> 
> systemctl list-units simplemonitor
> or
> systemctl status simplemonitor
> or
> systemctl status --all
> 
> in general I think is reasonable to expect that a user that wants to
> play with services is able to use systemctl to search and query a
> service status.

In the case of simplemonitor package: what I'd like to do is inform the
user that simplemonitor is ready to be used using systemctl (not
necessarily how to use systemd). Why I'd like to do that?

-As a user sometimes I wonder if some package are meant to be used from
systemd or not and what would the systemd unit name would be

-I know of some user who installed the package and tried to use it
without systemd integration because they didn't know that it was
possible (but they knew how to use systemd).

Some packages (e.g. syncthing) are using user services (via
/lib/systemd/system/syncthing@.service file) so in that case the user
would need to do "systemctl restart PACKAGE@user). So it would be nice
to tell the user.

Another case: the package name and systemd service name might not align
(openssh-server package, the systemd service is "ssh").
Or bind9 package, and the systemd service might be bind9 or named.

So I still think that there is room to inform users that a package is
systemd ready and the name of the service and I wondered if there is a
way to do it.

> If your package uses dh_installsystemd with default options, the service
> should be unmasked, enabled and started by default at install, so your
> service comes ready for use even without using systemctl..

It works lovely.

Thanks very much!

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-02-25 Thread lorenzo
Hi,

On Tue, 25 Feb 2025 06:57:36 +0100
Carles Pina i Estany  wrote:

> Unpacking simplemonitor (1.13.0-1) ...
> Setting up simplemonitor (1.13.0-1) ...
> Created symlink
> '/etc/systemd/system/multi-user.target.wants/simplemonitor.service' →
> '/usr/lib/systemd/system/simplemonitor.service'. Processing triggers
> for man-db (2.13.0-1) ... -
> 
> When you said "that should be enough.": do you mean that for a user to
> know that the package is systemd ready this is enough?
> 
> Thank you very much,

Well, I don't use systemd so I'm not able to tell the exact command
but just looking at the man page I think the user can try

systemctl list-units simplemonitor
or
systemctl status simplemonitor
or
systemctl status --all

in general I think is reasonable to expect that a user that wants to
play with services is able to use systemctl to search and query a
service status.
If your package uses dh_installsystemd with default options, the service
should be unmasked, enabled and started by default at install, so your
service comes ready for use even without using systemctl..

Best,
Lorenzo



Re: should a service/daemon get automatically started on first installation? (was: Re: How to inform users package is ready to use systemd)

2025-02-25 Thread lorenzo
On Mon, 24 Feb 2025 13:24:29 +0100
Joost van Baal-Ilić  wrote:

> I remember lots of discussion about the question: "should a
> service/daemon get automatically started on first installation?"
> I've just searched in Debian Policy but could not find an answer.  It
> this issue still delegated to the package maintainer?  (And then the
> local admin might express preference via some mechanism, iirc...)

simplifying, dh addons for services (dh_installsystemd,
dh_intallinit ...) enforce a default which seems to be:
unmask + enable + start at package installation; the maintainer can
override defaults; the user can then override wrt mask/unmask +
enable/disable

Lorenzo

> 
> Bye,
> 
> Joost
> 



Re: How to inform users package is ready to use systemd

2025-02-25 Thread Ahmad Khalifa

On 25/02/2025 05:57, Carles Pina i Estany wrote:

My question is: how to inform users about systemd integration?


If you mean command line level, then you're probably patching it to 
check runtime user then exit?


If USER <> service_user:
print "boo, use systemctl instead"
exit 1


--
Regards,
Ahmad



Re: How to inform users package is ready to use systemd

2025-02-24 Thread Carles Pina i Estany

Hi,

On 24 Feb 2025 at 13:37:19, lorenzo wrote:
> Hi,
> 
> On Mon, 24 Feb 2025 11:48:03 +0100
> Carles Pina i Estany  wrote:
> 
> > 
> > Hello,
> > 
> > I've packaged "simplemonitor". The package adds a simplemonitor user,
> > and a systemd service to run simplemonitor under this user and using
> > the configuration files from /etc/simplemonitor
> > 
> > I know that some user did "apt install simplemonitor" and then tried
> > to use simplemonitor without systemd (which is possible, but
> > reinventing the wheel). The user tried it that because he didn't
> > realise that simplemonitor was integrated with systemd, the
> > simplemonitor system user, checks on startup, etc.
> > 
> > My question is: how to inform users about systemd integration?
> 
> If your package uses dh_installsystemd to integrate with systemd, that
> should be enough.

Yes, the package uses dh_installsystemd (thanks to having
debian/simplemonitor.service). No extra configuration.

Installing simplemonitor via "apt", I see at the end:

-
Unpacking simplemonitor (1.13.0-1) ...
Setting up simplemonitor (1.13.0-1) ...
Created symlink 
'/etc/systemd/system/multi-user.target.wants/simplemonitor.service' → 
'/usr/lib/systemd/system/simplemonitor.service'.
Processing triggers for man-db (2.13.0-1) ...
-

When you said "that should be enough.": do you mean that for a user to
know that the package is systemd ready this is enough?

Thank you very much,

-- 
Carles Pina i Estany
https://carles.pina.cat | car...@pina.cat | cp...@debian.org


signature.asc
Description: PGP signature


Re: How to inform users package is ready to use systemd

2025-02-24 Thread lorenzo
Hi,

On Mon, 24 Feb 2025 11:48:03 +0100
Carles Pina i Estany  wrote:

> 
> Hello,
> 
> I've packaged "simplemonitor". The package adds a simplemonitor user,
> and a systemd service to run simplemonitor under this user and using
> the configuration files from /etc/simplemonitor
> 
> I know that some user did "apt install simplemonitor" and then tried
> to use simplemonitor without systemd (which is possible, but
> reinventing the wheel). The user tried it that because he didn't
> realise that simplemonitor was integrated with systemd, the
> simplemonitor system user, checks on startup, etc.
> 
> My question is: how to inform users about systemd integration?

If your package uses dh_installsystemd to integrate with systemd, that
should be enough.

Lorenzo

> 
> As a user, what I do when I wonder about that is "dpkg -L PACKAGE"
> and see if I spot some systemd service files. And also tend to read
> /usr/share/doc/PACKAGE/changelog.Debian.gz or related files to see if
> the maintainer wrote any information there.
> 
> To be more proactive about that, I thought to add a debconf template
> with something such as (untested, just the idea):
> 
> 
> Template: simplemonitor/systemd-info
> Type: note
> _Description: Usage of simplemonitor
>  The simplemonitor package integrates with systemd. Set it up in
>  /etc/simplemonitor and then use:
> 
> sudo systemctl restart simplemonitor
> 
> 
> But I wonder of any more standard ways to do that, what other packages
> do, etc.
> 
> Thanks very much!
> 



should a service/daemon get automatically started on first installation? (was: Re: How to inform users package is ready to use systemd)

2025-02-24 Thread Joost van Baal-Ilić
On Mon, Feb 24, 2025 at 11:48:03AM +0100, Carles Pina i Estany wrote:
> 
> Hello,
> 
> I've packaged "simplemonitor".

> 
> Template: simplemonitor/systemd-info
> Type: note
> _Description: Usage of simplemonitor
>  The simplemonitor package integrates with systemd. Set it up in
>  /etc/simplemonitor and then use:
> 
> sudo systemctl restart simplemonitor
> 
> 
> But I wonder of any more standard ways to do that, what other packages
> do, etc.

I remember lots of discussion about the question: "should a service/daemon get
automatically started on first installation?"  I've just searched in Debian
Policy but could not find an answer.  It this issue still delegated to the
package maintainer?  (And then the local admin might express preference via
some mechanism, iirc...)

Bye,

Joost

-- 
“To succeed in the world it is not enough to be stupid,
you must also be well-mannered.”  —Voltaire



Re: How to inform users package is ready to use systemd

2025-02-24 Thread Andrey Rakhmatullin
On Mon, Feb 24, 2025 at 11:48:03AM +0100, Carles Pina i Estany wrote:
> I've packaged "simplemonitor". The package adds a simplemonitor user,
> and a systemd service to run simplemonitor under this user and using the
> configuration files from /etc/simplemonitor
> 
> I know that some user did "apt install simplemonitor" and then tried to
> use simplemonitor without systemd (which is possible, but reinventing
> the wheel). The user tried it that because he didn't realise that
> simplemonitor was integrated with systemd, the simplemonitor system
> user, checks on startup, etc.
> 
> My question is: how to inform users about systemd integration?

NEWS.Debian or nothing.

> But I wonder of any more standard ways to do that, what other packages
> do, etc.

The standard way is to not notify about any non-critical changes.


-- 
WBR, wRAR


signature.asc
Description: PGP signature