# Many Many redundant devices in /dev (toooo many!)

## nsadhal

Okay, so after numerous reinstalls and kernel compiles and things I finally got things running.... and pretty much everything works, cd burning, alsa, gamepad, etc...

But I still have this issue, that i think manifested itself with either modularization or the scsi-emulation.

The first time I built my kernel, I didn't modularize at all, stuff worked right away though, the only thing was the scsi stuff for cd burning, which I didn't know at the time. So anyway, After getting all that together, I found that the only way the cdrw would preten to be scsi was if ide-cd was a module. So okay, I did that... and stuff... by this time I've completely modularized the kernel. What i noticed, however, somewhere in-between, was that i had way more than one scsi device. I had 14 of every single one.

Since everything is modules now, I also have something like 14 cdroms, the first 7 point to my dvd drive (secondary master) and the other 7 point to my cdrw (secondary slave). Now, I haven't tried taking hdd=scsi out of menu.lst yet, but I think I should.

What bothers me is that both drives get scsi emulation... 7 times each at that. cdrecord has no problem with this however, cdrecord -scanbus returns two drives... which is funny because i only specified hdd, not hdc.

Also, on the bootup, I see my dvd and cd listed many many times (confirmed by dmesg).

So yeah, I guess this wouldn't concern me except that I know it's not usually like this. If i take out the scsi stuff i get the correct number of devices. 

Sorry so long.... to make it even longer... here's some relevent stuff:

selected listing from ls /dev:

```
fd

fd0 fd0u1040 fd0u1120 fd0u1440 fd0u1600 fd0u1680 fd0u1722 fd0u1743

on and on and on
```

```
pty  ptya0 ptya1 ptya2 ptya3 ptya4 ptya5 ptya6 ptya7 ptya8 ptya9

ptyaa ptyab ptyac ptyad ptyae ptyaf ptyb0 ptyb1 ptyb2 ptyb3 ptyb4 ptyb5

and many many more
```

The same goes for tty, and sg

from dmesg:

```

scsi0 : SCSI host adapter emulation for IDE ATAPI devices

  Vendor: TOSHIBA   Model: DVD-ROM SD-M1612  Rev: 1004

  Type:   CD-ROM                             ANSI SCSI revision: 02

....

seven times

...  

  Vendor: TOSHIBA   Model: DVD-ROM SD-M1612  Rev: 1004

  Type:   CD-ROM                             ANSI SCSI revision: 02

  Vendor: LITE-ON   Model: LTR-32123S        Rev: XS0X

  Type:   CD-ROM                             ANSI SCSI revision: 02

 ...

seven times

...

  Vendor: LITE-ON   Model: LTR-32123S        Rev: XS0X

  Type:   CD-ROM                             ANSI SCSI revision: 02

```

```

Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0

... lun 1 - 5 ...

Attached scsi CD-ROM sr6 at scsi0, channel 0, id 0, lun 6

Attached scsi CD-ROM sr7 at scsi0, channel 0, id 1, lun 0

...lun 1 - 5 ...

Attached scsi CD-ROM sr13 at scsi0, channel 0, id 1, lun 6

sr0: scsi3-mmc drive: 48x/48x cd/rw xa/form2 cdda tray

Uniform CD-ROM driver Revision: 3.12

sr1: scsi3-mmc drive: 48x/48x cd/rw xa/form2 cdda tray

...sr2-sr5...

sr6: scsi3-mmc drive: 48x/48x cd/rw xa/form2 cdda tray

sr7: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray

sr8-sr12

sr13: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray

```

The only real issue that arises because of this is that I can't use the defaults in /etc/devfsd.conf because those are like "make first scsi device point to /dev/cdrw" and stuff like that. That's easy to change, but it makes me think this is NOT how it should be... other than that, I think this is purely cosmetic, but I'd appreciate some help.

Thanks.

----------

## delta407

 *nsadhal wrote:*   

> selected listing from ls /dev:
> 
> ```
> fd
> 
> ...

 

Right, those are different block devices for each density of floppy diskette. That's normal.

 *nsadhal wrote:*   

> 
> 
> ```
> pty  ptya0 ptya1 ptya2 ptya3 ptya4 ptya5 ptya6 ptya7 ptya8 ptya9
> 
> ...

 

That's also normal.

 *nsadhal wrote:*   

> from dmesg:
> 
> [code]
> 
> scsi0 : SCSI host adapter emulation for IDE ATAPI devices
> ...

 

That's not normal.

----------

## nsadhal

okay, i see about the floppies... makes sense...

but i have ptyXX from a0 through ef and then p0 through zf (hex numbers i assume)

now that... to me.. is far too many...

i also have 64 tty's, 8 vcs's and 8 vcsa's, 14 sr's, and 14 cdroms is /dev/cdroms

i feel like it has somethign to do with modules... but i really don't know...

