[systemd-devel] cannot unsubscribe from this list

2019-10-15 Thread Brian Reichert
I initiated an unsubscribe from this web page:

  https://lists.freedesktop.org/mailman/options/systemd-devel

That created a confirmation email, that I replied to.

That yielded this bounce message:

  :
   131.252.210.177 does not like recipient.
  Remote host said: 550 5.1.1 :
  Recipient address rejected: User unknown in local recipient table
  Giving up on 131.252.210.177.

What steps should I be taking?

-- 
Brian Reichert  
BSD admin/developer at large
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Mutually exclusive (timer-triggered) services

2019-10-15 Thread Alexander Koch

* flock leaves the lock file behind so you'd need some type of
cleanup in case you really want the jobs to be trace-free. This is
not as trivial is it might seem, e.g. you cannot do it from the
service units themselves in `ExecStartPost=` or similar.

An

ExecStartPost=-/usr/bin/flock -F /path/to/lock.file \
  /usr/bin/rm /path/to/lock.file

should solve this issue.


So you can remove a file other processes are blocked lock-waiting on? 
Didn't

expect this to work, thanks for the hint.


If your units are actually dependent on each other, than maybe you
should think about your approach in general. But to be able to help you
with that we need more information about the actual dependencies of the
applications started by your units and at which interval they shall
run.


Okay I guess I should come up with the actual scenario, here we go:

On my Arch Linux workstation I've got three .timer triggered .service 
units
that do package manager housekeeping (I don't know if you're familiar 
with

Arch/Pacman so I'll annotate their purposes):

1) Synchronize package database (equivalent of `apt-get update` on 
Debian)


[Timer]
OnCalendar=8-17/2:00
Persistent=true

[Service]
ExecStart=/usr/bin/pacman -Syq

2) Update file database (equivalent of `apt-file update`)

[Timer]
OnCalendar=weekly
Persistent=true

[Service]
ExecStart=/usr/bin/pacman -Fyq

3) Purge old packages from cache (something like `apt-get autoclean`)

[Timer]
OnCalendar=daily
Persistent=true

[Service]
ExecStart=/bin/sh -c 'paccache -r -k 2; paccache -r -k 0 -u'

As you can see, I'd like to have different execution intervals for all 
of
these tasks so I'd like to keep them as separate services (which also 
seems

the intuitive approach to me).

I must admit that I haven't tried, but I'm pretty sure that at least 1 
and
2 do lock the ALPM database so if you try to issue one of these Pacman 
calls
while the other is running it will fail, complaining about a lock file 
being

present.

My current workaround for this is using `RandomizedDelaySec=15m` in
conjunction with `AccuracySec=1` in the .timer units to spread the 
triggers.


While this does work I'm really curious about the 'proper' way of 
modeling
this. Is it such an academic problem to have the need of ensuring that 
two

timers (or services) don't fire simultaneously? I had thought this to be
really simple with such an elaborate service manager like systemd, with 
all

its graph theory power and the-like.

(If I were a heretic I'd say 'We can do DNS, DHCP and NTP with systemd
without any third party software but we need additional utilities to 
ensure

that two things don't happen at the same time??' ;) )

I think there are plenty of other scenarios, e.g. ideally I'd like my 
backup
service not to kick in while btrfs-scrub@home.service is running... or 
maybe

it's just me seeing this need ;)


Best regards,

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

Re: [systemd-devel] how to debug kernel panic which generated by udevadm at systemd?

2019-10-15 Thread Mantas Mikulėnas
On Tue, Oct 15, 2019 at 3:02 PM www  wrote:

> Dear all,
>
> I add a new driver to kernel, and it probe success. When enter into
> systemd, the udevadm generate a kernel panic.
> I want to ask how to debug it and find out where the error occurred? When
> did udevadm load? What commands are used by udevadm, and what are the
> specific operations?
>

There aren't many udevadm calls in systemd... The main one is
systemd-udev-trigger.service, which calls `udevadm trigger
--type=subsystems --action=add`, then repeats the same for type=devices. It
tries to generate coldplug uevents by writing 'add' to each found device's
/sys/.../uevent file.

