Could anyone figure out why this systemd unit fails to start?
I have placed the service in /etc/systemd/system/startup_actions.service
[Unit]
Description=Startup actions
[Service]
Type=oneshot
ExecStart=/usr/local/bin/disable_pgupdw.sh
[Install]
WantedBy=multi-user.target
To run it I do
sudo systemctl start startup_actions.service
The unit symply disables the pgup and down keys with xmodmap, and works on its own:
#!/bin/bash
xmodmap -e 'keycode 112 = NoSymbol'
xmodmap -e 'keycode 117 = NoSymbol'
The script is placed in
/usr/local/bin
This is the output of systemctl status startup_actions
startup_actions.service - Startup actions
Loaded: loaded (/etc/systemd/system/startup_actions.service; enabled; vendor preset: enable
Active: failed (Result: exit-code) since Sat 2017-11-04 14:15:18 GMT; 1h 21min ago
Process: 2360 ExecStart=/usr/local/bin/disable_pgupdw.sh (code=exited, status=1/FAILURE)
Main PID: 2360 (code=exited, status=1/FAILURE)
When I try to start it it says:
Job for startup_actions.service failed because the control process exited with error code.
See "systemctl status startup_actions.service" and "journalctl -xe" for details.
Best Answer
The following unit works, even though it is not the optimal solution
One in fact needs to add a sleep 10 at the beginning of the script, which is not very nice
As pointed out by Ignacio, xmodmap requires access to the X server. The combination
and
in the script seems to achieve the requirement.