Bug#818306: systemd: processes get killed during resume

2016-03-16 Thread Ritesh Raj Sarraf
Hello Michael,

On Tue, 2016-03-15 at 21:02 +0100, Michael Biebl wrote:
> > Mar 16 00:26:36 learner su[10873]: + ??? root:rrs
> > Mar 16 00:26:36 learner su[10873]: pam_unix(su:session): session
> opened for user rrs by (uid=0)
> > Mar 16 00:26:37 learner laptop_mode[10624]: /usr/sbin/laptop_mode:
> 26: /usr/share/laptop-mode-tools/modules/runtime-pm: Cannot fork
> > Mar 16 00:26:37 learner laptop_mode[10624]: /usr/sbin/laptop_mode:
> 0: /usr/sbin/laptop_mode: Cannot fork
> > Mar 16 00:26:37 learner systemd[1]: laptop-mode.service: Control
> process exited, code=exited status=2
> > 2016-03-16 / 00:27:01 ♒♒♒  ☺  
> 
> I don't see systemd killing the scripts but rather the scripts
> failing
> to fork. So this looks like a lmt issue to me.

This issue popped up when refining the integration with systemd.
Something you helped me with last year, in bug #791412

The major change is I've added an ExecReload target in it, which calls
"/usr/sbin/laptop_mode auto". This is the same call even made by
/lib/udev/lmt-udev.

The reason to add an ExecReload target was because otherwise Restart
will be called (because of missing Reload), and Restart's effect are
not desirable in all scenarios.

The bug is only happening in one of the case, i.e. only during resume.
THe same code works fine after resumption.

Any advise where I should look ?


-- 
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System


signature.asc
Description: This is a digitally signed message part


Bug#818306: systemd: processes get killed during resume

2016-03-15 Thread Michael Biebl
Am 15.03.2016 um 20:15 schrieb Ritesh Raj Sarraf:
> Package: systemd
> Version: 229-2
> Severity: normal
> 
> 
> This odd behavior is only happening during swsusp resume operation. I
> suspend my laptop on power, and then before resume, I unplug the power
> cable. Laptop Mode Tools detects the state change, and runs its scripts.
> Of those scripts, some just get killed.
> 
> 
> If the run the same ExecReload command or `systemctl -no-block
> reload-or-restart laptop-mode` after the machine has resumed, it works
> fine.
> 
> 
> Apart from systemd, LMT could get invoked through other calling
> processes, like: acpid, udev etc. All those invoking tools call
> /lib/udev/lmt-udev (attached). 
> 
> Below is my systemd .service file.
> 
> 
> [Unit]
> Description=Laptop Mode Tools
> Documentation=man:laptop_mode(8) man:laptop-mode.conf(8)
> Documentation=http://github.com/rickysarraf/laptop-mode-tools
> 
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=@/usr/sbin/laptop_mode init auto
> ExecStop=@/usr/sbin/laptop_mode init stop
> ExecStopPost=@/bin/rm -f /var/run/laptop-mode-tools/enabled
> ExecReload=@/usr/sbin/laptop_mode auto
> StandardOutput=journal
> StandardError=journal
> 
> [Install]
> WantedBy=multi-user.target
> 
> rrs@learner:~$ sudo systemctl status laptop-mode
> ● laptop-mode.service - Laptop Mode Tools
>Loaded: loaded (/lib/systemd/system/laptop-mode.service; enabled; vendor 
> preset: enabled)
>Active: active (exited) (Result: exit-code) since Wed 2016-03-16 00:12:32 
> IST; 14min ago
>  Docs: man:laptop_mode(8)
>man:laptop-mode.conf(8)
>http://github.com/rickysarraf/laptop-mode-tools
>   Process: 10624 ExecReload=auto (code=exited, status=2)
>  Main PID: 1801 (code=exited, status=0/SUCCESS)
> Tasks: 0 (limit: 512)
>CGroup: /system.slice/laptop-mode.service
> 
> Mar 16 00:26:36 learner systemd[1]: Reloading Laptop Mode Tools.
> Mar 16 00:26:36 learner systemd[1]: Reloaded Laptop Mode Tools.
> Mar 16 00:26:36 learner laptop_mode[10624]: Laptop mode
> Mar 16 00:26:36 learner laptop_mode[10624]: enabled, active
> Mar 16 00:26:36 learner su[10873]: Successful su for rrs by root
> Mar 16 00:26:36 learner su[10873]: + ??? root:rrs
> Mar 16 00:26:36 learner su[10873]: pam_unix(su:session): session opened for 
> user rrs by (uid=0)
> Mar 16 00:26:37 learner laptop_mode[10624]: /usr/sbin/laptop_mode: 26: 
> /usr/share/laptop-mode-tools/modules/runtime-pm: Cannot fork
> Mar 16 00:26:37 learner laptop_mode[10624]: /usr/sbin/laptop_mode: 0: 
> /usr/sbin/laptop_mode: Cannot fork
> Mar 16 00:26:37 learner systemd[1]: laptop-mode.service: Control process 
> exited, code=exited status=2
> 2016-03-16 / 00:27:01 ♒♒♒  ☺  

I don't see systemd killing the scripts but rather the scripts failing
to fork. So this looks like a lmt issue to me.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature