Plex fails to install on linux when a key remapper is installed (like Kinto)

Server Version#: ALL (1.26.2.5797-5bd057d2b_amd64)

Kinto is a key remapper (that listens to all keyboard events).

When Kinto is installed (and not paused) on Linux plexmediaserver can not be installed with apt-get, if plex is already installed then every single apt-get action will fail with a dpkg error.

(For context, here is the issue I raised with Kinto, but Kinto cant solve the problem, as the best solution is for plex to stop assuming uinput access)


The error looks like this when trying to install plexmediaserver_1.26.2.5797-5bd057d2b_amd64.deb with sudo apt install ./plexmediaserver_1.26.2.5797-5bd057d2b_amd64.deb:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'plexmediaserver' instead of './plexmediaserver_1.26.2.5797-5bd057d2b_amd64.deb'
Recommended packages:
  beignet-opencl-icd
The following NEW packages will be installed:
  plexmediaserver
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/83.3 MB of archives.
After this operation, 249 MB of additional disk space will be used.
Selecting previously unselected package plexmediaserver.
(Reading database ... 207998 files and directories currently installed.)
Preparing to unpack .../plexmediaserver_1.26.2.5797-5bd057d2b_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Pre-installation Validation complete.
Unpacking plexmediaserver (1.26.2.5797-5bd057d2b) ...
Setting up plexmediaserver (1.26.2.5797-5bd057d2b) ...
PlexMediaServer install: PlexMediaServer-1.26.2.5797-5bd057d2b - Installation st
arting.
PlexMediaServer install: 
PlexMediaServer install: Now installing based on:
PlexMediaServer install:   Installation Type:   Update
PlexMediaServer install:   Process Control:     systemd
PlexMediaServer install:   Plex User:           plex
PlexMediaServer install:   Plex Group:          plex
PlexMediaServer install:   Video Group:         video
PlexMediaServer install:   Metadata Dir:        /var/lib/plexmediaserver/Library
/Application Support
PlexMediaServer install:   Temp Directory:      /tmp 
PlexMediaServer install:   Lang Encoding:       en_US.UTF-8
PlexMediaServer install:   Nvidia GPU card:     Found
PlexMediaServer install:  
PlexMediaServer install: Completing final configuration.
input44: Failed to write 'change' to '/sys/devices/virtual/input/input44/uevent'
: Cannot allocate memory
dpkg: error processing package plexmediaserver (--configure):
 installed plexmediaserver package post-installation script subprocess returned 
error exit status 1
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Errors were encountered while processing:
 plexmediaserver
E: Sub-process /usr/bin/dpkg returned an error code (1)

I want to draw your attention to input44: Failed to write 'change' to '/sys/devices/virtual/input/input44/uevent' : Cannot allocate memory, meaning that Plex is trying to capture keyboard input during install for some reason.


I have found many other form posts over the years where plex-media-server can not be installed with various key remapping software, including ckb-next, just search for Failed to write 'change' to

PMS is not trying to capture a keyboard input.
PMS doesn’t need a keyboard at all to run.

Plex doesn’t use uinput at all.

The only udev activity during installation is the postinstall phase.
This is where postinst does the following:

  1. Write udev rule for PMS to connect to USB tuners
    # Set generic udev rule for USB tuners
    echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="0100", GROUP="video", MODE="0664"' > /lib/udev/rules.d/60-tv-butler.rules
  1. Write udev rule for DRM (access to /dev/dri and hardware transcoding)
    # Construct the DRM subsystem rule based on local configuration.
    echo 'SUBSYSTEM=="drm",' GROUP=\"$VideoGroup\" ', MODE="0660"' > /lib/udev/rules.d/60-plex-hw-transcoding.rules

After writing these two rules, reload the rules and then ‘run’ (trigger).

    # Reload and trigger unless in a Linux Container (known udev bug)
    if [ "$(GetConfig LinuxContainer)" = "0" ]; then
      $UDEVCMD control --reload-rules
      $UDEVCMD trigger
    fi

If you examine postinst the extent udev is touched is here:

    487 # Configure for udev if present but warn if not. (HW Transcoding and USB tuners)
    488 # Is udev installed?
    489 if [ -d /lib/udev/rules.d ]; then
    490 
    491   # Look for udevadm in the reasonable places
    492   UDEVCMD=""
    493 
    494   # Where is udevadm?
    495   if   [ -f /bin/udevadm ]; then
    496     UDEVCMD=/bin/udevadm
    497   elif [ -f /usr/bin/udevadm ]; then
    498     UDEVCMD=/usr/bin/udevadm
    499   elif [ -f /sbin/udevadm ]; then
    500     UDEVCMD=/sbin/udevadm
    501     elif [ -f /usr/sbin/udevadm ]; then
    502     UDEVCMD=/usr/sbin/udevadm
    503 
    504   fi
    505 
    506   # Continue udev setup if it exists
    507   if [ "$UDEVCMD" != "" ]; then
    508 
    509     # Write the udev rule and trigger for any already inserted USB device. Modern distros do not have this problem.
    510     # Functionality not impaired for users of HDHomeRun / network tuners.
    511     # Write custom video udev rule for the VideoGroup
    512 
    513     # Set generic udev rule for USB tuners
    514     echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="0100", GROUP="video", MODE="0664"' > /lib/udev/r        ules.d/60-tv-butler.rules
    515 
    516     # Construct the DRM subsystem rule based on local configuration.
    517     echo 'SUBSYSTEM=="drm",' GROUP=\"$VideoGroup\" ', MODE="0660"' > /lib/udev/rules.d/60-plex-hw-transcoding.rules
    518 
    519     # Reload and trigger unless in a Linux Container (known udev bug)
    520     if [ "$(GetConfig LinuxContainer)" = "0" ]; then
    521       $UDEVCMD control --reload-rules
    522       $UDEVCMD trigger
    523     fi
    524   fi
    525 
    526 else
    527   Output "Info:  'udev' not found.  Please install if you intend to use USB tuners."
    528 fi

This is not a Plex bug.

I would not be surprised to learn the app doesn’t detect when it’s already running and has control of those inputs. (under normal conditions, there is no way the app can be started twice).

I suspect it’s trying to do something and seeing itself when udevadm trigger fires.
If true, use of a memory semaphore will allow it to be able to easily detect itself and skip being ‘triggered’ again after it grabs the virtual inputs

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.