evremap icon indicating copy to clipboard operation
evremap copied to clipboard

fails to start with exit code status=127 #issue

Open jasht1 opened this issue 1 year ago • 2 comments

Cannot get evremap to run as a service or from the terminal.

terminal

running sudo target/release/evremap remap /etc/evremap.toml from the terminal gives output

WARN  evremap > Short delay: release any keys now!
INFO  evremap::remapper > Going into read loop

but has no tangible effect.

systemctl

sudo systemctl start evremap.service Gives on immediate error but systemctl status evremap.service reports Active: failed and (code=exited, status=127) (more detail in [[[issue]])

Environment

lenovo laptop arch / wayland / hyperland Systemd 255 (255.2-2-arch)

my progress log

Fair warning I'm still quite new to Linux and especially arch, used pop os for awhile but that just tends to work so my troubleshooting could use some practice. I've installed evremap to try and sort out my keybinds

setup

I cloned it into ~/Applications folder and built with cargo, then made a config file and put it in the default location

#/etc/evremap.toml
device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_BACKSPACE"]

[[dual_role]]
input = "KEY_LEFTSHIFT"
hold = ["KEY_LEFTSHIFT"]
tap = ["KEY_CAPSLOCK"]

Added the default service to /usr/lib/systemd/system/ and then set it up

[Service]
WorkingDirectory=/
ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.toml -d 0"
Restart=always

[Install]
WantedBy=multi-user.target

with the following commands as recommended by the README

$ sudo cp evremap.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable evremap.service
$ sudo systemctl start evremap.service

Created an input group echo 'KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules added evdev and uinput to the group sudo gpasswd -a YOUR_USER input echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules rebooted

Issue

This dosen't appear to have worked as systemctl status evremap.service states "failed" Process: 34059 ExecStart=bash -c /usr/bin/evremap remap /etc/evremap.toml -d 0 (code=exited, status=127) full output:

× evremap.service
     Loaded: loaded (/usr/lib/systemd/system/evremap.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2024-01-16 04:56:13 GMT; 3s ago
   Duration: 6ms
    Process: 4883 ExecStart=bash -c /usr/bin/evremap remap /etc/evremap.toml -d 0 (code=exited, status=127)
   Main PID: 4883 (code=exited, status=127)
        CPU: 6ms

Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Scheduled restart job, restart counter is at 5.
Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Start request repeated too quickly.
Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Failed with result 'exit-code'.
Jan 16 04:56:13 archlinux systemd[1]: Failed to start evremap.service.

ran sudo target/release/evremap remap /etc/evremap.toml just in case, no change. Repeated all steps from [[setup]] again with no change.

As I understand it error code 127 indicates “command not found” So I checked for the executable called at /usr/bin/evremap but no directory called evremap exists in /usr/bin/ I edited /usr/lib/systemd/system/evremap.service to call the folder I built evremap in /home/joe/Applications/evremap/ and ran

$ sudo cp evremap.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable evremap.service
$ sudo systemctl start evremap.service

again. Still no change. Tried a similar thing with the path /home/joe/Applications/evremap/target/release/ but still no success. remap just isn't a command on any of these paths. I tried which -a remap but nothing relevant came up. I'm not sure what to try next, any advice?

jasht1 avatar Jan 16 '24 05:01 jasht1

Got it to start

I was so close, changed the path to "/home/joe/Applications/evremap/target/release/evremap" and now it will enable in systemctl.

But it's still not working

However it still doesn't function, my key re mappings have not taken effect. Whether I run remap as sudo in the terminal or in systemctl nothing changes.

I'm pretty sure it's reading my config as if I add a syntax error it spits out a parsing error. I'm also pretty sure its able to grab the keyboard as if I try and run it twice in 2 separate terminals the second fails with EBUSY: Device or resource busy

I will close this issue & start another one with a more relevant title if I don't find a way to solve it.

my config:

device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_BACKSPACE"]

[[dual_role]]
input = "KEY_LEFTSHIFT"
hold = ["KEY_LEFTSHIFT"]
tap = ["KEY_CAPSLOCK"]

jasht1 avatar Jan 16 '24 06:01 jasht1

IMO there is an error in your config file.

M8850 avatar Feb 06 '24 20:02 M8850

I just pushed a change with a new debug-events sub-command that can help you to figure out the proper mappings for your config, but I agree that this now sounds like an issue with your config file, so I'm going to close this.

wez avatar Jun 09 '24 13:06 wez