snyball/hawck

Scripts are non-functional despite daemons running

aemino opened this issue · 19 comments

System info:

  • Distro: Arch Linux
  • Version: master branch
  • Method of installation:
    • install.sh
    • AUR package
  • Keymap: us
  • Keyboard:
    • USB
    • Bluetooth
    • Laptop built-in
    • I use a USB steering wheel exclusively for all my data input.

Additional context
This is a follow-up to #23 (comment).

Here is the requested device info:

/dev/input details

I attempted to run the input daemon via sudo hawck-inputd --kbd-device /dev/input/event24 --no-fork because it seemed like event24 was the correct fd at the time for my K70 keyboard, and it wrote the following to stdout:

Starting Hawck InputD v0.7 on:
  - </dev/input/event24>
Connection established!

Unfortuately, this didn't solve the issue; pressing CTRL+ALT+H with example.hwk running did nothing (I do have a notification daemon), nor did my toggleable key remapper (which is structurally identical to the one described in the README).

I should also note that the macro daemon is a bit finicky and tends to get stuck/require a restart when the input daemon restarts.

Try:

$ sudo runuser -u hawck-input -- hawck-inputd --kbd-device /dev/input/event24 --no-hotplug
$ journalctl -xe | grep hawck

inputd logs to syslog, so you need to run journalctl to get the logs.

inputd also expects to be executed as the hawck-input user (this one is important because of strict file permission checks, where hawck-inputd expects to own certain files.)

EDIT: Also, remember to re-check that /dev/input/event24 symlink if you rebooted or unplugged/shuffled around usb devices.

EDIT²: If it still doesn't work, then try enabling unsafe mode with:

$ sudo cp /usr/share/hawck/keys/__UNSAFE_MODE.csv /var/lib/hawck-input/keys/__UNSAFE_MODE.csv
$ sudo chown hawck-input:hawck-input /var/lib/hawck-input/keys/__UNSAFE_MODE.csv
$ sudo chmod 0644 /var/lib/hawck-input/keys/__UNSAFE_MODE.csv

I re-ran the input daemon as you suggested (the same device was bound to the same fd), and it seems to have crashed due to a permissions error.

sudo runuser -u hawck-input -- hawck-inputd --kbd-device /dev/input/event24 --no-hotplug
May 23 12:37:41 quark sudo[16301]:   aemino : TTY=pts/0 ; PWD=/home/aemino ; USER=root ; COMMAND=/usr/bin/runuser -u hawck-input -- hawck-inputd --kbd-device /dev/input/event24 --no-hotplug
May 23 12:37:41 quark audit[16302]: CRED_ACQ pid=16302 uid=0 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_rootok acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark runuser[16302]: pam_unix(runuser:session): session opened for user hawck-input by (uid=0)
May 23 12:37:41 quark audit[16302]: USER_START pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_unix,pam_permit,pam_mail,pam_systemd,pam_env acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark kernel: audit: type=1103 audit(1590262661.695:53): pid=16302 uid=0 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_rootok acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark kernel: audit: type=1105 audit(1590262661.695:55): pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_unix,pam_permit,pam_mail,pam_systemd,pam_env acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark runuser[16302]: pam_unix(runuser:session): session closed for user hawck-input
May 23 12:37:41 quark audit[16302]: USER_END pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_unix,pam_permit,pam_mail,pam_systemd,pam_env acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark audit[16302]: CRED_DISP pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:setcred grantors=pam_rootok acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark hawck-inputd[16305]: SystemError: Unable to open file: Permission denied
May 23 12:37:41 quark kernel: audit: type=1106 audit(1590262661.698:56): pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_unix,pam_permit,pam_mail,pam_systemd,pam_env acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark kernel: audit: type=1104 audit(1590262661.698:57): pid=16302 uid=0 auid=1002 ses=3 msg='op=PAM:setcred grantors=pam_rootok acct="hawck-input" exe="/usr/bin/runuser" hostname=quark addr=? terminal=pts/0 res=success'
May 23 12:37:41 quark kernel: audit: type=1701 audit(1590262661.698:58): auid=1002 uid=1002 gid=1002 ses=3 pid=16305 comm="hawck-inputd" exe="/usr/bin/hawck-inputd" sig=6 res=1
May 23 12:37:41 quark audit[16305]: ANOM_ABEND auid=1002 uid=1002 gid=1002 ses=3 pid=16305 comm="hawck-inputd" exe="/usr/bin/hawck-inputd" sig=6 res=1
May 23 12:37:41 quark systemd-coredump[16321]: Process 16305 (hawck-inputd) of user 1002 dumped core.
                                               #6  0x000055659dca34c4 n/a (hawck-inputd + 0x274c4)
                                               #7  0x000055659dca2c4c n/a (hawck-inputd + 0x26c4c)
                                               #8  0x000055659dc8773b n/a (hawck-inputd + 0xb73b)
                                               #10 0x000055659dc8882e n/a (hawck-inputd + 0xc82e)
-- Subject: Process 16305 (hawck-inputd) dumped core
-- Process 16305 (hawck-inputd) crashed and dumped core.

Haven't tried unsafe mode yet; let me know if you think it would be necessary given these results.

I should also mention again that I'm using Wayland (sway), which is more strict about what devices can be accessed by what programs.