(The second is systemd-udev-settle.service, but it is disabled by default
on most systems and just waits for udev's job queue to empty.)

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

Re: [systemd-devel] How to control the login prompt from my application service unit file?

2019-10-15 Thread Colin Guthrie
Moji, Shashidhar wrote on 15/10/2019 05:15:
> Hi,
> 
> We have VMware vApp based solution. Our application gets installed
> during first boot.
> 
> Till now we had SLES11 OS based VM and we upgraded to SLES12. Now we
> have systemd instead of init scripts for service handling.
> 
> In SLES11, we had service dependency configured in init scripts that was
> holding back the login prompt until our application installation is
> done. But in SLES12, we get the login prompt before our application is
> installed.
> 
>  
> 
> How to hold the login prompt until our application installation is
> complete? We tried adding /Before=getty@.service/  in our application
> install unit file, but its not helping.
> 
>  
> 
> ~
> 
> [Unit]
> 
> Description=ADG runonce apg_install
> 
> DefaultDependencies=no
> 
> After=local-fs.target network-online.target
> 
> Before=getty@.service
> 
> Wants=network-online.target
> 
> Wants=network-onine.target
> 
>  
> 
> [Service]
> 
> Type=forking
> 
> ExecStartPre=/bin/touch /etc/no-login-console
> 
> ExecStart=/bin/sh -c "/opt/ADG/runonce/scripts/apg_install"
> 
> ExecStartPost=/opt/ADG/runonce/bin/runonce removeflag apg_install
> 
> ExecStartPost=/bin/rm /etc/no-login-console
> 
> KillMode=process
> 
> Restart=no
> 

Just as a slightly different approach, you may want to consider using
pam_nologin instead.

Systemd does it itself (it creates a /run/nologin files using
/usr/lib/tmpfiles.d/systemd-nologin.conf) which prevents login by anyone
other than root.

Systemd user sessions daemon removes the /run/nologin file but I presume
it would be possible to create your own /run/apgnologin file and
configure pam with file=/run/apgnologin file in addition to the default.

You could then create this file with tmpfiles (as systemd does with it's
file) and then remove it with your service.

This doesn't prevent the getty from appearing (and the root user can
still login) but if any user tries to login, the contents of the file
can explain to the user why they cannot login (rather than them just
sitting there with a delay).

Just a thought about an alternative approach that you may want to explore.

Col





-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Antw: how to debug kernel panic which generated by udevadm at systemd?

2019-10-15 Thread www
Dear Ulrich,


Thanks for your suggest. I have added some debug info, but not display. I will 
add more.
I want ask a question, What commands does udevadm in systemd execute and what 
functions are corresponding to the driver?


thanks,
Byron








At 2019-10-15 20:36:41, "Ulrich Windl"  
wrote:
>Hi!
>
>I think your driver loads OK, but it is not working correctly. Maybe enable
>kernel debug messages and add debug prints to your driver, especially regarding
>any queries. I suspect some NULL pointer or empty string being returned.
>
>Regards,
>Ulrich
>
 www  schrieb am 15.10.2019 um 13:46 in Nachricht
