Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 316909 - media-gfx/sane-backends - 70-libsane.rules interferes with hplip udev rules
Summary: media-gfx/sane-backends - 70-libsane.rules interferes with hplip udev rules
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Patrick Kursawe (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-24 12:41 UTC by Daniel Pielmeier
Modified: 2010-05-11 20:34 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
70-libsane.rules renamed to 39-libsane.rules (39-libsane.rules,91.60 KB, text/plain)
2010-05-06 06:15 UTC, Damien John-Alan Sticklen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Pielmeier gentoo-dev 2010-04-24 12:41:24 UTC
Sane-backends installs libsane.rules as 70-libsane.rules so it is processed by udev after 40-hplip.rules or 55-hpmud.rules which are provided by hplip. The hplip rule sets the group of the usb device to lp afterwards the sane rule changes it's group to scanner. This causes problems for hplip's usb all-in-one devices as the owner needs to be lp in order to print and scan.

I took a look at the sane rules but found nothing obvious which could cause the permission change as no rule seems to match. I am not an udev expert thus I CC'ed udev-bugs.

This bug is somehow related to bug #197726, where the hplip permissions were overwritten by 65-permissions.rules from udev (changing the group from lp to usb). This file is not installed by udev anymore so I removed 70-hplip.rules (which zzam attached to this bug) from the hplip ebuild. Now a similar conflict occurs again with sane-backends.

Re-adding this file will probably fix this again but it seems more a problem with the sane-backends rule file which should not mess with the rules set by hplip.
Comment 1 Damien John-Alan Sticklen 2010-04-26 00:20:15 UTC
After a bit of messing around I have the following:

In my home directory I can write to a 0664 file which is in the scanner
group
I can write to a file with the same permissions in /dev/bus/usb/005,
however it does not have the c prefix in the stickybits like the device
files do.
I am definitely in the scanner group
I am definitely in the lp group
I cannot print when /dev/bus/usb/005/005 is in the scanner group
I can print when /dev/bus/usb/005/005 is in the lp group.
I can print when /dev/bus/usb/005/005 is set to chmod a+rwx

Confounding I know...by me being in the scanner group, I would have
thought this would allow me to write to the device if its sticky bits
are set to 0664, and the file was in the scanner group.  This is however not the case.  This makes me think that any edit to /etc/udev/rules.d/xx-libsane.rules is simply a workaround.  I am thinking the bug is in HPLIP.

Thanks

ubiquitous1980
Comment 2 Daniel Pielmeier gentoo-dev 2010-04-26 16:17:36 UTC
Some more information from the gentoo-user thread where this all started. the complete thread is at [1].


> I have found the line which is at fault in xx-libsane.rules.  Problem
> is, what we are doing is a work around:
> 
> # Hewlett-Packard Photosmart C5100 series
> ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="5811", MODE="0664",
> GROUP="lp", ENV$
> 
> I have changed the group to lp from scanner so that I could maintain the
> file number.  Problem is, if we have MODE="0664", those in the scanner
> group should be able to access the printer.  Do you think this suggests
> a deeper bug?  I created a testfile in my home directory with stickybits
> set to 0664.  I then set ownership to root:scanner.  Of course, I could
> edit the file, as I am in the scanner group.  This makes me wonder why
> the rules did not apply in /dev/bus/usb/005/005 when this file was set
> to 0664 and group to scanner.  I know for sure that the group was
> scanner, but I cannot be sure that the file was truly set to 0664.
> 
> For now I have the intra-config file workaround.  I will see if I can
> mess with things a bit to get things working.


Here follows my answer to this post, which I already sent to the mailing list. Now I recognized that I sent it from the wrong mail-account so it did not go through:

> I have found the line which is at fault in xx-libsane.rules.  Problem
> is, what we are doing is a work around:
> 
> # Hewlett-Packard Photosmart C5100 series
> ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="5811", MODE="0664",
> GROUP="lp", ENV$

I do not have such a line in my 70-libsane.rules. Problem is that this file is
generated at compile-time so it probably detects your C5180 when sane-backends
are installed.

Can you attach your 70-libsane.rules.

Can you also try to unplug your C5180 (power und usb), recompile sane-backends
and see if you still have this line in 70-libsane.rules.

I don't think this is a hplip bug. 70-libsane.rules is auto-generated at
compile-time. It is called libsane.rules. The ebuild installs it under the name
70-libsane.rules. So the problem is either the number of libsane.rules is to
high or even better the automatic detection should not mess with HP All-in-one
products at all. If the number is lower or there is no line in the rules
matching your product the device will finally be in the lp group. If I remember
right you are able to print and scan if the device group is lp.


[1] http://archives.gentoo.org/gentoo-user/msg_ae72c4933459ff1096654fe664a50f96.xml
Comment 3 Damien John-Alan Sticklen 2010-05-06 06:15:57 UTC
Created attachment 230559 [details]
70-libsane.rules renamed to 39-libsane.rules

Sorry I am late.  Have been plenty busy with Uni.
Comment 4 Patrick Kursawe (RETIRED) gentoo-dev 2010-05-11 19:45:14 UTC
Since I would prefer not to mess with the SANE udev rules generator if I can avoid it, I have renamed the rules file as you suggested in sane-backends-1.0.21.
If this is a hplip bug: Printing team, do you want to take this one?
Comment 5 Daniel Pielmeier gentoo-dev 2010-05-11 20:11:22 UTC
(In reply to comment #3)
> Created an attachment (id=230559) [details]
> 70-libsane.rules renamed to 39-libsane.rules
> 
> Sorry I am late.  Have been plenty busy with Uni.
> 

Okay I was not able to see the rules which are causing this because I just did a "./configure && make && make install" and took a look at the rules file it generated. After installing sane-backends from the ebuild without setting a specific backend I get exactly the same rules file as yours with the entries for the hplip products which are overwriting the hplip rule file with wrong device permissions.
Comment 6 Daniel Pielmeier gentoo-dev 2010-05-11 20:15:39 UTC
(In reply to comment #4)
> Since I would prefer not to mess with the SANE udev rules generator if I can
> avoid it, I have renamed the rules file as you suggested in
> sane-backends-1.0.21.
> If this is a hplip bug: Printing team, do you want to take this one?
> 

Patrick thanks for the fix. Btw, I am pretty much the sole hplip maintainer.

I think it is a sane-backends bug as it should not mess with HP All-In-One devices, because the hplip rules files take care of it. The only drawback I could think of is if someone wants to use a HP product which is able to scan without the hplip package if this is possible but I guess this is a corner case.

But as sane-backends does not give any number to the libsane.rules file I think it is up to the packager to install it with a proper number so it fits into the distribution. This is what you already did. When looking at this bug from that perspective I would call the bug already fixed.
Comment 7 Patrick Kursawe (RETIRED) gentoo-dev 2010-05-11 20:34:41 UTC
Well... why not? Please re-open if you don't agree.