tries to access SCSI hard-drive (sg0) when supposed to be writing to /dev/sg1

Bug #42470 reported by jes.vestervang
12
Affects Status Importance Assigned to Milestone
k3b (Ubuntu)
Invalid
Low
Unassigned

Bug Description

I have an IBM T43 laptop with a PATA cd-writer (I think) connected to the built-in SATA controller.

crw-rw---- 1 root root 21, 0 2006-05-02 18:36 /dev/sg0
crw-rw---- 1 root cdrom 21, 1 2006-05-02 18:36 /dev/sg1
brw-rw---- 1 root cdrom 11, 0 2006-05-02 18:36 /dev/scd0

The sg0 seems to be my hard drive:
root@padden:~# scsi_info /dev/sg0
SCSI_ID="0,0,0"
HOST="0"
MODEL="ATA HTS541060G9AT00"
FW_REV="MB3I"
root@padden:~# scsi_info /dev/sg1
SCSI_ID="0,0,0"
HOST="1"
MODEL="HL-DT-ST RW/DVD GCC-4242N"
FW_REV="0201"
root@padden:~#

What confused me was that K3b somehow needs access to sg0 (my hard
drive) which I didn't know what represented until now. Maybe it's a
bug in K3b or cdrecord. Here's some debug info from k3b:
HL-DT-ST RW/DVD GCC-4242N 0201 (/dev/scd0, /dev/sg1) at /media/cdrom0
[CD-R; CD-RW; CD-ROM; DVD-ROM] [DVD-ROM; CD-ROM; CD-R; CD-RW] [SAO;
TAO; RAW; SAO/R96P; SAO/R96R; RAW/R16; RAW/R96P; RAW/R96R]

Used versions
-----------------------
cdrecord: 2.1.1a01

cdrecord
-----------------------
/usr/bin/X11/cdrecord: Warning: Running on Linux-2.6.15-21-686
/usr/bin/X11/cdrecord: There are unsettled issues with Linux-2.5 and newer.
/usr/bin/X11/cdrecord: If you have unexpected problems, please try
Linux-2.4 or Solaris.
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Text len: 774
Cdrecord-Clone 2.01.01a01 (i686-pc-linux-gnu) Copyright (C) 1995-2004
Joerg Schilling
NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord
      and thus may have bugs that are not present in the original version.
      Please send bug reports and support requests to
<email address hidden>.
      The original author should not be bothered with problems of this version.
TOC Type: 0 = CD-DA
/usr/bin/X11/cdrecord: Permission denied. Cannot open '/dev/sg0'.
Cannot open SCSI driver.
/usr/bin/X11/cdrecord: For possible targets try 'cdrecord -scanbus'.
Make sure you are root.
/usr/bin/X11/cdrecord: For possible transport specifiers try 'cdrecord
dev=help'.
/usr/bin/X11/cdrecord:
/usr/bin/X11/cdrecord: For more information, install the cdrtools-doc
/usr/bin/X11/cdrecord: package and read
/usr/share/doc/cdrecord/README.ATAPI.setup .

cdrecord command:
-----------------------
/usr/bin/X11/cdrecord.mmap -v gracetime=2 dev=1,0,0 speed=2 -dao
driveropts=burnfree textfile=/tmp/kde-jes/k3bUUbbna.dat -eject
-useinfo -audio -shorttrack /tmp/kde-jes/k3b_audio_0_01.inf
/tmp/kde-jes/k3b_audio_0_02.inf /tmp/kde-jes/k3b_audio_0_03.inf
/tmp/kde-jes/k3b_audio_0_04.inf /tmp/kde-jes/k3b_audio_0_05.inf
/tmp/kde-jes/k3b_audio_0_06.inf /tmp/kde-jes/k3b_audio_0_07.inf
/tmp/kde-jes/k3b_audio_0_08.inf /tmp/kde-jes/k3b_audio_0_09.inf
/tmp/kde-jes/k3b_audio_0_10.inf /tmp/kde-jes/k3b_audio_0_11.inf
/tmp/kde-jes/k3b_audio_0_12.inf /tmp/kde-jes/k3b_audio_0_13.inf
/tmp/kde-jes/k3b_audio_0_14.inf /tmp/kde-jes/k3b_audio_0_15.inf

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

