Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 161254 - Scanner only recognized as Root
Summary: Scanner only recognized as Root
Alias: None
Product: Fedora
Classification: Fedora
Component: udev
Version: 4
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
: 143313 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2005-06-21 19:21 UTC by Jerry Barrington
Modified: 2007-11-30 22:11 UTC (History)
4 users (show)

Fixed In Version: 095
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-01-13 19:47:02 UTC

Attachments (Terms of Use)

Description Jerry Barrington 2005-06-21 19:21:38 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.0.4-1.3.1 Firefox/1.0.4

Description of problem:
Logging in as Root, the Microtek E3 scanner in hardware browser and is recognized by sane-find-scanner. It is functional in OpenOffice and even in xsane with gimp.

Logged in as user, it is not recognized with sane-find-scanner and not usable in OpenOffice or xsane.

This same scanner works well in FC3.  All hardware is the same and no settings are changed.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Log in as user sane-find-scanner

Actual Results:  Sane-find scanner reports no scsi scanner found.

Expected Results:  Sane-find-scanner should report scanner found as sg0.

Additional info:

This computer runs multiple operating systems via swappable hard drive bay.
The scanner is a Microtek E3 - old but reliable - and scsi connected to an
Adaptec 2906 using the external connector.

Comment 1 Jerry Barrington 2005-06-22 04:04:43 UTC
Further testing and information:

I did a bad thing and inserted the following lines from
into /etc/udev/rules.d/50-udev.rules:

# scanner devices

I then have to boot up with the scanner power off to remove any reference to it.
Then shutdown the computer, turn on the scanner, boot up and log in as user.
sane-find-scanner then recognizes the scanner as device sg0.

These steps must be repeated with each boot up as the scanner is lost each shutdown.

Really confusing!!!

Comment 2 Jerry Barrington 2005-06-22 19:02:03 UTC
With further testing, I found that the three lines added to the file have no
effect and were removed.
However, the startup procedure stated above is required at every power on boot
up of restart of the system.
I guess I can live with that.  Now, if I could get the Num Lock to come on at
startup . . .

Comment 3 Harald Hoyer 2005-06-23 07:29:38 UTC
Try to load the "sg" module in e.g. rc.local..

Comment 4 Jerry Barrington 2005-06-23 14:30:06 UTC
Thanks, I tried that suggestion and no joy.  It still loses the scanner without
the special procedure.

The link /dev/scanner linked to /dev/sg0 is not created normally without that
procedure.  Creating /dev/scanner manually revives the scanner for both root and

I am learning more about Linux than I ever thought I wanted to.

Comment 5 Harald Hoyer 2005-06-23 16:09:34 UTC
It seems that there is no hotplug event, if you switch on your scanner.
The scsi driver should send a hotplug event.
Try to set in /etc/sysconfig/hotplug:

and look in /var/log/messages for udev and hotplug messages, if you switch on
your scanner, while the system is up.

Comment 6 Jerry Barrington 2005-06-24 06:40:14 UTC
OK.  There is no file /etc/sysconfig/hotplug.  I found
/etc/hotplug/hotplug.functions with the line   # DEBUG="yes"   and unremmed that.
This generates the following sequence or similar many tines in /var/log/messages:

