You are not logged in.

#1 2020-12-21 12:48:51

Xwang
Member
Registered: 2012-05-14
Posts: 353

[Solved] KDE: mtp device used by another process (/usr/lib/kf5/kiod5)

Hi to all,
up until the beginning of this month I ran the following script to back up my Motorola G5 to my PC using simple-mtpfs and backintime.

#!/bin/bash

simple-mtpfs --device 1 $HOME/mnt/

date > /home/andreak/mnt/samsung64gb/.latestMountTime.txt

sudo -u $USER backintime --profile BackupMotoG5 backup

sudo -u $USER backintime --profile BackupMotoG5 smart-remove

fusermount -u $HOME/mnt/ 

Having bought a new smartphone I tried to follow the same approach, but the new smartphone seems to interact differently with the PC.
When I try to mount it with simple-ntpfs or with aft-mtp-mount, it is already used by another processs:

$ simple-mtpfs --device 1 $HOME/mnt/
LIBMTP PANIC: Trying to dump the error stack of a NULL device!
$ aft-mtp-mount -o allow_other ~/mnt
Device::Find failed:Device is already used by another process connect failed: no MTP device found

So I've discovered that it is used by the "/usr/lib/kf5/kiod5" process called by the "/user/lib/systemd/systemd --user" process:

$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 8087:0a2a Intel Corp. Bluetooth wireless interface
Bus 001 Device 011: ID 2717:ff48 Xiaomi Inc. Mi/Redmi series (MTP + ADB)
Bus 001 Device 003: ID 04f2:b3fd Chicony Electronics Co., Ltd HD WebCam (Asus N-series)
Bus 001 Device 006: ID 04fc:05d8 Sunplus Technology Co., Ltd Wireless keyboard/mouse
Bus 001 Device 004: ID 1bcf:08a0 Sunplus Innovation Technology Inc. Gaming mouse [Philips SPK9304]
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ sudo fuser /dev/bus/usb/001/011 
[sudo] password di *******: 
/dev/bus/usb/001/011:  6015
$  ps -fp 6015
UID          PID    PPID  C STIME TTY          TIME CMD
*******    6015     807  0 12:35 ?        00:00:00 /usr/lib/kf5/kiod5

If I kill the process "/usr/lib/kf5/kiod5" I can mount the device using:

simple-mtpfs --device 1 $HOME/mnt/

So in order to be able to backup my new device I have to:
1) kill the "/usr/lib/kf5/kiod5". Is it safe to do that?
2) find a way to identify the USB Bus # and Device # so that to find the process number and kill it (these numbers change every time I connect the smartphone). How can I do that? Is there any other way to do that?

Last edited by Xwang (2020-12-21 22:37:49)


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

#2 2020-12-21 12:56:11

Xwang
Member
Registered: 2012-05-14
Posts: 353

Re: [Solved] KDE: mtp device used by another process (/usr/lib/kf5/kiod5)

This bug https://bugs.kde.org/show_bug.cgi?id=412257 seems related and I wonder why my old smartphone do not suffer in the same way?
Maybe it is not recognized by UDEV and so kiod5 is not called. Is there a way to verify if this is the case and if so to force UDEV to not call kiod5 for the new smartphone too?


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

#3 2020-12-21 22:33:48

Xwang
Member
Registered: 2012-05-14
Posts: 353

Re: [Solved] KDE: mtp device used by another process (/usr/lib/kf5/kiod5)

I've found how to do:

#!/bin/bash

#Getting Xiaomi Redmi Note 9 Pro data from lsusb using its ID 2717:ff48
DATA=`lsusb | grep '2717:ff48'`
echo $DATA
# Reading the bus number:
BUS=`echo ${DATA:4:3}`
# Reading the device number:
DEV=`echo ${DATA:15:3}`
# Killing the process which is using the device (if any)
fuser -k /dev/bus/usb/$BUS/$DEV

simple-mtpfs --device 1 /home/andreak/mnt/

date > /home/andreak/mnt/disk/.latestMountTime.txt

sudo -u andreak backintime --profile BackupRedmiNote9Pro backup

sudo -u andreak backintime --profile BackupRedmiNote9Pro smart-remove

fusermount -u /home/andreak/mnt/ 

But the rsync doesn't work with this new device.


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

Board footer

Powered by FluxBB