This should be covered by the following rule:

    # SCSI devices
    ENV{PHYSDEVBUS}!="scsi", GOTO="scsi_end"
    SYSFS{type}=="1", GROUP="tape"
-> SYSFS{type}=="5", GROUP="cdrom"
    SYSFS{type}=="6", GROUP="scanner"
    SYSFS{type}=="3", SYSFS{vendor}=="HP", GROUP="scanner"
    LABEL="scsi_end"

Could you please attach the output of:

  udevinfo -ap /block/sg0

Thanks

Changed in udev:
assignee: nobody → keybuk
status: Unconfirmed → Needs Info
description: updated
Revision history for this message
jes.vestervang (jes-vestervang) wrote : Re: [Bug 42470] Re: Missing rules for /dev/sg*
Download full text (4.2 KiB)

Hi,

I reversed to the original permissions-rules but it didn't say much:

root@padden:~# udevinfo -ap /block/sg0
couldn't get the class device
root@padden:~#

Here's some additional outputs that may or may not be helpful:
root@padden:~# dmesg|grep sg
[4294683.158000] sd 0:0:0:0: Attached scsi generic sg0 type 0
[4294683.158000] 1:0:0:0: Attached scsi generic sg1 type 5
root@padden:~#

root@padden:~# modinfo sg
filename: /lib/modules/2.6.15-21-686/kernel/drivers/scsi/sg.ko
author: Douglas Gilbert
description: SCSI generic (sg) driver
license: GPL
version: 3.5.33
alias: char-major-21-*
vermagic: 2.6.15-21-686 SMP preempt 686 gcc-4.0
depends: scsi_mod
srcversion: 668B94B03CB4799963D1C2C
parm: allow_dio:allow direct I/O (default: 0 (disallow)) (int)
parm: def_reserved_size:size of buffer reserved for each fd (int)
root@padden:~#

root@padden:~# modinfo scsi_mod
filename: /lib/modules/2.6.15-21-686/kernel/drivers/scsi/scsi_mod.ko
description: SCSI core
license: GPL
vermagic: 2.6.15-21-686 SMP preempt 686 gcc-4.0
depends:
srcversion: 1D8D445D9E52680E756420E
parm: default_dev_flags:scsi default device flag integer value (int)
parm: dev_flags:Given
scsi_dev_flags=vendor:model:flags[,v:m:f] add black/white list entries
for vendor and model with an integer value of flags to the scsi device
info list (string)
parm: inq_timeout:Timeout (in seconds) waiting for devices
to answer INQUIRY. Default is 5. Some non-compliant devices need more.
(int)
parm: max_report_luns:REPORT LUNS maximum number of LUNS
received (should be between 1 and 16384) (int)
parm: max_luns:last scsi LUN (should be between 1 and 2^32-1) (int)
parm: scsi_logging_level:a bit mask of logging levels (int)
root@padden:~#

root@padden:~# lspci|grep IDE
0000:00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA
Controller (rev 03)
root@padden:~#

root@padden:~# cat
/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic:sg0/device/model
HTS541060G9AT00
root@padden:~#
root@padden:~# udevmonitor |grep sg (while restarting udev)
UEVENT[1146585095.340334] add@/class/mem/kmsg
UEVENT[1146585095.343008] add@/class/scsi_generic/sg0
UEVENT[1146585095.343055] add@/class/scsi_generic/sg1
UDEV [1146585095.798234] add@/class/mem/kmsg
UDEV [1146585096.580888] add@/class/scsi_generic/sg0
UDEV [1146585096.590186] add@/class/scsi_generic/sg1

root@padden:~# scsi_info /dev/sg0
SCSI_ID="0,0,0"
HOST="0"
MODEL="ATA HTS541060G9AT00"
FW_REV="MB3I"
root@padden:~# scsi_info /dev/sg1
SCSI_ID="0,0,0"
HOST="1"
MODEL="HL-DT-ST RW/DVD GCC-4242N"
FW_REV="0201"
root@padden:~#

I hope some of it helps :-)