Jun 23 12:39:53 BeeHive default.hotplug[2668]: no runnable
/etc/hotplug/block.agent is installed
Jun 23 12:39:53 BeeHive default.hotplug[2677]: arguments (scsi_generic) env
(PHYSDEVPATH=/devices/platform/host1/target1:0:6/1:0:6:0 SUBSYSTEM=scsi_generic
OLDPWD=/ DEVPATH=/class/scsi_generic/sg1 MINOR=1
PATH=/bin:/sbin:/usr/sbin:/usr/bin ACTION=add PWD=/etc/hotplug UDEV_LOG=3
Jun 23 12:39:53 BeeHive default.hotplug[2705]: arguments (vc) env (SUBSYSTEM=vc
OLDPWD=/ DEVPATH=/class/vc/vcs2 MINOR=2 PATH=/bin:/sbin:/usr/sbin:/usr/bin
DEVNAME=/dev/vcs2 SHLVL=1 HOME=/ DEBUG=yes SEQNUM=457 _=/bin/env)
Jun 23 12:39:54 BeeHive default.hotplug[2705]: no runnable /etc/hotplug/vc.agent
is installed

After following the bootup procedure to get the scanner recognized,
sane-find-scanner shows two lines:

Found SCSI Scanner "Scanner 1.80" at dev /dev/scanner
Found SCSI Scanner "Scanner 1.80" at dev /dev/sg0

Switching the scanner off removes both lines and switching on again returns them.

I have no USB devices connected.  Could something not be installed that is
needed for the SCSI scanner to be detected properly?

Comment 7 Harald Hoyer 2005-06-24 08:21:42 UTC
hmm... DEVNAME=/dev/sg1 .... maybe sane-find-scanner looks for /dev/sg0, and if
none found, gives up... and misses /dev/sg1 ...

Is this sg1 every time, you switch on your scanner, after booting up the PC?

Comment 8 Jerry Barrington 2005-06-26 16:14:54 UTC
/dev/sg0 and /dev/sg1 are present after each bootup or reboot if the scanner is
powered up at that time.  /dev/scanner is present only the first time but is
absent after reboot even if the scanner is left powered up.

I checked bug #143313 and got a clue there.  I created a new file named

# permissions for SCSI sg devices and scanner

KERNEL=="sg0", BUS=="scsi", 	SYMLINK="scanner%e"
# KERNEL=="sg[0-9]", BUS=="scsi", 	SYMLINK="scanner%e"

The first lines creates the /dev/scanner sym link at every reboot if the scanner
is on.  The second line unremmed creates /dev/scanner1 and /dev/scanner2.

This can instead be added to 50-udev.rules by inserting:

KERNEL=="device-mapper",	NAME="mapper/control"

# old compat symlinks with enumeration
KERNEL=="sr[0-9]*",		SYMLINK="cdrom%e"
KERNEL=="scd[0-9]*",		SYMLINK="cdrom%e"
KERNEL=="pcd[0-9]*",		SYMLINK="cdrom%e"
KERNEL=="fd[0-9]*",		SYMLINK="floppy%e"
KERNEL=="nst[0-9]", BUS=="scsi", 	SYMLINK="tape%e"
KERNEL=="nosst[0-9]", BUS=="scsi", 	SYMLINK="tape%e"

KERNEL=="sg[0-9]", BUS=="scsi", 	SYMLINK="scanner%e"

KERNEL=="umad*", 		NAME="infiniband/%k"
KERNEL=="issm*", 		NAME="infiniband/%k"

# Section for zaptel device

This solves the problem nicely.  The scanner can be switched off and on with no

Comment 9 Harald Hoyer 2005-06-27 07:43:20 UTC
we have to refine the rule, because "sg" could be "any scsi device"..
Does this rule work??
BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k",
SYMLINK="scanner%e", MODE="0660"

Comment 10 Jerry Barrington 2005-06-27 18:12:21 UTC
Great.  I now have /dev/sg0 and /dev/scanner only.  This is diffrent than the
suggestion in bug 143313, which didn't work.  I see the difference.  I guess the
one I did worked since the scanner is my only scsi device.

Thanks for the help.

Comment 11 D. Hugh Redelmeier 2005-08-14 15:06:26 UTC
[Please see the thread starting with]

RED HAT: please add the lines suggested below to /etc/udev/rules.d/50-udev.rules

There seem to be two problems:
(1) getting /dev/sg0 (or whatever) owned by the userid logged into the console
so that that userid can access the scanner
(2) recognizing the scanner in the case that it is turned on after boot.

Problem (1) is partly handled by console.perms(5).  If there is a /dev/scannerN,
it will be chowned at login to the console userid.  How can we get /dev/scannerN
created?  See udev(8).  There need to be some additional rules in
/etc/udev/rules.d for scanners.  Here are two that I think should be standard
issue (i.e. done by Red Hat, not the end user).

BUS="scsi", SYSFS{vendor}="HP*", SYSFS{model}="C2520A*", SYMLINK="scanner%n"
BUS="scsi", SYSFS{vendor}="UMAX*", SYSFS{model}="Astra*", SYMLINK="scanner%n"

Problem (2) requires work that I haven't tried to figure out.  In my particular
setup, the following command, issued by the superuser, gets the system to notice
the scanner when it is turned on some time after boot:
      echo 'scsi add-single-device 0 0 5 0' >/proc/scsi/scsi
                                         ^ LUN
                                       ^ SCSI ID
                                     ^ host adapter channel
                                   ^ host adapter
This is not very elegant.  Contrary to the documentation in proc(5), this
command seems to rescan all scsi buses (including USB buses).

Comment 12 Harald Hoyer 2005-08-25 10:35:02 UTC
BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k",
SYMLINK="scanner%e", MODE="0660"

should cover your 2 lines.

Comment 13 D. Hugh Redelmeier 2005-08-28 02:22:22 UTC
The line from #12 seems to work and is much more general.

The MODE field does not seem to work as I'd expect:
lrwxrwxrwx  1 root root     3 Aug 27 21:52 /dev/scanner -> sg4
crw-------  1 hugh root 21, 4 Aug 27 21:52 /dev/sg4

I think that this comes from the following line in
<console>  0600 <scanner>    0600 root

The SYSFS{type}="6" is a bit magical.  Where is this 6 documented?  All I've
found is table 21 on page 35 of
[SCSI-3 primary commands].  It would be good if there is documentation that can
easily be found starting from the udev(8) manpage.

Comment 14 Harald Hoyer 2005-08-29 11:17:43 UTC
$ fgrep TYPE_ /usr/include/scsi/scsi.h
#define TYPE_DISK           0x00
#define TYPE_TAPE           0x01
#define TYPE_PROCESSOR      0x03    /* HP scanners use this */
#define TYPE_WORM           0x04    /* Treated as ROM by our system */
#define TYPE_ROM            0x05
#define TYPE_SCANNER        0x06
#define TYPE_MOD            0x07    /* Magneto-optical disk -
                                     * - treated as TYPE_DISK */
#define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
#define TYPE_NO_LUN         0x7f

If you don't like the permissions in
/etc/security/console.perms.d/50-default.perms just define new ones in a
seperate file in /etc/security/console.perms.d/

Comment 15 Phil Cole 2005-09-21 23:30:11 UTC
Thanks to all that have contributed to this bug.  Very useful.  To get my Epson
Perfection 1200S (using the aic7xxx kernel module) working on FC4 I needed to
alter the line in comment #12 to include scsi type 3. i.e. 

BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="[36]", NAME="%k",
SYMLINK="scanner%e", MODE="0660"

Comment 16 John Thacker 2007-01-13 19:43:00 UTC
*** Bug 143313 has been marked as a duplicate of this bug. ***

Comment 17 John Thacker 2007-01-13 19:47:02 UTC
This is fixed in the current version of udev, as the line mentioned above is
correctly included.  Seems like this bug never got closed.  Closing now.

Note You need to log in before you can comment on or make changes to this bug.