><252176e7.9975.16dcf3de51e.coremail.ouyangxua...@163.com>:
>> Dear all,
>> 
>> 
>> I add a new driver to kernel, and it probe success. When enter into systemd,
>
>> the udevadm generate a kernel panic.
>> I want to ask how to debug it and find out where the error occurred? When 
>> did udevadm load? What commands are used by udevadm, and what are the 
>> specific operations?
>> 
>> 
>> [3.291819] pmbus 13-0058: PMBus status register not found
>> [3.297940] pmbus 13-0059: PMBus status register not found
>> [3.305830] usbcore: registered new interface driver usbhid
>> [3.311417] usbhid: USB HID core driver
>> [3.326527] aspeed_jtag: driver successfully loaded.-->  
> 
>> load the driver success
>> [3.335427] NET: Registered protocol family 10
>> [3.345639] Segment Routing with IPv6
>> [3.349995] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
>> [3.357507] NET: Registered protocol family 17
>> [3.362012] 8021q: 802.1Q VLAN Support v1.8
>> [3.379650] printk: console [netcon0] enabled
>> [3.384027] netconsole: network logging started
>> [3.390140] input: gpio-keys as /devices/platform/gpio-keys/input/input0
>> [3.398913] hctosys: unable to open rtc device (rtc0)
>> [3.411203] Freeing unused kernel memory: 1024K
>> [3.419068] Checked W+X mappings: passed, no W+X pages found
>> [3.424841] Run /init as init process
>> rofs = mtd4 squashfs rwfs = mtd5 jffs2
>> [4.392201] jffs2: notice: (681) jffs2_build_xattr_subsystem: complete 
>> building xattr subsystem, 8 of xdatum (0 unchecked, 1 orphan) and 11 of xref
>
>> (1 dead, 0 orphan) found.
>> [4.448757] overlayfs: upper fs does not support tmpfile.
>> [6.760748] systemd[1]: System time before build time, advancing clock.
>> [6.893492] systemd[1]: systemd 242-19-gdb2e367+ running in system mode.
>
>> (+PAM -AUDIT -SELINUX -IMA -APPARMOR -SMACK +SYSVINIT -UTMP -LIBCRYPTSETUP 
>> -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS -KMOD -IDN2 -IDN 
>> -PCRE2 default-hierarchy=hybrid)
>> [6.917878] systemd[1]: Detected architecture arm.
>> 
>> 
>> Welcome to Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 
>> 2.7.0-dev!
>> 
>> 
>> [7.033813] systemd[1]: Set hostname to .
>> [7.769096] systemd[1]: File 
>> /lib/systemd/system/systemd-journald.service:12 configures an IP firewall 
>> (IPAddressDeny=any), but the local system does not support BPF/cgroup based
>
>> firewalling.
>> [7.786341] systemd[1]: Proceeding WITHOUT firewalling in effect! (This 
>> warning is only shown for the first loaded unit using IP firewalling.)
>> [8.942114] systemd[1]: /lib/systemd/system/phosphor-ipmi-net@.socket:3:
>
>> Invalid interface name, ignoring: sys-subsystem-net-devices-%i.device
>> [8.982380] systemd[1]: /lib/systemd/system/dbus.socket:4: ListenStream=
>
>> references a path below legacy directory /var/run/, updating 
>> /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please 
>> update the unit file accordingly.
>> [9.66] systemd[1]: Reached target Fans Ready.
>> [  OK  ] Reached target Fans Ready.
>> [9.148717] systemd[1]: Created slice 
>> system-phosphor\x2dipmi\x2dkcs.slice.
>> [  OK  ] Created slice system-phosphor\x2dipmi\x2dkcs.slice.
>> [9.199247] systemd[1]: Listening on udev Kernel Socket.
>> [  OK  ] Listening on udev Kernel Socket.
>> [  OK  ] Reached target Slices.
>> [  OK  ] Created slice system-phosphor\x2dipmi\x2dnet.slice.
>> [  OK  ] Reached target Remote File Systems.
>> [  OK  ] Created slice system-mapper\x2dwait.slice.
>> [  OK  ] Started Forward Password Râ€|uests to Wall Directory Watch.
>> [  OK  ] Created slice system-phosphor\x2dgpio\x2dmonitor.slice.
>> [  OK  ] Listening on Journal Socket.
>>  Mounting Kernel Configuration File System...
>> [  OK  ] Started Dispatch Password â€|ts to Console Directory Watch.
>> [  OK  ] Reached target Paths.
>> [  OK  ] Created slice system-phospâ€|dcertificate\x2dmanager.slice.
>> [  OK  ] Listening on initctl Compatibility Named Pipe.
>>  Mounting Kernel Debug File System...
>> [  OK  ] Created slice system-obmc\x2dled\x2dgroup\x2dstart.slice.
>> [  OK  ] Reached target Swap.
>>  Mounting Temporary Directory (/tmp)...
>> [  OK  ] Listening on Network Service Netlink Socket.
>> [  OK  ] Started Hardware RNG Entropy 

[systemd-devel] Antw: how to debug kernel panic which generated by udevadm at systemd?

2019-10-15 Thread Ulrich Windl
Hi!

I think your driver loads OK, but it is not working correctly. Maybe enable
kernel debug messages and add debug prints to your driver, especially regarding
any queries. I suspect some NULL pointer or empty string being returned.

Regards,
Ulrich

>>> www  schrieb am 15.10.2019 um 13:46 in Nachricht
<252176e7.9975.16dcf3de51e.coremail.ouyangxua...@163.com>:
> Dear all,
> 
> 
> I add a new driver to kernel, and it probe success. When enter into systemd,

> the udevadm generate a kernel panic.
> I want to ask how to debug it and find out where the error occurred? When 
> did udevadm load? What commands are used by udevadm, and what are the 
> specific operations?
> 
> 
> [3.291819] pmbus 13-0058: PMBus status register not found
> [3.297940] pmbus 13-0059: PMBus status register not found
> [3.305830] usbcore: registered new interface driver usbhid
> [3.311417] usbhid: USB HID core driver
> [3.326527] aspeed_jtag: driver successfully loaded.-->  
 
