Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-31 Thread Lennart Poettering
On Sat, 04.03.17 22:07, Andrei Borzenkov (arvidj...@gmail.com) wrote:

> 04.03.2017 13:49, Peter Hoeg пишет:
> > Hi,
> > 
> >> If I have a user service which needs to have the system database server
> >> available: How do I construct a proper depend?
> > 
> > As Lennart was pointing out, the user and system instances do not know
> > anything about each other, so you cannot.
> > 
> 
> "You cannot because it is currently unimplemented", "you cannot because
> we do not care but feel free to implement" or "you cannot because we
> will never even consider it"?

Quite frankly, I pretty much opposed to adding that...

Socket activation (as suggested) is the much simplre and more robust
way, since it makes it unnecessary to define explicit deps altogether.

> This means you need to set absurdly large TimeoutStart because you have
> no idea when other service appears, so every time you attempt to start
> service you will need to wait absurdly large time before proceeding with
> error handling. Proper service dependency won't even attempt to start
> dependent service until dependencies are known to run.

This is a misunderstanding how socket activation works.

> systemd already propagates some unit types (devices, mounts and swaps)
> from system to user instance. Are there any fundamental problems that
> prevent doing it for other types?

That's not really the case. All systemd instances track the kernel
state, that's all. The user instance of systemd does not communicate
with the system instance at all really, and I kinda like that.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-06 Thread Kai Krakow
Am Sat, 4 Mar 2017 22:07:57 +0300
schrieb Andrei Borzenkov :

> 04.03.2017 13:49, Peter Hoeg пишет:
> > Hi,
> >   
> >> If I have a user service which needs to have the system database
> >> server available: How do I construct a proper depend?  
> > 
> > As Lennart was pointing out, the user and system instances do not
> > know anything about each other, so you cannot.
> >   
> 
> "You cannot because it is currently unimplemented", "you cannot
> because we do not care but feel free to implement" or "you cannot
> because we will never even consider it"?
> 
> > The 2 other options I can think of:
> > 
> > a) Run a system service specifying your user id in User=
> >   
> 
> The problem has nothing to do with ownership so it won't help.

I'm running it in the user context for different reasons. I don't think
that setting the UID is the same. Additionally, I want users to be able
to restart their services during deployments.

> > b) Enable socket activation (if possible) on the system instance
> > database. That way your user instance will simply wait on the socket
> > until the server comes up.
> >   
> 
> This means you need to set absurdly large TimeoutStart because you
> have no idea when other service appears, so every time you attempt to
> start service you will need to wait absurdly large time before
> proceeding with error handling. Proper service dependency won't even
> attempt to start dependent service until dependencies are known to
> run.

Yes, and setting such TimeoutStart values is not meant to be the fix,
I'm sure. The database service here takes 2-3 minutes to fully start
and be ready. This is due to high IO load during startup but also due
to fully checking the database from the service ExecPost.

> systemd already propagates some unit types (devices, mounts and swaps)
> from system to user instance. Are there any fundamental problems that
> prevent doing it for other types?

I'd imagine something like Requires=system/mysqld.service to prefix the
dependency to the system instance.


-- 
Regards,
Kai

Replies to list-only preferred.


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-04 Thread Andrei Borzenkov
04.03.2017 13:49, Peter Hoeg пишет:
> Hi,
> 
>> If I have a user service which needs to have the system database server
>> available: How do I construct a proper depend?
> 
> As Lennart was pointing out, the user and system instances do not know
> anything about each other, so you cannot.
> 

"You cannot because it is currently unimplemented", "you cannot because
we do not care but feel free to implement" or "you cannot because we
will never even consider it"?

> The 2 other options I can think of:
> 
> a) Run a system service specifying your user id in User=
> 

The problem has nothing to do with ownership so it won't help.

> b) Enable socket activation (if possible) on the system instance
> database. That way your user instance will simply wait on the socket
> until the server comes up.
> 

This means you need to set absurdly large TimeoutStart because you have
no idea when other service appears, so every time you attempt to start
service you will need to wait absurdly large time before proceeding with
error handling. Proper service dependency won't even attempt to start
dependent service until dependencies are known to run.

systemd already propagates some unit types (devices, mounts and swaps)
from system to user instance. Are there any fundamental problems that
prevent doing it for other types?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-04 Thread Peter Hoeg

Hi,


If I have a user service which needs to have the system database server
available: How do I construct a proper depend?


As Lennart was pointing out, the user and system instances do not know
anything about each other, so you cannot.

The 2 other options I can think of:

a) Run a system service specifying your user id in User=

b) Enable socket activation (if possible) on the system instance
database. That way your user instance will simply wait on the socket
until the server comes up.

--
Regards,
Peter
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-03 Thread Kai Krakow
Am Sun, 26 Feb 2017 21:35:27 +0100
schrieb Lennart Poettering :

> On Sat, 25.02.17 17:34, Patrick Schleizer
> (patrick-mailingli...@whonix.org) wrote:
> 
> > Hi,
> > 
> > I read, that a systemd --user instance cannot use Requires=.
> > 
> > But what about After=? Can a systemd --user instance use
> > After=some-system.service?  
> 
> The units of the --user instance live in an entirely disjunct
> namespace from those in the --system instance. Hence yes, you can
> absolutely use After= and/or Requires= between two user services, but
> it will always just be between two *user* services, and never between
> a user and a system service, since the unit state engines of the
> system and user instance are completely disconnected, as said.

Which brings me back to something I wondered about:

If I have a user service which needs to have the system database server
available: How do I construct a proper depend?

Currently, my user services time out during boot because the database
server is simply not ready fast enough. Thus I'd like to trigger
starting those services only after the database server is ready.

Even putting "Requires" and "After" into the user@ template doesn't
seem to respect this... (or I'm missing some secondary dependency)

My next attempt would be to fire up user sessions with a timer only
after a certain time has passed after boot. But that doesn't feel
right...

-- 
Regards,
Kai

Replies to list-only preferred.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-02-26 Thread Lennart Poettering
On Sat, 25.02.17 17:34, Patrick Schleizer (patrick-mailingli...@whonix.org) 
wrote:

> Hi,
> 
> I read, that a systemd --user instance cannot use Requires=.
> 
> But what about After=? Can a systemd --user instance use
> After=some-system.service?

The units of the --user instance live in an entirely disjunct
namespace from those in the --system instance. Hence yes, you can
absolutely use After= and/or Requires= between two user services, but
it will always just be between two *user* services, and never between
a user and a system service, since the unit state engines of the
system and user instance are completely disconnected, as said.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-02-25 Thread killermoehre
Am 25.02.2017 um 18:34 schrieb Patrick Schleizer:
> Hi,
>
> I read, that a systemd --user instance cannot use Requires=.
>
> But what about After=? Can a systemd --user instance use
> After=some-system.service?
>
> Cheers,
> Patrick
Hi Patrick,

no, --user instances know nothing about the --system instance and vice versa.
But internally, --user instances are full featured so you can have any 
dependency among your user units.

BR
Silvio



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel