Your message dated Thu, 26 Mar 2020 10:53:40 +0000
with message-id <[email protected]>
and subject line Bug#954885: fixed in libmtp 1.1.17-3
has caused the Debian Bug report #954885,
regarding /dev/bus/usb/*/* device file of printers assigned to "audio" group
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
954885: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954885
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libmtp-common
Version: 1.1.17-2
Severity: important
See my original bug report on Ubuntu:
https://bugs.launchpad.net/bugs/1863239
Hi,
When testing HPLIP I found out that CUPS backends can access my printer
only when they are running as root, when they are running as the special
user lp, as it is usually the case, they cannot access the printer.
So I tried to find out why and saw that the /dev/bus/usb/*/* device file
for the printer has group ownership "audio" and not "lp":
till@till-x1yoga:~/ubuntu/hplip/focal/debian/hplip-3.19.12+dfsg0$ ll
/dev/bus/usb/*/*
crw-rw-r-- 1 root root 189, 0 Feb 11 14:17 /dev/bus/usb/001/001
crw-rw-r-- 1 root root 189, 2 Feb 11 14:17 /dev/bus/usb/001/003
crw-rw-r-- 1 root root 189, 3 Feb 11 14:17 /dev/bus/usb/001/004
crw-rw-r-- 1 root plugdev 189, 4 Feb 14 12:23 /dev/bus/usb/001/005
crw-rw-r-- 1 root root 189, 5 Feb 11 14:17 /dev/bus/usb/001/006
crw-rw----+ 1 root audio 189, 62 Feb 14 12:37 /dev/bus/usb/001/063
crw-rw-r-- 1 root root 189, 128 Feb 11 14:17 /dev/bus/usb/002/001
crw-rw-r-- 1 root root 189, 130 Feb 13 09:38 /dev/bus/usb/002/003
till@till-x1yoga:~/ubuntu/hplip/focal/debian/hplip-3.19.12+dfsg0$
The printer is the device /dev/bus/usb/001/063:
till@till-x1yoga:~/ubuntu/hplip/focal/debian/hplip-3.19.12+dfsg0$ lsusb
Bus 002 Device 003: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit
Ethernet
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 138a:0097 Validity Sensors, Inc.
Bus 001 Device 004: ID 04f2:b5ce Chicony Electronics Co., Ltd Integrated
Camera
Bus 001 Device 003: ID 8087:0a2b Intel Corp.
Bus 001 Device 006: ID 056a:50b7 Wacom Co., Ltd Pen and multitouch sensor
Bus 001 Device 063: ID 03f0:7a12 HP, Inc HP OfficeJet Pro 8730
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
till@till-x1yoga:~/ubuntu/hplip/focal/debian/hplip-3.19.12+dfsg0$
This turned out to be a bug in the UDEV rules.
The file /lib/udev/rules.d/69-libmtp.rules of the libmtp-common assigns
"audio" group ownership to devices which are supposed to be audio or
video players and allow uploading files to them via USB using the MTP
protocol.
First it includes some devices explicitly and then it lists thousands of
supported devices. In the end there is some rule for passing a wide
range of devices through an auto-probing:
---------
# Autoprobe vendor-specific, communication and PTP devices
ENV{ID_MTP_DEVICE}!="1", ENV{MTP_NO_PROBE}!="1",
ENV{COLOR_MEASUREMENT_DEVICE}!="1", ENV{ID_GPHOTO}!="1",
ENV{libsane_matched}!="yes", ATTR{bDeviceClass}=="00|02|06|ef|ff",
PROGRAM="mtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}",
RESULT=="1", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio",
ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
---------
And this auto-probing tests positive on my printer:
till@till-x1yoga:~$ /lib/udev/mtp-probe
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1 001 063
1
till@till-x1yoga:~$
Path taken from the output of "sudo udevadm monitor -e", blob with
"ID_MEDIA_PLAYER" in it.
The device path of the printer I have taken from the blob in the udevadm
output (attached to previous comment) which also contains
"ID_MEDIA_PLAYER=1". So mtp-probe identifies my printer as a media
player and assigns the device file to the "audio" group.
I assume that this happens to most or even all HP printers, so an
exclusion of only my device via Vendor and Product ID would not be the
correct solution.
There was already a measure against wrongly identifying HP printers as
media players, but it is a rather dirty workaround which does not work
any more (therefore this bug). The rule in the end of 69-libmtp.rules
checks the absence of the env variable libsane_matched and this variable
is set for all HP printers by HPLIP. First, this rule fails miserably if
HPLIP is not installed, and I cannot imagine that the libmtp package
depends on HPLIP only to identify unsupported devices. Also the libmtp
rules are applied for both "add" and "bind" actions, whereas the rules
of HPLIP (56-hpmud.rules) are only applied for "add" and so the bug
happens on a "bind" action, here the HPLIP rules do not set said env
variable and so the libmtp rules probe the HP printers.
One can theoretically work around this problem by mucking with the UDEV
rules of HPLIP, but this is a REALLY DIRTY workaround, so please DO NOT
add an hplip task to this bug report.
In addition, HPLIP will not be installed by default any more in the not
too far future, as prnting and scanning will get snapped. Also we want
printer driver Snaps (Printer Applications) not to run as root if
possible, so we need to be sure that USB printer device files always
belong to the group "lp" for all printer manufacturers and without HPLIP.
This patch would fix the bug:
----------
--- /lib/udev/rules.d/69-libmtp.rules~ 2020-02-11 13:06:23.000000000 +0100
+++ /lib/udev/rules.d/69-libmtp.rules 2020-03-19 21:01:48.696689026 +0100
@@ -26,6 +26,10 @@
ATTR{idVendor}=="0471", ATTR{idProduct}=="083f", GOTO="libmtp_rules_end"
# DUALi NFC readers
ATTR{idVendor}=="1db2", ATTR{idProduct}=="060*", GOTO="libmtp_rules_end"
+# HP printers
+ATTR{idVendor}=="03f0", ENV{ID_USB_INTERFACES}=="*:0701??:*|*:ffcc00:",
GOTO="libmtp_rules_end"
+# Printers
+ENV{ID_USB_INTERFACES}=="*:0701??:*", GOTO="libmtp_rules_end"
# Creative ZEN Vision
ATTR{idVendor}=="041e", ATTR{idProduct}=="411f", SYMLINK+="libmtp-%k",
MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
# Creative Portable Media Center
----------
It adds two rules to skip printers. The second skips all kinds of
printers by checking whether the standard interface of a printer is
present in the USB device. The first skips HP printers, it is the same
rule as HPLIP uses. I have added it because it covers a second
interface, which is probably of some weird proprietary HP printer
devices. For my printer the bug goes away with this patch, also with any
one of the two rules commented out.
I think one can assume that there is no printer available which doubles
as a media player.
As the file 69-libmtp.rules is not explicitly contained in the package
but gets generated, the generator needs to get patched. An appropriate
patch is attached.
Could you apply this patch to also fix this bug for Debian and to let
the fixed package get synced in Ubuntu?
Thanks in advance
Till
Description: On UDEV discovery do not let printers get auto-probed
Devices which are not explicitly known as supported by libmtp gwt auto-probed
by mtp-probe. Unfortunately, many devices which are not audio or media players
test positive on the auto-probing and so their USB device files get "audio"
group ownership. making them inaccessible for the sub system which is actually
responsible for them. Therefore there are also rules for skipping some
devices.
.
This patch adds skipping rules for printers, as they have to belong to the
"lp" group for CUPS or Printer Applications to be able to access them. The
extra rule for HP printers covers some weird, proprietary devices from HP,
it is copied from HPLIP
Ubuntu-bug: https://bugs.launchpad.net/bugs/1863239
Author: Till Kamppeter <[email protected]>
--- a/util/mtp-hotplug.c
+++ b/util/mtp-hotplug.c
@@ -163,6 +163,10 @@
printf("ATTR{idVendor}==\"0471\", ATTR{idProduct}==\"083f\", GOTO=\"libmtp_rules_end\"\n");
printf("# DUALi NFC readers\n");
printf("ATTR{idVendor}==\"1db2\", ATTR{idProduct}==\"060*\", GOTO=\"libmtp_rules_end\"\n");
+ printf("# HP printers\n");
+ printf("ATTR{idVendor}==\"03f0\", ENV{ID_USB_INTERFACES}==\"*:0701??:*|*:ffcc00:\", GOTO=\"libmtp_rules_end\"\n");
+ printf("# Printers\n");
+ printf("ENV{ID_USB_INTERFACES}==\"*:0701??:*\", GOTO=\"libmtp_rules_end\"\n");
break;
case style_udev_old:
printf("# UDEV-style hotplug map for libmtp\n");
--- End Message ---
--- Begin Message ---
Source: libmtp
Source-Version: 1.1.17-3
Done: =?utf-8?q?Dylan_A=C3=AFssi?= <[email protected]>
We believe that the bug you reported is fixed in the latest version of
libmtp, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Dylan Aïssi <[email protected]> (supplier of updated libmtp package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Thu, 26 Mar 2020 10:10:17 +0100
Source: libmtp
Architecture: source
Version: 1.1.17-3
Distribution: unstable
Urgency: medium
Maintainer: Alessio Treglia <[email protected]>
Changed-By: Dylan Aïssi <[email protected]>
Closes: 954885
Changes:
libmtp (1.1.17-3) unstable; urgency=medium
.
* Add patch to do not let printers get auto-probed.
Thanks to Till Kamppeter. (Closes: #954885, LP: #1863239)
Checksums-Sha1:
52f6aa88d1c41b18364040dec4e8767dd422ac6f 2243 libmtp_1.1.17-3.dsc
327d32867cefa6a0a4122b6cfaf63cb08dde2074 21408 libmtp_1.1.17-3.debian.tar.xz
e7d07f82155dc9e9cd657334ad795966c710d7c7 8030 libmtp_1.1.17-3_amd64.buildinfo
Checksums-Sha256:
9d70e24bad505a76d32c4ce0160381a6e8ae1caaaffe42d959288ddcad6a33cb 2243
libmtp_1.1.17-3.dsc
b436583d0cb7ea0d8c3de3c6238d368a80441447626d8882ec3c73e053f93411 21408
libmtp_1.1.17-3.debian.tar.xz
a0b46d0ddf04fa4aa725c086631b1f8ad503d7f358ab37c8534c829e2194ddfa 8030
libmtp_1.1.17-3_amd64.buildinfo
Files:
b3bd4a5ad69e25dcdabc5ae1ede766f3 2243 libs optional libmtp_1.1.17-3.dsc
12b839276bf2c089101ce8770e0dc193 21408 libs optional
libmtp_1.1.17-3.debian.tar.xz
c4d318f79caeeeb3cb9061c4957d63f3 8030 libs optional
libmtp_1.1.17-3_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEmjwHvQbeL0FugTpdYS7xYT4FD1QFAl58dGMACgkQYS7xYT4F
D1RCCg//W/YX9au/f5IRjtSTVY5947pE66xw9leHbo03Yl18N3Vm6dQwF0zouLyK
UAJvVsWLOg8zxJnNxXCw7iOnEpS2apN7X6/Nq1PKdCNdumcRGTFemZ5leos3MWRJ
cBkqlbR+i7hzR2VFo7GKjsDzuQi6s6U96JE57JOVtU8imI7dPlx520uNCVymBYgO
ibO50g166U85X9weDWNxP+VFMx9aRL6UOy+37Fw9YYMj0FtuHzuMNmwYfp1/o+vW
1cLX9q75vpCtZz7k6/Nw+Z4di7MfY3xHdj9qeX5YO4jMZRu03PUtqkRmYXHcU0kQ
X8AyhXRBs+r36xrpd2ZkVV+BwdfF0EP/4lox7GmwvN0fQkLqkWtmwQKliezLyVqL
Bhq5WzrepcoFdY+pu9FeXCqF0xykyZ64jgir7xRwbRniYKzetlruhcT+NRyJl2Ev
G8WruAkN6RKePzYQ+fE5LD/P2Aq4FOc2ikLUmXJRdwUmoDv2+EzMz4iPnZ/eiWqH
OMFetNrzZQ2J+RRaSJ2GzOB6uGMHuBXn/ZUq3iNlgTBYAh7w/cCNQKGfqkaZb3mq
R5VezzdOXti6/8092tuqf0UGfprRCZYsuZxZVpMXeALHNzfHpSBGPUILjIubwRCa
U13EiWsSfOSlCvHgDx/AIHE2awV+Ihi8pX+nf0tAyZLqYXWnk1k=
=JEwj
-----END PGP SIGNATURE-----
--- End Message ---