Bug 9023

Summary: sane and SCSI scanners, missing udev rule
Product: Mageia Reporter: Olivier LE ROY <olivier_le_roy>
Component: RPM PackagesAssignee: Colin Guthrie <mageia>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: Normal CC: lists.jjorge, olivier_le_roy, thierry.vignaud, tmb, wrw105, yann.cantin
Version: Cauldron   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: MGA4TOO MGA5TOO
Source RPM: systemd-195-15.mga3.src.rpm CVE:
Status comment:
Attachments: systemd.spec (mga5) : add /usr/lib/modules-load.d/sg.conf

Description Olivier LE ROY 2013-02-10 09:30:55 CET
Description of problem:

$ cat /proc/scsi/scsi 
Attached devices:
                       
  Vendor: AGFA     Model: SnapScan         Rev: 1.40
  Type:   Scanner                          ANSI  SCSI revision: 02

$ sane-find-scanner 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

problem fixed if issuing, as root:
# modprobe sg

$ sane-find-scanner 

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

found SCSI scanner "AGFA SnapScan 1.40" at /dev/sg3
  # Your SCSI scanner was detected. It may or may not be supported by SANE. Try
  # scanimage -L and read the backend's manpage.

And scanner is found and usable in gimp.
Comment 1 Olivier LE ROY 2013-02-10 09:35:06 CET
May be a duplicate of Bug 3698
	
But as this bug is related to SCSI rather than USB, maybe opening a new bug is correct.

CC: (none) => olivier_le_roy
Target Milestone: --- => Mageia 3

Manuel Hiebel 2013-02-10 13:49:14 CET

CC: (none) => thierry.vignaud
Assignee: bugsquad => mageia

Comment 2 Colin Guthrie 2013-02-10 14:06:11 CET
Is it really a missing udev rule? Isn't it more that the sg module is simply not loaded automatically on boot?
Comment 3 Olivier LE ROY 2013-02-10 15:31:56 CET
On a second computer, with "Mageia 2" rather than "cauldron", the sg driver is not loaded at boot automatically.

# lsmod | grep sg returns nothing after boot.

sane used to recognize my SCSI scanner on my first computer with Mageia 2, without issuing manually "modprobe sg".
Comment 4 Bill Wilkinson 2013-06-03 17:32:53 CEST
*** Bug 10377 has been marked as a duplicate of this bug. ***

CC: (none) => wrw105

Comment 5 Bill Wilkinson 2013-06-03 18:11:46 CEST
I've got a second install of mga2 on a system with mga3.  lsmod is showing sg as loaded at startup in mga2.  It is not loaded at startup in mga3.
Comment 6 Samuel Verschelde 2015-05-17 21:35:55 CEST
Is this still valid in Mageia 4 & 5?

Keywords: (none) => NEEDINFO

Comment 7 Olivier LE ROY 2015-05-17 21:59:20 CEST
It is still valid in Mageia 4 & 5.

I use to add the scanner manually, but I can't figure out if it is actually a missing udev rule, because there was no such rule in Mageia 1.

For tests purposes, the machine with the SCSI scanner on which I can reproduce, I will only have it in 2 weeks time.

Therefore I won't be able to test a fix before 2 weeks time.
Samuel Verschelde 2015-05-17 23:41:52 CEST

Whiteboard: (none) => MGA4TOO MGA5TOO
Keywords: NEEDINFO => (none)
Target Milestone: Mageia 3 => ---

Comment 8 Yann Cantin 2015-08-01 21:34:04 CEST
*** Bug 16306 has been marked as a duplicate of this bug. ***

CC: (none) => yann.cantin

Comment 9 Yann Cantin 2015-08-01 21:55:40 CEST
See https://bugzilla.novell.com/show_bug.cgi?id=761109

Actual openSUSE fix is adding /usr/lib/modules-load.d/sg.conf in systemd package to autoload the sg module at boot time :

systemd.spec, %install :

# create %{_libexecdir}/modules-load.d
mkdir -p %{buildroot}%{_libexecdir}/modules-load.d
cat << EOF > %{buildroot}%{_libexecdir}/modules-load.d/sg.conf
# load sg module at boot time
sg
EOF
Comment 10 Yann Cantin 2015-08-01 23:09:15 CEST
Created attachment 6880 [details]
systemd.spec (mga5) : add /usr/lib/modules-load.d/sg.conf
Comment 11 Colin Guthrie 2015-08-02 17:26:23 CEST
Hmm, looks like a bad way to fix it. The module should be loaded automatically when the h/w is detected. Using module-load.d/ is really a nasty hack...  :(
Comment 12 Yann Cantin 2015-08-02 22:59:23 CEST
Problem is : sg is not related to any hardware, so no kernel autoloading.

Actual fix is adding sg to /etc/modprobe.preload or any other boot-time module loading conf file, same difference...

Another fix (used before by opensuse) could be to add that to udev/rules.d/80-drivers.rules :

SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", IMPORT{builtin}="kmod load sg"

Pro : inserted when needed
Con : false positive (but doesn't hurt), maybe a race condition until the first loading complete.
Comment 13 Colin Guthrie 2015-08-03 11:13:48 CEST
Hmm, I wonder then if it's something that should just be compiled into the kernel (i.e. not as a model)?

I mean if the fix is to always load it, then why not just keep it loaded...

Thomas, what do you think? What would you prefer? Bake it in or have a userspace tool always load the module?

CC: (none) => tmb

Comment 14 Samuel Verschelde 2015-09-11 09:50:37 CEST
CCing new sane maintainer.

CC: (none) => lists.jjorge

Comment 15 José Jorge 2019-10-19 08:48:23 CEST
This bug has slept for years, and SCSI has mostly disappeared... closing.

Resolution: (none) => WONTFIX
Status: NEW => RESOLVED