that's a lot of pty's... i don't remember there being that many the first time i installed it... what the hell is it anyway?

----------

## delta407

Everything you have said so far is normal except for the 14 CD-ROMs and 14 sr devices (which are your 14 CD-ROMs). ptys are pseudo-ttys, and are used for a number of quirky things in *nix but are really cool overall. The number of ptys is set in your kernel configuration (under Character devices).

----------

## nsadhal

oh, heh, i understand.   :Embarassed: 

i looked at make menuconfig and there's 256 maximum...

so do i need pseudo terminals at all?

i know there's the thing in filesystems too that goes along with devfs for pty.

like, what advantage do these give me and would i ever use them? (desktop machine)... cause otherwise i'm just gonna take em out of the kernel.

err ya... and i maybe someone could explain to me why i have 14 cdroms....

----------

## delta407

PTYs are necessary for many things to function properly; don't remove them unless you've scanned through every line of code of every program that executes on your computer. While you may never use them directly, a number of programs use them behind the scenes. Leave it alone.  :Wink: 

As far as the number of CD-ROMs go, what is the output of "dmesg | grep ide"?

----------

## nsadhal

output of dmesg | grep ide:

```
BIOS-provided physical RAM map:

ide_setup: hdd=scsi

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

    ide0: BM-DMA at 0xdc00-0xdc07, BIOS settings: hda:DMA, hdb:pio

    ide1: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdc:DMA, hdd:DMA

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

ide1 at 0x170-0x177,0x376 on irq 15

 /dev/ide/host0/bus0/target0/lun0: p1 p2 p3

EXT3 FS 2.4-0.9.17, 10 Jan 2002 on ide0(3,3), internal journal
```

----------

## delta407

Hmmmm... how about "dmesg | grep hd"?

----------

## nsadhal

output of "dmesg | grep hd"

```
Kernel command line: root=/dev/hda3 hdd=scsi

ide_setup: hdd=scsi

    ide0: BM-DMA at 0xdc00-0xdc07, BIOS settings: hda:DMA, hdb:pio

    ide1: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdc:DMA, hdd:DMA

hda: MAXTOR 6L080L4, ATA DISK drive

hdc: TOSHIBA DVD-ROM SD-M1612, ATAPI CD/DVD-ROM drive

hdd: LITE-ON LTR-32123S, ATAPI CD/DVD-ROM drive

hda: 156355584 sectors (80054 MB) w/1819KiB Cache, CHS=9732/255/63
```

edit: typo

----------

## delta407

Hmmm.... and /dev/cdroms/ shows 14 CD drives?

----------

## nsadhal

output of "ls /dev/cdroms"

```
cdrom0

cdrom1

cdrom10

cdrom11

cdrom12

cdrom13

cdrom2

cdrom3

cdrom4

cdrom5

cdrom6

cdrom7

cdrom8

cdrom9

```

----------

## delta407

Where do they point to? (ls -l /dev/cdroms)

----------

## nsadhal

```
total 0

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom0 -> ../scsi/host0/bus0/target0/lun0/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom1 -> ../scsi/host0/bus0/target0/lun1/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom10 -> ../scsi/host0/bus0/target1/lun3/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom11 -> ../scsi/host0/bus0/target1/lun4/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom12 -> ../scsi/host0/bus0/target1/lun5/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom13 -> ../scsi/host0/bus0/target1/lun6/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom2 -> ../scsi/host0/bus0/target0/lun2/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom3 -> ../scsi/host0/bus0/target0/lun3/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom4 -> ../scsi/host0/bus0/target0/lun4/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom5 -> ../scsi/host0/bus0/target0/lun5/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom6 -> ../scsi/host0/bus0/target0/lun6/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom7 -> ../scsi/host0/bus0/target1/lun0/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom8 -> ../scsi/host0/bus0/target1/lun1/cd

lr-xr-xr-x    1 root     root           34 Dec 31  1969 cdrom9 -> ../scsi/host0/bus0/target1/lun2/cd

```

so what this really means is that i have NO ide cdroms, and both are being picked up as scsi... many times at that... which makes me think that the hdd=scsi kernel param is useless...

----------

## sawtooth

use hdd=ide-scsi for scsi emulation

----------

## nsadhal

using hdd=ide-scsi gives me an error message.

it accepts hdd=scsi.

i've seen people post both saying they work, so i dunno, i guess it just depends on the version of the module.

besides, if scsi emulation wasn't working, i wouldn't have all those drives would i?  :Very Happy: 

i think scsi emulation is definitely working.... just too much.... haha....

----------

## sawtooth

hmm...you only specify hdd=scsi, but it seems to be seeing hdc as scsi as well.  Do you have IDE/ATAPI Cdrom support compiled into the kernel?  Because if not, then it may be defaulting to the scsi to control all of the cd's instead of just that one drive.

----------

## nsadhal

