You are not logged in.

#1 2012-10-12 10:07:32

Shapeshifter
Member
Registered: 2008-03-11
Posts: 230

systemd: some services starting too early and then failing

Hello everyone,

I freshly installed Arch on this new laptop (Asus Zenbook Prime UX32VD) and from the start, I wanted to have a pure systemd setup. I'm using services only and I've uninstalled initscripts and so far it's working relatively well.

However, some services seem to start too early by default and the workarounds are unsatisfactory.

Problem 1: asus-screen-brightness and asus-kbd-backlight
On this lap top, the stock screen brightness buttons do not work (yet). A script and a service file (which are both available via the asus-screen-brightness AUR package) have to be used to allow users to change the brightness via the script. The problem is, with that service enabled, it only succeeds sometimes. About have of the time booting the laptop it fails, most likely because the necessary nodes in /sys/ do not exist yet. Restarting the service manually after booting does the trick:

[root@tachychineta shapeshifter]# sc status asus-screen-brightness
asus-screen-brightness.service - Allow user access to screen brightness
	  Loaded: loaded (/etc/systemd/system/asus-screen-brightness.service; enabled)
	  Active: active (exited) since Fri, 12 Oct 2012 11:23:44 +0200; 1min 1s ago
	 Process: 320 ExecStart=/usr/bin/asus-screen-brightness allowusers (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/asus-screen-brightness.service

Oct 12 11:23:44 tachychineta systemd[1]: Starting Allow user access to screen brightness...
Oct 12 11:23:44 tachychineta sudo[349]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness
Oct 12 11:23:44 tachychineta sudo[349]: pam_unix(sudo:session): session opened for user root by (uid=0)
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: cat: /sys/class/backlight/intel_backlight/max_brightness: No such file or directory
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: /usr/bin/asus-screen-brightness: line 8: /10: syntax error: operand expected (error token is "/10")
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: /usr/bin/asus-screen-brightness: line 10: 2*: syntax error: operand expected (error token is "*")
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: cat: /sys/class/backlight/intel_backlight/brightness: No such file or directory
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: chgrp: cannot access ‘/sys/class/backlight/intel_backlight/brightness’: No such file or directory
Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: chmod: cannot access ‘/sys/class/backlight/intel_backlight/brightness’: No such file or directory
Oct 12 11:23:44 tachychineta systemd[1]: Started Allow user access to screen brightness.


[root@tachychineta shapeshifter]# sc restart asus-screen-brightness


[root@tachychineta shapeshifter]# sc status asus-screen-brightness
asus-screen-brightness.service - Allow user access to screen brightness
	  Loaded: loaded (/etc/systemd/system/asus-screen-brightness.service; enabled)
	  Active: active (exited) since Fri, 12 Oct 2012 11:25:28 +0200; 2s ago
	 Process: 2547 ExecStop=/usr/bin/asus-screen-brightness disallowusers (code=exited, status=0/SUCCESS)
	 Process: 2579 ExecStart=/usr/bin/asus-screen-brightness allowusers (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/asus-screen-brightness.service

Oct 12 11:25:28 tachychineta systemd[1]: Starting Allow user access to screen brightness...
Oct 12 11:25:28 tachychineta sudo[2593]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chgrp users /sys/class/backlight/intel_backlight/brightness
Oct 12 11:25:28 tachychineta sudo[2593]: pam_unix(sudo:session): session opened for user root by (uid=0)
Oct 12 11:25:28 tachychineta sudo[2597]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness
Oct 12 11:25:28 tachychineta sudo[2597]: pam_unix(sudo:session): session opened for user root by (uid=0)
Oct 12 11:25:28 tachychineta systemd[1]: Started Allow user access to screen brightness.

Exactly the same problem occurs with asus-kbd-backlight.service which is needed to allow users to control the keyboard backlight. It also fails because of missing /sys/ entries if started too early.

Problem 2: automatic login & X11
I use the method described on the wiki to autologin into TTY1 with my user and my .bash_profile contains

[[ $(fgconsole) = 1 ]] && startx

and my .xserverrc is configured as explained in this fantastically useful article by falconindy.
This way, X starts automatically and my session is properly authenticated for things like udiskie. I'm not using [testing] but instead rebuilt polkit with --enable-systemd and it's working just fine. The problem is, just like in problem 1, Xorg fails to start every now and then, failing with

 (EE) No devices detected.

I don't have a full log because it hasn't happened in a while, but I'm very certain it's because the chipset isn't ready, yet.

Solutions?
I added "i915" to /etc/modules-load.d/static.conf hoping that would cover both the Xorg and backlight problems but it doesn't help. I then tried adding i915 to my MODULES in mkinitcpio.conf and rebuilding the initramfs and at least it looked like that way the problems went away but it added about 4 seconds to the time spent by the "kernel" during boot which is quite unacceptable. (Plots with and without i915 in MODULES).

I read the systemd.unit and systemd.service man pages but I can't find a way to speficy required kernel modules for a service file. I'm not sure if specifying the modules in /etc/modules-load.d shouldn't be enough (because apparently it's supposed to load for sysinit.target, which is early) but apparently it isn't.

Any ideas how I can get these services to work properly without sacrificing too much boot time?

Thank you

Last edited by Shapeshifter (2012-10-12 10:20:09)

Offline

#2 2012-10-12 11:14:53

lordheavy
Developer
From: France
Registered: 2010-04-01
Posts: 292

Re: systemd: some services starting too early and then failing

Please fill a bug report.

Offline

Board footer

Powered by FluxBB