[systemd-devel] Xorg or Wayland Environment

2021-09-18 Thread Ed Greshko

Not a everyday systemd service writer

I've written a user service file to start an app on login.  It works well for 
Xorg with Environment=DISPLAY=:0.

But I've found that under Wayland the DISPLAY=:1 after a logout of Xorg and 
login to a
Wayland session.

What would be the proper way to get the DISPLAY environment varible use it as 
opposed
to "hard" coding it?


Re: [systemd-devel] Examples to distinguish Before=/After= and Wants=/Requires=/BindsTo=

2021-09-18 Thread Lennart Poettering
On Fr, 17.09.21 19:04, Kenneth Porter (sh...@sewingwitch.com) wrote:
65;6402;1c
> --On Friday, September 17, 2021 12:49 PM +0200 Lennart Poettering
>  wrote:
>
> > more specific example: you can use apache without mysql, and you can
> > use mysql without apache, but quite often they are used together, and
> > if so you likely want to start mysql first, and apache second, since
> > it likely consumes services of mysql, and not the other way
> > round. Hence in this example, you'd place an ordering dep, but not
> > requirement dep.
>
> Would such an ordering dependency without a requirements dependency allow
> apache to start without mysql?

Yes.

> Or does an ordering dependency imply a
> requirements dependency?

No.

> In which case, could systemd automatically infer
> the requirements from the ordering?

No.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] when mount is delayed - start unit which depends on it - ?

2021-09-18 Thread Mantas Mikulėnas
On Fri, Sep 17, 2021 at 2:40 PM lejeczek  wrote:

> Hi guys.
>
> I'm trying to have unit to start...
> well,
> I have a luks device which waits for manual passphrase
> input, when that happens 'systemd' mounts, without user
> intervention(which is great), that luks device.
> fstab:
> /dev/mapper/luks.devs /devs   ext4
> noatime,nobarrier,noatime,x-systemd.device-timeout=2,nofail 1 2
> and now I'll have many units/services which depend on that
> mount, because they need to get to paths to get their
> configs & other bits.
>
> Question - how do I make such a unit to re/start when
> 'systemd' does the mount? Naturally, ideally without any
> ways external to 'systemd'.
>

If units need this mount, then *actually* make them depend on this mount –
as in, "Requires=devs.mount" and "After=devs.mount" in each service's
[Unit].

-- 
Mantas Mikulėnas


Re: [systemd-devel] masking --global, but allowing --user

2021-09-18 Thread Arseny Maslennikov
On Fri, Sep 17, 2021 at 07:02:14PM -0500, Matt Zagrabelny wrote:
> Greetings,
> 
> I believe the Debian package of mpd enables a --global .service and
> .socket unit for the mpd daemon/service.
> 
> I'd like to mask that and install it just to a single --user service.
> 
> I've tried that:
> 
> sudo systemctl --global mask mpd.service
> sudo systemctl --global mask mpd.socket
> 
> and then:
> 
> systemctl --user enable mpd
> Failed to enable unit: Unit file /etc/xdg/systemd/user/mpd.service is
> masked.
> The reason I do not like the --global version is due to logging in on
> a virtual console as root and then mpd starting up and causing issues
> with the preferred service running under my main user account.
> 
> Any idea how to solve my problem?

PipeWire and PulseAudio use the following guard on both the socket and
the service:

[Unit]
ConditionUser=!root

This snippet can be put in a override file for mpd's unit either by
hand, or by means of "systemctl --global edit".

It might make sense to suggest this upstream.

> Thanks for any help!
> 
> -m


signature.asc
Description: PGP signature