On 5/2/06, Scott James Remnant <email address hidden> wrote:
> This should be covered by the following rule:
>
> # SCSI devices
> ENV{PHYSDEVBUS}!="scsi", GOTO="scsi_end"
> SYSFS{type}=="1", GROUP="tape"
> -> SYSFS{type}=="5", GROUP="cdrom"
> SYSFS{type}=="6", GROUP="scanner"
> SYSFS{type}=="3", SYSFS{vendor}=="HP", GROUP="scanner"
> LABEL=...

Read more...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: /dev/sg* in wrong group (incorrect SCSI class?)

Ah,

udevinfo -ap /class/scsi_generic/sg0

Revision history for this message
jes.vestervang (jes-vestervang) wrote : Re: [Bug 42470] Re: /dev/sg* in wrong group (incorrect SCSI class?)
Download full text (6.1 KiB)

Hi,

I'm sorry, but I think I have wasted your time. It seems that the bug
is not in udev as the devices sg1 and the corresponding scd0 (which I
hadn't noticed before) both have the correct permissions:

crw-rw---- 1 root root 21, 0 2006-05-02 18:36 /dev/sg0
crw-rw---- 1 root cdrom 21, 1 2006-05-02 18:36 /dev/sg1
brw-rw---- 1 root cdrom 11, 0 2006-05-02 18:36 /dev/scd0

The sg0 seems to be my hard drive:
root@padden:~# scsi_info /dev/sg0
SCSI_ID="0,0,0"
HOST="0"
MODEL="ATA HTS541060G9AT00"
FW_REV="MB3I"
root@padden:~# scsi_info /dev/sg1
SCSI_ID="0,0,0"
HOST="1"
MODEL="HL-DT-ST RW/DVD GCC-4242N"
FW_REV="0201"
root@padden:~#

What confused me was that K3b somehow needs access to sg0 (my hard
drive) which I didn't know what represented until now. Maybe it's a
bug in K3b or cdrecord. Here's some debug info from k3b:
HL-DT-ST RW/DVD GCC-4242N 0201 (/dev/scd0, /dev/sg1) at /media/cdrom0
[CD-R; CD-RW; CD-ROM; DVD-ROM] [DVD-ROM; CD-ROM; CD-R; CD-RW] [SAO;
TAO; RAW; SAO/R96P; SAO/R96R; RAW/R16; RAW/R96P; RAW/R96R]

Used versions
-----------------------
cdrecord: 2.1.1a01

cdrecord
-----------------------
/usr/bin/X11/cdrecord: Warning: Running on Linux-2.6.15-21-686
/usr/bin/X11/cdrecord: There are unsettled issues with Linux-2.5 and newer.
/usr/bin/X11/cdrecord: If you have unexpected problems, please try
Linux-2.4 or Solaris.
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Error trying to open /dev/sg0 exclusively (Permission denied)...
retrying in 1 second.
Text len: 774
Cdrecord-Clone 2.01.01a01 (i686-pc-linux-gnu) Copyright (C) 1995-2004
Joerg Schilling
NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord
      and thus may have bugs that are not present in the original version.
      Please send bug reports and support requests to
<email address hidden>.
      The original author should not be bothered with problems of this version.
TOC Type: 0 = CD-DA
/usr/bin/X11/cdrecord: Permission denied. Cannot open '/dev/sg0'.
Cannot open SCSI driver.
/usr/bin/X11/cdrecord: For possible targets try 'cdrecord -scanbus'.
Make sure you are root.
/usr/bin/X11/cdrecord: For possible transport specifiers try 'cdrecord
dev=help'.
/usr/bin/X11/cdrecord:
/usr/bin/X11/cdrecord: For more information, install the cdrtools-doc
/usr/bin/X11/cdrecord: package and read
/usr/share/doc/cdrecord/README.ATAPI.setup .

cdrecord command:
-----------------------
/usr/bin/X11/cd...

Read more...

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Thanks, I didn't think this'd be a udev bug but was good to get that confirmed.

Have reassigned the bug over to k3b for you, which the MOTU will take care of.

description: updated
Changed in udev:
assignee: keybuk → nobody
description: updated
Revision history for this message
Asraniel (asraniel) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for k3b (Ubuntu) because there has been no activity for 60 days.]

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.