Bug 137349 - eject doesnt work as user - returns error msg even when working
eject doesnt work as user - returns error msg even when working
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Dave Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-27 13:52 EDT by Dams
Modified: 2015-01-04 17:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-22 15:45:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
strace eject scd0 > strace-anvil.txt 2>&1 (6.86 KB, text/plain)
2004-10-27 13:54 EDT, Dams
no flags Details
eject scd0 > ~anvil/strace-root.txt 2>&1 (53 bytes, text/plain)
2004-10-27 13:56 EDT, Dams
no flags Details
strace eject scd0 > ~anvil/strace-root.txt 2>&1 (this one for real) (8.02 KB, text/plain)
2004-10-28 17:09 EDT, Dams
no flags Details

  None (edit)
Description Dams 2004-10-27 13:52:29 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20041020 Galeon/1.3.18

Description of problem:
I cant eject cdrom as user. eject returns this error : 

[anvil@gruyere ~]# ll /dev/cdrom /dev/scd0
lrwxrwxrwx  1 root  root     4 Oct 20 22:37 /dev/cdrom -> scd0
brw-------  1 anvil disk 11, 0 Oct 20 22:37 /dev/scd0
[anvil@gruyere ~]# eject scd0
eject: unable to eject, last error: Invalid argument

When i run as it as root the tray ejects but there is the same error
message. I'll attach strace (both as user and as root)

The device is a usb2 dvdrom device. Entry from /proc/scsi/scsi :
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: PIONEER  Model: DVD-RW  DVR-107D Rev: 1.10
  Type:   CD-ROM                           ANSI SCSI revision: 02

Version-Release number of selected component: eject-2.0.13-10
How reproducible: Always

Steps to Reproduce:
1. Insert a cd
2. close the tray.
3. run eject.

Additional info:
eject -t doesnt work both as user and as root.
dmesg returns a bunch of known-harmless warnings:
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
Currently running kernel 2.6.9-1.639smp.
Comment 1 Dams 2004-10-27 13:54:45 EDT
Created attachment 105853 [details]
strace eject scd0 > strace-anvil.txt 2>&1

strace as user.
Comment 2 Dams 2004-10-27 13:56:02 EDT
Created attachment 105855 [details]
eject scd0 > ~anvil/strace-root.txt 2>&1

strace as root.
Comment 3 Bill Nottingham 2004-10-27 14:46:34 EDT
Out of curiosity, what happens if you modify eject to open the device
read/write?
Comment 4 Dams 2004-10-27 16:21:33 EDT
Well, i can rip an audio cd, i can mount data cd, i can burn dvd, or
just watch a video dvd. :p
"normal" stuff.
Comment 5 Ngo Than 2004-10-28 16:02:07 EDT
i don't have the usb2 DVDROM for testing. it looks like there's
something broken or a limitation in scsi driver, which causes this
problem.

Does it eject with "eject /dev/cdrom" as user and root?

could you please send the output of "eject -v /dev/cdrom"
Comment 6 Dams 2004-10-28 16:53:43 EDT
*sigh*.
Today it seems to be working. -_-.

[anvil@gruyere ~]# LC_ALL=en_US.UTF-8 eject -v /dev/cdrom
eject: device name is `/dev/cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/scd0'
eject: `/dev/scd0' is not mounted
eject: `/dev/scd0' is not a mount point
eject: `/dev/scd0' is not a multipartition device
eject: trying to eject `/dev/scd0' using CD-ROM eject command
eject: CD-ROM eject command succeeded

'eject scd0' works the same way.
eject -t still doesnt work (both as user and root..) though.
Comment 7 Ngo Than 2004-10-28 17:06:48 EDT
Not all devices support this command (CD-ROM tray close command). it
seems your case here. I have tested some IDE CDROMs here, it works fine.
Comment 8 Dams 2004-10-28 17:09:13 EDT
Created attachment 105916 [details]
strace eject scd0 > ~anvil/strace-root.txt 2>&1 (this one for real)

The strace log as root wasnt exactly the good one. Re-attaching.
Comment 9 Dams 2004-10-28 17:13:52 EDT
Sorry, re-opening. I can accept the closing tray stuff, but there's
still something rotten with opening.

Just rebooted with fresh new kernel. And it doesnt eject it anymore as
user. Here is what you asked.

[anvil@gruyere ~]# LC_ALL=en_US.UTF-8 eject -v
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/scd0'
eject: `/dev/scd0' is not mounted
eject: `/dev/scd0' is not a mount point
eject: `/dev/scd0' is not a multipartition device
eject: trying to eject `/dev/scd0' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: trying to eject `/dev/scd0' using SCSI commands
eject: SCSI eject failed
eject: trying to eject `/dev/scd0' using floppy eject command
eject: floppy eject command failed
eject: trying to eject `/dev/scd0' using tape offline command
eject: tape offline command failed
eject: unable to eject, last error: Invalid argument


Running as root : 
[root@gruyere ~]# LC_ALL=en_US.UTF-8 eject -v /dev/cdrom
eject: device name is `/dev/cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/scd0'
eject: `/dev/scd0' is not mounted
eject: `/dev/scd0' is not a mount point
eject: `/dev/scd0' is not a multipartition device
eject: trying to eject `/dev/scd0' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: trying to eject `/dev/scd0' using SCSI commands
eject: SCSI eject failed
eject: trying to eject `/dev/scd0' using floppy eject command
eject: floppy eject command failed
eject: trying to eject `/dev/scd0' using tape offline command
eject: tape offline command failed
eject: unable to eject, last error: Invalid argument

the scsi eject actually succeed and the tray is ejected. Not really
consistent.

Hum, look at this :
[root@gruyere ~]# lsof /dev/cdrom
COMMAND  PID  USER   FD   TYPE DEVICE SIZE  NODE NAME
grip    5032 anvil   16r   BLK   11,0      68888 /dev/scd0

if i kill grip before running 'eject', the tray is ejected when i run
eject as user. I wouldnt blame grip.. I'm pretty sure anything opening
the device will block the 'eject'.
Comment 10 David Nielsen 2004-10-30 10:25:23 EDT
I'm seeing the same issue here, I have to manually eject cds as root
after I ripped them in sound-juicer, it's a fairly annoying problem.
Comment 11 David Nielsen 2004-10-30 12:57:52 EDT
good news, it appears that the latest HAL update fixes this, at least
for me
Comment 12 David Nielsen 2004-10-30 13:10:40 EDT
I appear to have spoken to soon, it worked the first time, after that
I have no such luck.
Comment 13 Ngo Than 2004-10-31 15:02:38 EST
can you umount your cdrom device (umount /dev/cdrom)? if it works,
does it ejects after you do "eject /dev/cdrom) afterwards?

Comment 14 David Nielsen 2004-10-31 15:58:34 EST
well audio cds doesn't mount, so umount doesn't do much to and the
system does reply that it's not mounted according to mtab, eject
complains with the usual invalid argument message that isn't of much
help for the user.

As user it just complains, as root it ejects then it complains.
Comment 15 Ngo Than 2004-11-02 10:10:48 EST
it seems a problem in scsi layer. it only works after a medium is
inserted.

please take a look at
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=134822
Comment 16 Pavel Polischouk 2004-11-10 13:01:50 EST
Here's a snippet of /var/log/messages when trying to execute eject:

Nov  8 16:38:16 machine kernel: program eject is using a deprecated
SCSI ioctl, please convert it to SG_IO
Nov  8 16:38:27 machine last message repeated 4 times

Seems like it's an eject bug, using deprecated system call.
Comment 17 Jon Savage 2004-11-13 13:31:53 EST
I'm getting this in Core 3 *release* as well w/ an internal dvd/cdrom.
Could someone change the version to core 3 please?
Comment 18 Daniel Challen 2004-11-22 04:46:20 EST
I'm seeing similar behaviour, tray ejects when I run as root, though I
do get the error...

Fedora Core 3, upgraded from 2 upgraded from 1. PIII 700, 1GB RAM,
couple of SCSI disks, 1 standard ATAPI CD-ROM

[root@morte ~]# uname -r
2.6.9-1.667

[root@morte ~]# grep CD /var/log/dmesg 
hdc: FX4820T, ATAPI CD/DVD-ROM drive
hdc: ATAPI 48X CD-ROM drive, 128kB Cache, (U)DMA
Uniform CD-ROM driver Revision: 3.20

This is the only ATAPI device (the disks are U160 SCSI) and I'm not
using ide-scsi.

[root@morte ~]# eject -v -t
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/hdc'
eject: `/dev/hdc' is not mounted
eject: `/dev/hdc' is not a mount point
eject: closing tray
[root@morte ~]# eject -v 
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/hdc'
eject: `/dev/hdc' is not mounted
eject: `/dev/hdc' is not a mount point
eject: `/dev/hdc' is a multipartition device
eject: trying to eject `/dev/hdc' using CD-ROM eject command
eject: CD-ROM eject command failed
eject: trying to eject `/dev/hdc' using SCSI commands
eject: SCSI eject failed
eject: trying to eject `/dev/hdc' using floppy eject command
eject: floppy eject command failed
eject: trying to eject `/dev/hdc' using tape offline command
eject: tape offline command failed
eject: unable to eject, last error: Invalid argument
[root@morte ~]# eject -v # ejecting again, even though the tray is
already 'out'
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/hdc'
eject: `/dev/hdc' is not mounted
eject: `/dev/hdc' is not a mount point
eject: `/dev/hdc' is a multipartition device
eject: trying to eject `/dev/hdc' using CD-ROM eject command
eject: CD-ROM eject command succeeded

I'm seeing the same complaint 
from /var/log/messages:
Nov 22 09:34:17 morte kernel: program eject is using a deprecated SCSI
ioctl, please convert it to SG_IO
Nov 22 09:34:17 morte last message repeated 2 times
Comment 19 Daniel Challen 2004-11-22 07:13:20 EST
It now appears to be working after a reboot. "eject" and "eject -t"
work fine both with and without media, as root and normal user, and no
errors nor kernel messages are generated.
Comment 20 Dams 2004-12-04 11:41:02 EST
Ngo (comment 7) : by the way, as i thought, i've been (at last) able
to test my dvdrom usb stuff on a good ol' 2.4 kernel and both opening
and closing the tray work. Since this bug has been assigned to kernel,
do you think that is related or should this be filled in another report ?
Comment 21 Nate 2004-12-20 19:47:14 EST
I am having similar problems, but it seems to be related to the kind
of cd that I put into my drive.  For instance a regular, old cd with
the proper audio disk logo on the back works as it should.  However, I
have two LOTR cd that are "enhanced cds," meaning that they are in
fact NOT cds at all because they don't have the audio disk logo on the
back (slight tangent).  Anyway, these enhanced cds give me problems. 
After putting them in, the ONLY way I can get them to eject is as root
user.  Weird, huh?
Comment 22 Nate 2004-12-20 19:48:48 EST
Also I cannot mount these cds even though they have files that can
only be viewed by mounting them first.  

/dev/hdc: Input/output error
mount: block device /dev/hdc is write-protected, mounting read-only
/dev/hdc: Input/output error
mount: /dev/hdc: can't read superblock

It is all slightly annoying, but it's no show stopper.
Comment 23 Dams 2005-01-22 15:45:12 EST
blah. Fixed since [at least] 0:2.6.9-1.724_FC3. Even eject -t is
working now. No problem with latest FC3 2.6.10.

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