Public bug reported:

The desktop reported that input-remapper-autoload closed unexpectedly.
This is an Apport report for input-remapper-control, run by the
installed udev rule during a userspace restart/coldplug before the
system D-Bus socket existed.

Affected package:
  input-remapper-daemon 2.2.0-1
  Ubuntu 26.04 (resolute), Python 3.14.4

Command from the crash report:
  /usr/bin/python3 /bin/input-remapper-control --command autoload --device 
/dev/input/event5

Traceback:
  File "input_remapper_control.py", line 116, in main
    daemon = Daemon.connect(fallback=False)
  File "daemon.py", line 237, in connect
    bus = SystemBus()
  File "pydbus/bus.py", line 57, in SystemBus
    return bus_get(Bus.Type.SYSTEM)
  File "pydbus/bus.py", line 19, in bus_get
    return Gio.bus_get_sync(type, None).pydbus
  gi.repository.GLib.GError: g-io-error-quark: Could not connect: No such file 
or directory (1)

Timeline from the journal (same boot ID; userspace restart / initrd re-run):
  10:15:38  userspace restart under the same boot ID
  10:15:44  "Switching root", udev coldplug starts
  10:15:45  udev runs the input-remapper rule for every input device;
            the event5 call reaches SystemBus() and raises GLib.GError
  10:15:46  systemd starts listening on dbus.socket
  10:18:38  input-remapper-service autoloads the presets successfully

Impact:
The crash is noisy but does not lose remapping. There was no daemon to talk to 
at that point; the session autostart (input-remapper-autoload.desktop) loaded 
the presets after login. The visible symptom is an Apport crash report on every 
boot/restart, not broken key mapping.

Root cause:
1. The 2.2.0 udev rule is synchronous and unconditional, so it runs for every 
input device during coldplug.
2. input_remapper_control.py's boot-time guard was bypassed during the 
userspace restart: the same boot ID was still present and the boot-finished 
checks reported the system as already up.
3. In 2.2.0, Daemon.connect() calls SystemBus() outside its try block:

     bus = SystemBus()          # <- raises here
     try:
         interface = bus.get(BUS_NAME, timeout=BUS_TIMEOUT)
     except GLib.GError as error:
         ...

   With /run/dbus/system_bus_socket absent, SystemBus() raises before
the try, so the exception escapes. Apport's Python hook records it as a
crash.

Upstream status:
- Known upstream issue: https://github.com/sezanzeb/input-remapper/issues/1148
- Upstream fix for current main (dasbus): 
https://github.com/sezanzeb/input-remapper/pull/1396

PR #1396 catches GLib.Error alongside DBusError in Daemon.connect() and
adds regression tests. It targets main, where dasbus and the newer udev
rule from #1392 are used. It is not directly backportable to 2.2.0,
which still uses pydbus and calls SystemBus() outside the try.

Requested fix for Ubuntu 2.2.0-1:
- Move SystemBus() inside the try/catch that handles GLib.GError, and recreate 
the bus in the fallback retry loop.
- With fallback=False (the udev/control path), return None so 
input-remapper-control exits 5 cleanly instead of generating an Apport report.
- With fallback=True (the GUI path), retry and exit 8 if the bus remains 
unavailable.

I reproduced this in an Ubuntu 26.04.1 VM with /run/dbus replaced by an
empty tmpfs: the stock 2.2.0-1 package produces the exact GLib.GError
traceback and exit 1. The equivalent pydbus fix makes input-remapper-
control exit 5 with no traceback. A debdiff for 2.2.0-1 will be
attached.

** Affects: input-remapper (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: input-remapper (Ubuntu Resolute)
     Importance: Undecided
         Status: New


** Tags: apport-crash resolute

** Tags added: apport-crash resolute

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174519

Title:
  input-remapper-control crashed with gi.repository.GLib.GError in
  bus_get() during udev autoload

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/input-remapper/+bug/2174519/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to