sawtooth: that's exactly what i said 3 posts up.

ide-cdrom support is a module, because otherwise scsi emulation doesn't work at all for me... at least not last i checked.... it defaults to ide then, and i get no scsi at all... i thought that ide-cd had to be a module otherwise that's what's supposed to happen...

but still why doesn't scsi just do two cdroms?

----------

## nsadhal

hrm, guess you were right sawtooth, compiling ide-cdrom support into the kernel instead of having it as a module fixed it.... the only thing now tho... is that cdrecord only sees the cd burner and not my other drive, so i can't do on  the fly recording

when i add hdc=scsi hdd=scsi to the kernel params to get scsi emu on both drives, it goes back to having 14 drives listed. not a big deal i guess... but is there any trick to getting both drives to be scsi emu w/o having 14 drives?

oh yeah, and i don't know why, but the kernel module configuration i have right now is exactly the same as when i first started trying to get this scsi stuff to work, and at that time, removing ide-cd from the kernel is what caused scsi to work in the first place... before that it wouldn't pick up at all.

----------

## bmph8ter

I don't know how correct my assumption is (I am but a *nix newb), but think about this.  With SCSI, you are allowed 15 devices in the chain (14 drives + 1 HBA) where as IDE allows 2.  Perhaps by enabling SCSI emulation for a single drive, the module/kernel thinks you are running a single ended HBA so it creates 1 /dev entry.  Once you enable SCSI emulation on both drives, the module/kernel realizes "oh hell, he isn't running SE anymore" and creates the other /dev entries.  You would need these if you were to run multiple devices.  AFAIK, you can not use a single /dev entry for more than one device.  To sum all of this up, this is required/wanted behavior.  Since SCSI emulation is just that (mimicking SCSI) it only makes sense that it should follow SCSIs behavior.

----------

## delta407

 *bmph8ter wrote:*   

> To sum all of this up, this is required/wanted behavior.

 

Err... no it's not. I'm running SCSI emulation on two CD burners and I only have two devices.

----------

## bmph8ter

 *delta407 wrote:*   

> Err... no it's not. I'm running SCSI emulation on two CD burners and I only have two devices.

 

Maybe not wanted, but necessary.  Regardless of your whims, SCSI has rules just like anything else (they must be followed even if you are just emulating).  Once again, I could be wrong, but it makes sense to me.

----------

## sawtooth

I still think the problem lies in using hdc=scis and hdd=scsi

If I change my boot parameters to include hdc=scsi and hdd=scsi then I don't get any working scsi-emulated cdroms. 

Here's my list of scsi module(s):

```

bash-2.05a# ls -lR /lib/modules/2.4.19-gentoo-r7/ | grep scsi

drwxr-xr-x    2 root     root         4096 Jul 12 11:49 scsi

/lib/modules/2.4.19-gentoo-r7/kernel/drivers/scsi:

-rw-r--r--    1 root     root        11940 Jul 12 11:49 ide-scsi.o

```

And finally, under the IDE, ATA, and ATAPI section:

Just the scsi directory, and the ide-scsi module.

Here's my scsi page from make menuconfig:

```

<*> SCSI support                                                                                       

 --- SCSI support type (disk, tape, CD-ROM)                                                                       

< >   SCSI disk support                                                                                            

< >   SCSI tape support                                                                                          

< >   SCSI OnStream SC-x0 tape support                                                                           

<M>   SCSI CD-ROM support

[ ]     Enable vendor-specific extensions (for SCSI CDROM)                                                       

(2) Maximum number of CDROM devices that can be loaded as modules                                                

<M>   SCSI generic support                                                                                       

--- Some SCSI devices (e.g. CD jukebox) support multiple LUNs                                                    

[*]   Enable extra checks in new queueing code                                                                   

[*]   Probe all LUNs on each SCSI device                                                                         

[*]   Verbose SCSI error reporting (kernel size +=12K)                                                           

[ ]   SCSI logging facility                                                                                      

SCSI low-level drivers  ---> 

```

And finally, under the IDE, ATA, and ATAPI section:

```

<*>   Include IDE/ATAPI CDROM support                                                                           

< >   Include IDE/ATAPI TAPE support                                                                            

< >   Include IDE/ATAPI FLOPPY support                                                                          

<M>   SCSI emulation support

```

So, compare configuration and see if ide-scsi.o really does exist, and try once again to use that (instead of scsi) for the hdc= and hdd= kernel parameters.

----------

## nsadhal

hmm, see, i don't have ide-scsi.o, because i compiled scsi emulation into the kernel... soo... should i just change the param from hdd=scsi to "hdd=ide-scsi hdc=ide-scsi" ?

that would still eliminate the need for ide-cd...

----------

## bai

Do you have "scan all LUNs on each device" or whatever it is checked?  I know I had this problem on my laptop, and I think unchecking that fixed it.  No guarantees though :P

----------