> load the driver success
> [3.335427] NET: Registered protocol family 10
> [3.345639] Segment Routing with IPv6
> [3.349995] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> [3.357507] NET: Registered protocol family 17
> [3.362012] 8021q: 802.1Q VLAN Support v1.8
> [3.379650] printk: console [netcon0] enabled
> [3.384027] netconsole: network logging started
> [3.390140] input: gpio-keys as /devices/platform/gpio-keys/input/input0
> [3.398913] hctosys: unable to open rtc device (rtc0)
> [3.411203] Freeing unused kernel memory: 1024K
> [3.419068] Checked W+X mappings: passed, no W+X pages found
> [3.424841] Run /init as init process
> rofs = mtd4 squashfs rwfs = mtd5 jffs2
> [4.392201] jffs2: notice: (681) jffs2_build_xattr_subsystem: complete 
> building xattr subsystem, 8 of xdatum (0 unchecked, 1 orphan) and 11 of xref

> (1 dead, 0 orphan) found.
> [4.448757] overlayfs: upper fs does not support tmpfile.
> [6.760748] systemd[1]: System time before build time, advancing clock.
> [6.893492] systemd[1]: systemd 242-19-gdb2e367+ running in system mode.

> (+PAM -AUDIT -SELINUX -IMA -APPARMOR -SMACK +SYSVINIT -UTMP -LIBCRYPTSETUP 
> -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS -KMOD -IDN2 -IDN 
> -PCRE2 default-hierarchy=hybrid)
> [6.917878] systemd[1]: Detected architecture arm.
> 
> 
> Welcome to Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 
> 2.7.0-dev!
> 
> 
> [7.033813] systemd[1]: Set hostname to .
> [7.769096] systemd[1]: File 
> /lib/systemd/system/systemd-journald.service:12 configures an IP firewall 
> (IPAddressDeny=any), but the local system does not support BPF/cgroup based

> firewalling.
> [7.786341] systemd[1]: Proceeding WITHOUT firewalling in effect! (This 
> warning is only shown for the first loaded unit using IP firewalling.)
> [8.942114] systemd[1]: /lib/systemd/system/phosphor-ipmi-net@.socket:3:

> Invalid interface name, ignoring: sys-subsystem-net-devices-%i.device
> [8.982380] systemd[1]: /lib/systemd/system/dbus.socket:4: ListenStream=

