sezanzeb / input-remapper

🎮 ⌨ An easy to use tool to change the behaviour of your input devices.
GNU General Public License v3.0
3.89k stars 161 forks source link

Linux Mint: postinst script failure #665

Closed Moini closed 1 year ago

Moini commented 1 year ago

Please install the newest version from source to see if the problem has already been solved.

2.0.0 is the version that has the problem. Installed from .deb on GitLab.

The postinst script failed, making apt constantly complain.

When I run postinst manually, I get:

Failed to disable unit: Unit file key-mapper.service does not exist.
Failed to stop key-mapper.service: Unit key-mapper.service not loaded.
Failed to enable unit: Unit file /etc/systemd/system/input-remapper-daemon.service is masked.
Failed to start input-remapper.service: Unit input-remapper.service failed to load properly, please adjust/correct and reload service manager: File exists
See system logs and 'systemctl status input-remapper.service' for details.

System Information and logs

  1. input-remapper-control --version
input-remapper 2.0.0 9e04df79ca4dca77516a9864d740b9b2d4aef788 https://github.com/sezanzeb/input-remapper
python-evdev 1.4.0
  1. which linux distro (ubuntu 20.04, manjaro, etc.)

Linux Mint 21.1

  1. which desktop environment (gnome, plasma, xfce4, etc.)

Xfce

  1. sudo ls -l /proc/1/exe to check if you are using systemd

Yes!

  1. cat ~/.config/input-remapper-2/config.json to see if the "autoload" config is written correctly
{
    "version": "2.0.0",
    "autoload": {
        "SEM USB Keyboard": "Keypad Aufnahme"
    },
    "macros": {
        "keystroke_sleep_ms": 10
    },
    "gamepad": {
        "joystick": {
            "non_linearity": 4,
            "pointer_speed": 80,
            "left_purpose": "none",
            "right_purpose": "none",
            "x_scroll_speed": 2,
            "y_scroll_speed": 0.5
        }
    }
}
  1. systemctl status input-remapper -n 50 the service has to be running

This is where it doesn't work:

Warning: The unit file, source configuration file or drop-ins of input-remapper.service changed on disk. Run 'systemctl daemon-reload' to reload units.
○ input-remapper.service
     Loaded: error (Reason: Unit input-remapper.service failed to load properly, please adjust/correct and reload service manager: File exists)
     Active: inactive (dead)

I've already tried reloading, but something must be wrong there.

Testing the status returns:

systemctl status input-remapper.service
Warning: The unit file, source configuration file or drop-ins of input-remapper.service changed on disk. Run 'systemctl daemon-reload' to reload units.
○ input-remapper.service
     Loaded: error (Reason: Unit input-remapper.service failed to load properly, please adjust/correct and reload service manager: File exists)
     Active: inactive (dead)

Testing the setup

  1. input-remapper-control --command hello
ERROR: Service not running? g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name inputremapper.Control was not provided by any .service files (2)
ERROR: Daemon missing
  1. sudo pkill -f input-remapper-service && sudo input-remapper-service -d & sleep 2 && input-remapper-control --command autoload, are your keys mapped now?

Yes.

  1. (while the previous command is still running) sudo evtest and search for a device suffixed by "mapped". Select it, does it report any events? Share the output.

no 'mapped', but suffixed by 'forwarded'.

/dev/input/event20:     input-remapper SEM USB Keyboard forwarded
/dev/input/event21:     input-remapper SEM USB Keyboard Consumer Control forwarded
  1. sudo udevadm control --log-priority=debug && sudo udevadm control --reload-rules && journalctl -f | grep input-remapper,
  2. now plug in the device that should autoload

log.txt

jonasBoss commented 1 year ago
Failed to enable unit: Unit file /etc/systemd/system/input-remapper-daemon.service is masked.

That is probably the issue. You need to unmask the service:

sudo systemctl unmask input-remapper

Then you can run the postinst script again. It should say something like this:

Failed to disable unit: Unit file key-mapper.service does not exist.
Failed to stop key-mapper.service: Unit key-mapper.service not loaded.
Created symlink /etc/systemd/system/default.target.wants/input-remapper.service → /usr/lib/systemd/system/input-remapper.service.

