Can not scan as user

Bug #1890464 reported by antoine
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sane-backends (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

# Description

I can not scan as user using software like simple-scan or xsane.
If I run xsane and simple-scan with sudo, I can use my scanner.

It seems to be a permission issue

# Step to reproduce

1. Start xsane or simple-scan as user
2. xsane and simple-scan fail to scan, "device is not connected"
3. Start xsane or simple-scan with sudo
4. It works, you can scan

# Infos

xubuntu 20.04
HP Deskjet 2540 All-in-One Printer

antoine@Talos:~$ apt show sane-utils
Package: sane-utils
Version: 1.0.29-0ubuntu5

antoine@Talos:~$ apt show libsane
Package: libsane
Version: 1.0.29-0ubuntu5

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1890464/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Paul White (paulw2u)
affects: ubuntu → sane-backends (Ubuntu)
tags: added: focal
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Try to add yourself to the lp group:

sudo adduser $USER lp

and let us know if it helps.

Changed in sane-backends (Ubuntu):
status: New → Incomplete
Revision history for this message
antoine (antoine-) wrote :

Thank you

I added myself in the lp group

antoine@Talos:~$ groups antoine
antoine : antoine adm cdrom sudo dip plugdev lpadmin lxd sambashare
antoine@Talos:~$ sudo adduser $USER lp
[sudo] Mot de passe de antoine :
Ajout de l'utilisateur « antoine » au groupe « lp »...
Ajout de l'utilisateur antoine au groupe lp
Fait.
antoine@Talos:~$ groups antoine
antoine : antoine adm lp cdrom sudo dip plugdev lpadmin lxd sambashare
antoine@Talos:~$

then I tried simple-scan and it is working

This issue is fixed for me, I do not know why I was not in the lp group

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Great! I suspected that was it because I need to do the same for my own scanner.

Not sure whether this obstacle is a bug which can be fixed. Keeping the bug open for now.

Changed in sane-backends (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
David Ward (dpward) wrote (last edit ):

Please see the "SETUP" section of /usr/share/libsane1/doc/README.Debian.gz. You must either be logged into a physical console on the system (not an SSH/VNC session) - or if you want to bypass that requirement, you must add the user to the "scanner" group. This is expected behavior.

(Adding the user to the "lp" group happens to work because your device is also a printer - but that's technically not the right answer for scanning.)

If this issue occurs when you are _physically_ logged in, please change the status back to Confirmed.

Changed in sane-backends (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
antoine (antoine-) wrote :

I am not sure about what you mean by physically logged.
I am not using ssh or vnc, I was using xubuntu on a personal computer so I guess I was physically logged.

As you can see in my previous message, I was not in the scanner group neither and I do not know why.

Changed in sane-backends (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
David Ward (dpward) wrote :

Yes, that is what I meant by physically logged in.

You shouldn't need to be in the scanner group (or the lp group) in that case.

If you remove yourself from both of those groups, does this stop working? If so, what is the output of "sudo scanimage -L"?

Revision history for this message
antoine (antoine-) wrote :

I am not using xubuntu 20.04 now, I switch to another linux distro recently, so I can not give you the output you are looking for.
All I can say is that adding myself in the lp group solved the issue

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2022-03-12 14:32, David Ward wrote:
> Yes, that is what I meant by physically logged in.
>
> You shouldn't need to be in the scanner group (or the lp group) in
> that case.

The lp group still (21.10) makes a difference for my combined printer and scanner.

$ lsusb | grep Brother
Bus 001 Device 004: ID 04f9:01ab Brother Industries, Ltd MFC-240C
$ ls -l /dev/bus/usb/001/004
crw-rw-r-- 1 root lp 189, 3 mar 12 11:01 /dev/bus/usb/001/004

> If you remove yourself from both of those groups, does this stop
> working?

Yes, both simple-scan and xsane stop working; please see attached screenshots.

> If so, what is the output of "sudo scanimage -L"?

"scanimage -L" keeps working without the lp group (also without sudo) but apparently there is more into it.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :
Revision history for this message
David Ward (dpward) wrote (last edit ):

Assuming you are not in the lp or scanner groups, what happens if you try to use scanimage to scan an image? (See "scanimage --help" for syntax, and use the device name that appears when you run "scanimage -L".)

If that doesn't work, can you add the --verbose flag to scanimage, and attach the output here?

Revision history for this message
David Ward (dpward) wrote :

Actually, here's a better question first. Take yourself out of the lp and scanner groups. What do you see when you run:

$ getfacl /dev/bus/usb/001/004

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

$ getfacl /dev/bus/usb/001/004
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/004
# owner: root
# group: lp
user::rw-
group::rw-
other::r--

That reminds me of an alternative way:

sudo chmod o+w /dev/bus/usb/001/004

The problem with that (if I remember correctly) is that the position of the scanner may change if other USB devices are added or removed. And it's still not working out of the box.

I don't seem able to scan using scanimage, whether I'm in the lp group or not or irrespective of file permissions. (Not sure about the proper syntax, though.)

$ scanimage -d brother2:bus4 --format=png --verbose >testimage.png
scanimage: open of device brother2:bus4 failed: Invalid argument
$ scanimage -d 'brother2:bus4;dev3' --format=png --verbose >testimage.png
scanimage: open of device brother2:bus4;dev3 failed: Invalid argument
$ scanimage -d brother2:/dev/bus/usb/001/004 --format=png --verbose >testimage.png
scanimage: open of device brother2:/dev/bus/usb/001/004 failed: Invalid argument

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.