Mar 26 23:52:15 sirius sudo[40706]:     alen : TTY=pts/0 ; PWD=/home/alen/settings/hawck ; USER=root ; COMMAND=/usr/bin/runuser -u hawck-input -- hawck-inputd --kbd-device /dev/input/event2 --no-hotplug
Mar 26 23:51:55 sirius systemd-coredump[40679]: Process 40677 (hawck-inputd) of user 1000 dumped core.
                                                #6  0x000055ee128b6664 n/a (hawck-inputd + 0x2b664)
                                                #7  0x000055ee128b5dec n/a (hawck-inputd + 0x2adec)
                                                #8  0x000055ee12897e5b n/a (hawck-inputd + 0xce5b)
                                                #10 0x000055ee128990ee n/a (hawck-inputd + 0xe0ee)
░░ Subject: Process 40677 (hawck-inputd) dumped core
░░ Process 40677 (hawck-inputd) crashed and dumped core.
Mar 26 23:51:55 sirius hawck-inputd[40677]: SystemError: Unable to open file: Permission denied
Mar 26 23:51:24 sirius sudo[40659]: pam_unix(sudo:session): session closed for user hawck-input
Mar 26 23:51:24 sirius sudo[40659]: pam_unix(sudo:session): session opened for user hawck-input(uid=1001) by (uid=1000)
Mar 26 23:51:24 sirius sudo[40659]:     alen : TTY=pts/0 ; PWD=/home/alen/.local/share/hawck/scripts ; USER=hawck-input ; COMMAND=/usr/bin/install -m 644 /tmp/tmp.M9dcd6ITbk /var/lib/hawck-input/keys/dvorak.csv

@mistery Can you try compiling hawck with debug information?

Then run it with gdb to get a backtrace on that exception.

You could also try a reboot followed by sudo setfacl -m 'g:uinput:rw' /dev/uinput

You could also try a reboot followed by sudo setfacl -m 'g:uinput:rw' /dev/uinput

That seems to have worked as there is was no exception initially. Run inputd and macrod manually and this comes up in the log:

Mar 27 19:27:10 sirius systemd-coredump[8753]: Process 8751 (hawck-macrod) of user 1000 dumped core.
                                               #6  0x0000556478d038b0 n/a (hawck-macrod + 0x188b0)
                                               #7  0x0000556478d01bcc n/a (hawck-macrod + 0x16bcc)
                                               #8  0x0000556478cf8f6d n/a (hawck-macrod + 0xdf6d)
                                               #10 0x0000556478cf97fe n/a (hawck-macrod + 0xe7fe)
░░ Subject: Process 8751 (hawck-macrod) dumped core
░░ Process 8751 (hawck-macrod) crashed and dumped core.
Mar 27 19:27:10 sirius hawck-macrod[8751]: Outdated pid file with exe '', continuing ...
Mar 27 19:27:10 sirius hawck-macrod[8749]: Directory did not exist, creating it with mask rwx------: /run/user/1000/hawck
Mar 27 19:27:06 sirius systemd-coredump[8739]: Process 8737 (hawck-inputd) of user 1000 dumped core.
                                               #6  0x000055b6000edac5 n/a (hawck-inputd + 0x9ac5)
                                               #7  0x000055b6000f0f7c n/a (hawck-inputd + 0xcf7c)
                                               #9  0x000055b6000f20ee n/a (hawck-inputd + 0xe0ee)
░░ Subject: Process 8737 (hawck-inputd) dumped core
░░ Process 8737 (hawck-inputd) crashed and dumped core.
Mar 27 19:23:58 sirius sudo[8378]:     alen : TTY=pts/0 ; PWD=/home/alen/pCloudDrive/settings/hawck ; USER=root ; COMMAND=/usr/bin/runuser -u hawck-input -- hawck-inputd --kbd-device /dev/input/event2 --no-hotplug

I'm not sure if this is significant. The users panel states that the account is disabled.

image

I'm not sure if this is significant. The users panel states that the account is disabled.

image

It's not significant, it probably just says that because its shell is set to /bin/nologi n. Although that user account should not appear in the GNOME user accounts GUI.

I think you're both running into some sort of configuration issue, but it's difficult to figure out exactly what it could be.

Do you know how to get a stacktrace with gdb, it would be very helpful to know exactly where that exception is thrown. If you don't know how let me know here and I'll post the commands needed.

Also, if you could write down the exact steps used to install hawck, that would also help. You can use the bash history command to view exactly what you did to install it.

For installation, I just used the hawck-git package from AUR.
For gdb I'll haveto checkthe docs on how to useit .

For installation, I just used the hawck-git package from AUR.

For gdb I'll haveto checkthe docs on how to useit .

Run with gdb ./path/to/hawck then in gdb do run <hawck args> wait for the exception then run the backtrace command.

Thanks! How do I enable debugging information in the build?

If I run the install.sh from the git clone, I get

image

and hawck-git folder is empty.

Install the build dependencies specified in the PKGBUILD, then:

Instead of running the install script, try the following from a fresh git clone of Hawck:

mkdir build
cd build
meson --optimization=g ..
ninja -j$(nproc)

The executable should be in build/src/....

Interestingly, the results appear to be the same:

image

image

even though the logs state otherwise:

image

How do I remove the previous installation?

removed the binaries in /usr/local/bin and trying again...

I don't really understand what's going on here but the results are still the same. No errors caught by gdb but they appear in the journal:

image

Interestingly, the results appear to be the same:

image

image

even though the logs state otherwise:

image

How do I remove the previous installation?

You need set follow-fork-mode child in gdb before run.

ok, that's better:

image

and this is when run with sudo gdb ...

image

ok, that's better:

image

Now that's interesting, I've never seen it crash there before.

Thank you, I'll try to see how it might wind up crashing there.

I'm somewhat busy so it might take a little while before I have the time, but I'll post more details here if I need anything else to track it down.

No worries, thanks! See the second screenshot, as well, when running inputd with sudo. Cheers!