> references a path below legacy directory /var/run/, updating 
> /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please 
> update the unit file accordingly.
> [9.66] systemd[1]: Reached target Fans Ready.
> [  OK  ] Reached target Fans Ready.
> [9.148717] systemd[1]: Created slice 
> system-phosphor\x2dipmi\x2dkcs.slice.
> [  OK  ] Created slice system-phosphor\x2dipmi\x2dkcs.slice.
> [9.199247] systemd[1]: Listening on udev Kernel Socket.
> [  OK  ] Listening on udev Kernel Socket.
> [  OK  ] Reached target Slices.
> [  OK  ] Created slice system-phosphor\x2dipmi\x2dnet.slice.
> [  OK  ] Reached target Remote File Systems.
> [  OK  ] Created slice system-mapper\x2dwait.slice.
> [  OK  ] Started Forward Password Râ€|uests to Wall Directory Watch.
> [  OK  ] Created slice system-phosphor\x2dgpio\x2dmonitor.slice.
> [  OK  ] Listening on Journal Socket.
>  Mounting Kernel Configuration File System...
> [  OK  ] Started Dispatch Password â€|ts to Console Directory Watch.
> [  OK  ] Reached target Paths.
> [  OK  ] Created slice system-phospâ€|dcertificate\x2dmanager.slice.
> [  OK  ] Listening on initctl Compatibility Named Pipe.
>  Mounting Kernel Debug File System...
> [  OK  ] Created slice system-obmc\x2dled\x2dgroup\x2dstart.slice.
> [  OK  ] Reached target Swap.
>  Mounting Temporary Directory (/tmp)...
> [  OK  ] Listening on Network Service Netlink Socket.
> [  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
> [  OK  ] Created slice system-getty.slice.
> [  OK  ] Listening on udev Control Socket.
>  Starting udev Coldplug all Devices...
> [  OK  ] Listening on Syslog Socket.
> [  OK  ] Created slice system-obmc\x2dconsole.slice.
> [  OK  ] Created slice system-serial\x2dgetty.slice.
> [  OK  ] Created slice system-obmc\x2dread\x2deeprom.slice.
>  Starting Apply Kernel 

[systemd-devel] how to debug kernel panic which generated by udevadm at systemd?

2019-10-15 Thread www
Dear all,


I add a new driver to kernel, and it probe success. When enter into systemd, 
the udevadm generate a kernel panic.
I want to ask how to debug it and find out where the error occurred? When did 
udevadm load? What commands are used by udevadm, and what are the specific 
operations?


[3.291819] pmbus 13-0058: PMBus status register not found
[3.297940] pmbus 13-0059: PMBus status register not found
[3.305830] usbcore: registered new interface driver usbhid
[3.311417] usbhid: USB HID core driver
[3.326527] aspeed_jtag: driver successfully loaded.-->
load the driver success
[3.335427] NET: Registered protocol family 10
[3.345639] Segment Routing with IPv6
[3.349995] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[3.357507] NET: Registered protocol family 17
[3.362012] 8021q: 802.1Q VLAN Support v1.8
[3.379650] printk: console [netcon0] enabled
[3.384027] netconsole: network logging started
[3.390140] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[3.398913] hctosys: unable to open rtc device (rtc0)
[3.411203] Freeing unused kernel memory: 1024K
[3.419068] Checked W+X mappings: passed, no W+X pages found
[3.424841] Run /init as init process
rofs = mtd4 squashfs rwfs = mtd5 jffs2
[4.392201] jffs2: notice: (681) jffs2_build_xattr_subsystem: complete 
building xattr subsystem, 8 of xdatum (0 unchecked, 1 orphan) and 11 of xref (1 
dead, 0 orphan) found.
[4.448757] overlayfs: upper fs does not support tmpfile.
[6.760748] systemd[1]: System time before build time, advancing clock.
[6.893492] systemd[1]: systemd 242-19-gdb2e367+ running in system mode. 
(+PAM -AUDIT -SELINUX -IMA -APPARMOR -SMACK +SYSVINIT -UTMP -LIBCRYPTSETUP 
-GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS -KMOD -IDN2 -IDN -PCRE2 
default-hierarchy=hybrid)
[6.917878] systemd[1]: Detected architecture arm.


Welcome to Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 
2.7.0-dev!


[7.033813] systemd[1]: Set hostname to .
[7.769096] systemd[1]: File /lib/systemd/system/systemd-journald.service:12 
configures an IP firewall (IPAddressDeny=any), but the local system does not 
support BPF/cgroup based firewalling.
[7.786341] systemd[1]: Proceeding WITHOUT firewalling in effect! (This 
warning is only shown for the first loaded unit using IP firewalling.)
[8.942114] systemd[1]: /lib/systemd/system/phosphor-ipmi-net@.socket:3: 
Invalid interface name, ignoring: sys-subsystem-net-devices-%i.device
[8.982380] systemd[1]: /lib/systemd/system/dbus.socket:4: ListenStream= 
references a path below legacy directory /var/run/, updating 
/var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update 
the unit file accordingly.
[9.66] systemd[1]: Reached target Fans Ready.
[  OK  ] Reached target Fans Ready.
[9.148717] systemd[1]: Created slice system-phosphor\x2dipmi\x2dkcs.slice.
[  OK  ] Created slice system-phosphor\x2dipmi\x2dkcs.slice.
[9.199247] systemd[1]: Listening on udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Reached target Slices.
[  OK  ] Created slice system-phosphor\x2dipmi\x2dnet.slice.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Created slice system-mapper\x2dwait.slice.
[  OK  ] Started Forward Password R…uests to Wall Directory Watch.
[  OK  ] Created slice system-phosphor\x2dgpio\x2dmonitor.slice.
[  OK  ] Listening on Journal Socket.
 Mounting Kernel Configuration File System...
[  OK  ] Started Dispatch Password …ts to Console Directory Watch.
[  OK  ] Reached target Paths.
[  OK  ] Created slice system-phosp…dcertificate\x2dmanager.slice.
[  OK  ] Listening on initctl Compatibility Named Pipe.
 Mounting Kernel Debug File System...
[  OK  ] Created slice system-obmc\x2dled\x2dgroup\x2dstart.slice.
[  OK  ] Reached target Swap.
 Mounting Temporary Directory (/tmp)...
[  OK  ] Listening on Network Service Netlink Socket.
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Listening on udev Control Socket.
 Starting udev Coldplug all Devices...
[  OK  ] Listening on Syslog Socket.
[  OK  ] Created slice system-obmc\x2dconsole.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-obmc\x2dread\x2deeprom.slice.
 Starting Apply Kernel Variables...
 Starting Remount Root and Kernel File Systems...
[  OK  ] Started Set initial fan speed when BMC starts..
[  OK  ] Listening on Journal Socket (/dev/log).
 Starting Journal Service...
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Mounted Kernel Debug File System.
[  OK  ] Mounted Temporary Directory (/tmp).
[  OK  ] Started Remount Root and Kernel File Systems.
 Starting Rebuild Hardware Database...
 Starting Create System Users...
[  OK  ] Started Apply Kernel Variables.
[  OK  ] 

Re: [systemd-devel] Mutually exclusive (timer-triggered) services

2019-10-15 Thread Silvio Knizek
Am Montag, den 14.10.2019, 18:30 +0200 schrieb Alexander Koch:
> > exactly for this you would use a flock(1) in your .service.
>
> Thanks for the hint, didn't have that in mind. So you're suggesting
> something like this?
>
>  # service-a.service
>  # (...)
>  [Service]
>  ExecStart=/usr/bin/flock -F /var/lock/resource.lock
> /usr/bin/service-a
>
>  # service-b.service
>  # (...)
>  [Service]
>  ExecStart=/usr/bin/flock -F /var/lock/resource.lock
> /usr/bin/service-b
>
>
> I see some drawbacks of this approach:
>
> * Wrapping the actual command in an flock call seems pretty ugly in
> my eyes, i.e. looking at the `ExecStart=` lines above I find it very
> hard to see where the former begins, at first glance. This is
> subjective, of course.
You could use something like

ExecStart=/usr/bin/flock -F /path/to/lock.file \
  /your/actual/command --with argument

Should be easier on the eyes.
>
> * flock leaves the lock file behind so you'd need some type of
> cleanup in case you really want the jobs to be trace-free. This is
> not as trivial is it might seem, e.g. you cannot do it from the
> service units themselves in `ExecStartPost=` or similar.
An

ExecStartPost=-/usr/bin/flock -F /path/to/lock.file \
  /usr/bin/rm /path/to/lock.file

should solve this issue.
>
> * /var/lock is very likely not user-writable so you'd need a
> different lock file directory for user services. You could of course
> use /tmp for that.
For this I would suggest StateDirectory=. See man:systemd.exec for more
information
>
> * File-based locking makes it impossible to use private filesystem
> namespaces for the service units (think of `PrivateTmp=yes` and lock
> files in /tmp).
If a StateDirectory= is used than only the access rights are important.
>
>
> As systemd (or service managers in general) are all about queueing,
> ordering and controlling services and their dependencies I had hoped
> there would be a cleaner solution using systemd internals rather than
> solving it using external tools, which mixes up the service call
> itself with its requirements (exclusive resource access).
>
> Nevertheless I think I will go with your proposal and see how it
> works out.
If your units are actually dependent on each other, than maybe you
should think about your approach in general. But to be able to help you
with that we need more information about the actual dependencies of the
applications started by your units and at which interval they shall
run.
>
>
> Best regards,
>
> Alex
BR
Silvio

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

Re: [systemd-devel] How to control the login prompt from my application service unit file?

2019-10-15 Thread Reindl Harald


Am 15.10.19 um 06:15 schrieb Moji, Shashidhar:
> We have VMware vApp based solution. Our application gets installed
> during first boot.
> 
> Till now we had SLES11 OS based VM and we upgraded to SLES12. Now we
> have systemd instead of init scripts for service handling.
> 
> In SLES11, we had service dependency configured in init scripts that was
> holding back the login prompt until our application installation is
> done. But in SLES12, we get the login prompt before our application is
> installed.
> 
>  
> 
> How to hold the login prompt until our application installation is
> complete? We tried adding /Before=getty@.service/  in our application
> install unit file, but its not helping.
> 
> After=local-fs.target network-online.target
> 
> Before=getty@.service

did you try "Before=getty.target"?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel