Re: [systemd-devel] Shutdown a specific service in systemd shutdown

2016-05-25 Thread Bao Nguyen
Hi, Thanks for all your comments. How do you think if we create a custom target to include all remaining services, then add this target to the dependency After= of the specific services. This way can make the specific stop before the services in the target when the system shutdowns? Thanks, BRs,

Re: [systemd-devel] Shutdown a specific service in systemd shutdown

2016-05-25 Thread Andrei Borzenkov
On Wed, May 25, 2016 at 9:59 AM, Bao Nguyen wrote: > Hi, > > Thanks for all your comments. > > How do you think if we create a custom target to include all remaining > services, then add this target to the dependency After= of the specific > services. This way can make the specific stop before the

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Jóhann B . Guðmundsson
You will always risk ending up with a race condition if you place your type units outside the official directories. /etc/systemd/system/* ( Administrators ) /run/systemd/system/* ( Temporary ) /usr/lib/systemd/system/* ( Vendors ) Arguably the support running/loading type unit files outside

Re: [systemd-devel] Shutdown a specific service in systemd shutdown

2016-05-25 Thread Michael Chapman
On Thu, 19 May 2016, Bao Nguyen wrote: Hi everyone, When the system is shutdown, systemd will terminate all services in parallel manner, could you let me know if there is any ways to tell systemd to shutdown a specific service first, then shutdown all remaining services? Hello, I haven't test

[systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Michael Hirmke
Hi *, I'd like to write a script, which can listen to the PepareForSleep signal from systemd-logind. When it catches the signal, it should do a few things in the context of the user. While doing this, it should inhibit the sleep process. It gets started as autostart script in KDE. For this purpose

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Lennart Poettering
On Tue, 24.05.16 22:21, Rashmi Ranjan Mohanty (rashmiranjan.moha...@microfocus.com) wrote: > Hi, > > Our whole software is installed into /opt. So the systemd unit files > are also there in /opt and the units are enabled to start on boot > using the command "systemctl enable file>". But if the

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Lennart Poettering
On Wed, 25.05.16 10:05, Jóhann B. Guðmundsson (johan...@gmail.com) wrote: > > > You will always risk ending up with a race condition if you place your type > units outside the official directories. > > /etc/systemd/system/* ( Administrators ) > /run/systemd/system/* ( Temporary ) > /usr/lib/sy

Re: [systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Lennart Poettering
On Wed, 25.05.16 12:17, Michael Hirmke (m...@mike.franken.de) wrote: > Hi *, > > I'd like to write a script, which can listen to the PepareForSleep > signal from systemd-logind. When it catches the signal, it should do a > few things in the context of the user. While doing this, it should > inhib

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Jóhann B . Guðmundsson
On 05/25/2016 03:22 PM, Lennart Poettering wrote: On Wed, 25.05.16 10:05, Jóhann B. Guðmundsson (johan...@gmail.com) wrote: You will always risk ending up with a race condition if you place your type units outside the official directories. /etc/systemd/system/* ( Administrators ) /run/syst

Re: [systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Michael Hirmke
Hi Lennart, thx for your answer! [...] >Being just advisory means that a user can shut down the system even if >a lock is taken, however, the lock is tracked and the expectation is >that the DE of your choice will still show them first, and ask for >confirmation to ignore them before you actually

Re: [systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Michael Hirmke
Hi again, [...] >>> - I am not able to close the file descriptor in the pre block of the >>> signal handler. Whenever I try, I get an error, that the descriptor >>> is closed. >>This suggests something else closed the fd for you? >Yes, but who or what might that be? >As I wrote above - at th

[systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
Hello, I'm starring at a chunk of code of the sysv-generator (shown below) for some while now and I still can't see its purpose. Here's the code taken from src/sysv-generator/sysv-generator.c: static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_services) { [...]

Re: [systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Mantas Mikulėnas
In other words, mixing up OS file descriptors and Perl file handles? D-Bus can only send and receive raw FDs; Net::DBus doesn't know what kind of handle it's supposed to be, so you need to either create one manually, or just work with the FD directly (I think the relevant function is sysclose()?..

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
Hm, I've already given you the answer on IRC, so I'm not sure why you ask them again. The K symlinks determine whether a service needs an explicit stop request on shutdown (i.e. Conflicts/Before: shutdown.target). That's exactly how sysvinit also worked. If there was a K symlink in rc0 and rc6, t

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
And if a service does not have an explicit stop on shutdown/reboot, the processes are killed in a final killing spree where there are not ordering guarantees. 2016-05-25 23:08 GMT+02:00 Michael Biebl : > Hm, I've already given you the answer on IRC, so I'm not sure why you > ask them again. > > T

Re: [systemd-devel] Perl Net::DBus, org.freedesktop.system1 and inhibitor locks

2016-05-25 Thread Michael Hirmke
Hi Mantas, >In other words, mixing up OS file descriptors and Perl file handles? exactly 8-< >D-Bus can only send and receive raw FDs; Net::DBus doesn't know what kind >of handle it's supposed to be, so you need to either create one manually, >or just work with the FD directly (I think the relev

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Andrei Borzenkov
25.05.2016 18:21, Lennart Poettering пишет: > > What I don't understand in your case though is why you use an explicit > mount for /opt anyway... The nice thing about btrfs is that subvolumes > behave pretty much like normal directories that just have a bit more > features. And because of that the

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
Hello Michael, On Wed, May 25, 2016 at 11:08 PM, Michael Biebl wrote: > Hm, I've already given you the answer on IRC, so I'm not sure why you > ask them again. > Indee and thank you for that. But you also told me that /etc/init.d/rc0.d isn't supported by Debian, and my question is about this ru

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
On Wed, May 25, 2016 at 11:10 PM, Michael Biebl wrote: > And if a service does not have an explicit stop on shutdown/reboot, > the processes are killed in a final killing spree where there are not > ordering guarantees. > I don't think so. /etc/init.d/rc5.d/Sxxfoo with or without a counter symli

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Andrei Borzenkov
On Thu, May 26, 2016 at 8:49 AM, Francis Moreau wrote: > > So let's take an example. Please note that I'm really not sure what's > the expected behavior of sysvinit itself, and finding some > documentation/specifications about that is pretty hard. > > I want my "foo" sysv service to be executed at

Re: [systemd-devel] DBus's PropertiesChanged signal is not triggered when an Unit stop successfully

2016-05-25 Thread Adrien Besnard
I managed to do what I wanted to do using add_timeout with the GLib's MainLoop: I poll every second the state of the unit and manually call the callback connected to DBus to fake the event when the unit is stopped. It works but this is a dirty hack. So I'm still interested by a real solution :) C

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
2016-05-26 7:49 GMT+02:00 Francis Moreau : > Hello Michael, > > On Wed, May 25, 2016 at 11:08 PM, Michael Biebl wrote: >> Hm, I've already given you the answer on IRC, so I'm not sure why you >> ask them again. >> > > Indee and thank you for that. > > But you also told me that /etc/init.d/rc0.d is

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Francis Moreau
On Thu, May 26, 2016 at 8:15 AM, Andrei Borzenkov wrote: > On Thu, May 26, 2016 at 8:49 AM, Francis Moreau > wrote: >> >> So let's take an example. Please note that I'm really not sure what's >> the expected behavior of sysvinit itself, and finding some >> documentation/specifications about that

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Franck Bui
On 05/25/2016 05:21 PM, Lennart Poettering wrote: > On Tue, 24.05.16 22:21, Rashmi Ranjan Mohanty > (rashmiranjan.moha...@microfocus.com) wrote: > >> Hi, >> >> Our whole software is installed into /opt. So the systemd unit files >> are also there in /opt and the units are enabled to start on boot

Re: [systemd-devel] sysv-generator weirdness for shutdown runlevels

2016-05-25 Thread Michael Biebl
2016-05-26 8:25 GMT+02:00 Francis Moreau : > Well yes that's not usefull, so I'm wondering why systemd has code to > deal with this weid case specially since by default all stubs will > have a Conflicts/Before=shutdown.target. The generator code is generic, there is no special code for this. -

Re: [systemd-devel] Systemd loads units before btrfs subvolumes are mounted

2016-05-25 Thread Rashmi Ranjan Mohanty
> What I don't understand in your case though is why you use an explicit > mount for /opt anyway... The nice thing about btrfs is that subvolumes > behave pretty much like normal directories that just have a bit more > features. And because of that there's no need to mount them > explicitly. Just c