You can ignore the first two errors.

Moini commented 1 year ago

Thank you.

Unfortunately, it doesn't say anything like that :-(

The file /usr/lib/systemd/system/input-remapper.service exists. The file /usr/bin/input-remapper.service exists. The file /etc/systemd/system/default.target.wants/input-remapper-daemon.service exists, but not /etc/systemd/system/default.target.wants/input-remapper.service

$ sudo systemctl unmask input-remapper
$ sudo systemctl daemon-reload 
[Try installing package again - does not work, same error message as before]
$ sudo systemctl unmask input-remapper [Tab][Maybe this wasn't complete? Let's try unmasking more services.]
> input-remapper-daemon.service  input-remapper.service         
$ sudo systemctl unmask input-remapper-daemon.service 
Removed /etc/systemd/system/input-remapper-daemon.service. [What? Removed?!? …]
$ sudo systemctl daemon-reload 
$ sudo ./postinst [Well, let's try again...]
> Failed to disable unit: Unit file key-mapper.service does not exist.
> Failed to stop key-mapper.service: Unit key-mapper.service not loaded.
> Failed to enable unit: File input-remapper.service: Link has been severed
> Failed to start input-remapper.service: Unit input-remapper.service not found.
[Nope... :-( ]
$ sudo systemctl unmask input-remapper.service [Maybe with the .service at the end?]
> Unit input-remapper.service does not exist, proceeding anyway. [No... ]
$ sudo systemctl daemon-reload 
$ sudo ./postinst [Try again... but no ... ]
> Failed to disable unit: Unit file key-mapper.service does not exist.
> Failed to stop key-mapper.service: Unit key-mapper.service not loaded.
> Failed to enable unit: File input-remapper.service: Link has been severed
> Failed to start input-remapper.service: Unit input-remapper.service not found.
Moini commented 1 year ago

Might have something to do with me having the 1.4 version installed via package management before, and removing it (and reinstalling it, and removing it again, and installing 2.0, and removing that again - a couple times back and forth).

jonasBoss commented 1 year ago

I assume you previously used the package from the mint repository and you are now trying to install the .deb file directly from the releases page? It looks like the ubuntu version is split into two packages: a daemon and a gui did you make sure to uninstall both of those packages with your package manager? There should not be any input-remapper related files in /usr/lib/systemd/system/, /usr/bin/ and /etc/systemd/system/default.target.wants/ after the uninstall.

This looks like an issue with the packaging for mint. Unfortunately I am not super familliar with Ubuntu or mint packaging. Maybe @skitt can help whit this.

skitt commented 1 year ago

What does dpkg -l 'input-remapper*' show? You may need to purge packages marked rc.

Moini commented 1 year ago

Thanks, purging helped!

I used sudo apt purge python3-evdev python3-pydbus python3-inputremapper input-remapper-daemon input-remapper and then downloaded 2.0.0 again and installed it.

For some reason, the purging did not delete the two configuration folders... which is weird. I backed them up and removed from ./.config before re-installing, and moved the 'input-remapper-2' config folder back after having started and closed the program once. Then restarted it, with the new config. Then rebooted.

The number keypad works as a 'streamdeck' and Inkscape button set for use with a graphics tablet now directly after logging in! ❤️

Thank you very much to both of you!

Should the possibility of purging being needed when coming from distro debs be documented somewhere?

Moini commented 1 year ago

(those were the packages from my apt log that I had installed when I first installed the 1.4 version)

edofe99 commented 5 months ago

Thanks, purging helped!

I used sudo apt purge python3-evdev python3-pydbus python3-inputremapper input-remapper-daemon input-remapper and then downloaded 2.0.0 again and installed it.

For some reason, the purging did not delete the two configuration folders... which is weird. I backed them up and removed from ./.config before re-installing, and moved the 'input-remapper-2' config folder back after having started and closed the program once. Then restarted it, with the new config. Then rebooted.

The number keypad works as a 'streamdeck' and Inkscape button set for use with a graphics tablet now directly after logging in! ❤️

Thank you very much to both of you!

Should the possibility of purging being needed when coming from distro debs be documented somewhere?

Thank you SO much.