# ejecting scsi cdrw

## mstamat

Hi,

How do I eject my scsi cdrw tray using the eject command? I edited my /etc/devfsd.conf so that /dev/cdrw is a ling to /dev/sg0 and /dev/sg0 is a link to /dev/scsi/blah/blah. I have tried using all of them as a parameter to eject but nothing works.

A way to do that is to use "cdrecord --eject", but I'd prefer to find a way to do that with eject command   :Wink:  .

Any ideas?

TIA

----------

## ElCondor

does eject /dev/cdrw not work??

* ElCondor pasa *

----------

## mstamat

eject cdrw (as root) says:

eject: Unable to eject, last error: Operation not permitted

----------

## ElCondor

brute force: strace eject to find out, what operation this is ..

* ElCondor pasa *

----------

## mstamat

I ran as root "strace /dev/cdrw". Here are the last lines of the output:

```
.

.

.

brk(0x8052000)                          = 0x8052000

brk(0x8053000)                          = 0x8053000

brk(0x8054000)                          = 0x8054000

open("/dev/scsi/host0/bus0/target0/lun0/generic", O_RDONLY|O_NONBLOCK) = 3

ioctl(3, 0x5309, 0xbffff790)            = -1 EPERM (Operation not permitted)

ioctl(3, FIBMAP, 0xbffff640)            = -1 EPERM (Operation not permitted)

ioctl(3, FDEJECT, 0xbffff790)           = -1 EPERM (Operation not permitted)

ioctl(3, SNDCTL_MIDI_MPUMODE, 0xbffff780) = -1 EPERM (Operation not permitted)

write(2, "eject: unable to eject, last err"..., 60eject: unable to eject, last error: Operation not permitted

) = 60

_exit(1)                                = ?
```

I get the same output when runing "strace eject cdrw" as gzaxar (the user logged on the console). I don't know what these ioctls mean. Here is the ls output for the device. 

```

roadrunner mstamat # ls -al /dev/scsi/host0/bus0/target0/lun0/generic

crw-rw----    1 gzaxar   root      21,   0 Jan  1  1970 /dev/scsi/host0/bus0/target0/lun0/generic
```

----------

## ElCondor

I have no real scsi here, justs scsi-emulation, but:

```
warum@PHIEPS warum $ l /dev/scsi/host0/bus0/target0/lun0/cd 

brw-------    1 warum    cdrom     11,   0 1970-01-01 01:00 /dev/scsi/host0/bus0/target0/lun0/cd

```

it's a block-device here, not a character-device. thats the only difference I can tell so far. sorry.

* ElCondor pasa *

----------

## mstamat

The block device is /dev/scsi/host0/bus0/target0/lun0/disc. But I get a different failure when I do that. 

```
roadrunner ~# strace eject /dev/scsi/host0/bus0/target0/lun0/disc

.

.

.

brk(0x8052000)                          = 0x8052000

brk(0x8053000)                          = 0x8053000

brk(0x8054000)                          = 0x8054000

open("/dev/scsi/host0/bus0/target0/lun0/disc", O_RDONLY|O_NONBLOCK) = 3

ioctl(3, 0x5309, 0xbffff770)            = -1 EINVAL (Invalid argument)

ioctl(3, FIBMAP, 0xbffff620)            = 134217730

ioctl(3, FDEJECT, 0xbffff770)           = -1 EINVAL (Invalid argument)

ioctl(3, SNDCTL_MIDI_MPUMODE, 0xbffff760) = -1 EINVAL (Invalid argument)

write(2, "eject: unable to eject, last err"..., 53eject: unable to eject, last error: Invalid argument

) = 53

_exit(1)                                = ?
```

----------

## rommel

hey you dont have supermount working do you? supermount doesnt work witht the program eject if you have configured it. if not sorry for the useless comment....lol

----------

