Siduction Forum

Siduction Forum => Installation - Support => Topic started by: c.monty on 2015/07/23, 22:17:36

Title: [P] Startup /etc/rc.local fails
Post by: c.monty on 2015/07/23, 22:17:36
Hello!

In order to address an issue with wrong keyboard layout I want to use a workaround by means of running a script with /etc/rc.local at startup.
Code: [Select]
thomas@pc1-gigabyte:~$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

setxkbmap -model pc105 \
      -layout de \
      -variant nodeadkeys \
      -option lv3:ralt_switch,terminate:ctrl_alt_bksp
exit 0

The service fails to start; the journal records this error message:
Code: [Select]
Jul 23 21:55:23 pc1-gigabyte systemd[1]: Failed to start /etc/rc.local Compatibility.
-- Subject: Unit rc-local.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rc-local.service has failed.
--
-- The result is failed.
Jul 23 21:55:23 pc1-gigabyte systemd[1]: ^[[1;39mUnit rc-local.service entered failed state.

Checking the status of rc-local.service shows the failing service:
Code: [Select]
user@pc1-gigabyte:~$ systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static)
   Active: failed (Result: exit-code) since Do 2015-07-23 21:55:23 CEST; 3min 34s ago
  Process: 692 ExecStart=/etc/rc.local start (code=exited, status=255)

Jul 23 21:55:19 pc1-gigabyte rc.local[692]: Cannot open display "default display"
Jul 23 21:55:23 pc1-gigabyte systemd[1]: rc-local.service: control process exited, code=exited status=255
Jul 23 21:55:23 pc1-gigabyte systemd[1]: Failed to start /etc/rc.local Compatibility.
Jul 23 21:55:23 pc1-gigabyte systemd[1]: Unit rc-local.service entered failed state.

Any idea why this service fails to start?
I can execute the script manually in console w/o any issues:
Code: [Select]
thomas@pc1-gigabyte:~$ bash -x /etc/rc.local
+ setxkbmap -model pc105 -layout de -variant nodeadkeys -option lv3:ralt_switch,terminate:ctrl_alt_bksp
+ exit 0
Therefore I don't think there's a errornous syntax in the script.

Any advice?

THX
Title: Re: [P] Startup /etc/rc.local fails
Post by: towo on 2015/07/23, 22:22:20
you can't run setxkbmap without running x, and rc.local is running before x is started.
Title: Re: [P] Startup /etc/rc.local fails
Post by: c.monty on 2015/07/23, 23:09:59
you can't run setxkbmap without running x, and rc.local is running before x is started.

Understand... how can I correct this, means start setxkbmap after x?