2004-09-15 23:46:18

by CIJOML

[permalink] [raw]
Subject: CD-ROM can't be ejected

Hi,

it's almost half a year, when I filled this bug report:
http://bugme.osdl.org/show_bug.cgi?id=2951

and it still don't work :)

Can anybody help me?

Thanks

Michal


2004-09-16 06:56:03

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

No, it is not that problem :((( Any other idea?

M.

Dne ?t 16. z??? 2004 02:01 Edward Angelo Dayao napsal(a):
> ha... well there's a way around it... sometimes the cdrom won't eject
> because you're still accessing it.
>
> try leaving that directory (including all terminals, nautilus
> windows,etc.) ... and then eject.
>
> hope this helps
>
> edward
>
> On Thu, 16 Sep 2004 00:25:35 +0200, Bc. Michal Semler <[email protected]>
wrote:
> > Hi,
> >
> > it's almost half a year, when I filled this bug report:
> > http://bugme.osdl.org/show_bug.cgi?id=2951
> >
> > and it still don't work :)
> >
> > Can anybody help me?
> >
> > Thanks
> >
> > Michal
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> > in the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/

2004-09-16 07:14:52

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> Hi,
>
> it's almost half a year, when I filled this bug report:
> http://bugme.osdl.org/show_bug.cgi?id=2951
>
> and it still don't work :)
>
> Can anybody help me?

strace -o some_file eject /dev/hdc

and send some_file in here.

--
Jens Axboe

2004-09-16 07:20:32

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

notas:/home/cijoml# mount /cdrom/
notas:/home/cijoml# umount /cdrom/
notas:/home/cijoml# strace -o eject /dev/hdc
eject: unable to eject, last error: Nep??pustn? argument

As you can see, I dont't enter to directory...

And output is included

M.

Dne ?t 16. z??? 2004 09:09 jste napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > Hi,
> >
> > it's almost half a year, when I filled this bug report:
> > http://bugme.osdl.org/show_bug.cgi?id=2951
> >
> > and it still don't work :)
> >
> > Can anybody help me?
>
> strace -o some_file eject /dev/hdc
>
> and send some_file in here.


Attachments:
(No filename) (593.00 B)
eject (6.77 kB)
Download all attachments

2004-09-16 07:37:56

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected


(don't top post, and don't trim cc list!)

On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> notas:/home/cijoml# mount /cdrom/
> notas:/home/cijoml# umount /cdrom/
> notas:/home/cijoml# strace -o eject /dev/hdc
> eject: unable to eject, last error: Nep??pustn? argument
>
> As you can see, I dont't enter to directory...
>
> And output is included

> ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)

That's the important bit, the reason you get EINVAL passed back is
because eject tries the floppy eject as well and decides to print the
warning from that. It really should just stop of it sees -EIO, only
continue if EINVAL/ENOTTY is passed back.

Try this little c program and report back what it tells you. Compile
with

gcc -Wall -o eject eject.c

and run without arguments.

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/cdrom.h>

int main(int argc, char *argv[])
{
int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
struct cdrom_generic_command cgc;
struct request_sense sense;

memset(&cgc, 0, sizeof(cgc));
memset(&sense, 0, sizeof(sense));

cgc.cmd[0] = 0x1b;
cgc.cmd[4] = 0x02;
cgc.sense = &sense;
cgc.data_direction = CGC_DATA_NONE;

if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
printf("eject worked\n");
return 0;
}

printf("command failed - sense %x/%x/%x\n", sense.sense_key, sense.asc, sense.ascq);
return 1;
}

--
Jens Axboe

2004-09-16 08:13:46

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 09:36 jste napsal(a):
> (don't top post, and don't trim cc list!)
>
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > notas:/home/cijoml# mount /cdrom/
> > notas:/home/cijoml# umount /cdrom/
> > notas:/home/cijoml# strace -o eject /dev/hdc
> > eject: unable to eject, last error: Nep??pustn? argument
> >
> > As you can see, I dont't enter to directory...
> >
> > And output is included
> >
> > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)
>
> That's the important bit, the reason you get EINVAL passed back is
> because eject tries the floppy eject as well and decides to print the
> warning from that. It really should just stop of it sees -EIO, only
> continue if EINVAL/ENOTTY is passed back.
>
> Try this little c program and report back what it tells you. Compile
> with
>
> gcc -Wall -o eject eject.c
>
> and run without arguments.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <string.h>
> #include <sys/ioctl.h>
> #include <linux/cdrom.h>
>
> int main(int argc, char *argv[])
> {
> int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> struct cdrom_generic_command cgc;
> struct request_sense sense;
>
> memset(&cgc, 0, sizeof(cgc));
> memset(&sense, 0, sizeof(sense));
>
> cgc.cmd[0] = 0x1b;
> cgc.cmd[4] = 0x02;
> cgc.sense = &sense;
> cgc.data_direction = CGC_DATA_NONE;
>
> if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> printf("eject worked\n");
> return 0;
> }
>
> printf("command failed - sense %x/%x/%x\n", sense.sense_key, sense.asc,
> sense.ascq); return 1;
> }

2.4.27-mh1
notas:~# /home/cijoml/eject
ATAPI device hdc:
Error: Not ready -- (Sense key=0x02)
(reserved error code) -- (asc=0x53, ascq=0x02)
The failed "Start/Stop Unit" packet command was:
"1b 00 00 00 02 00 00 00 00 00 00 00 "
command failed - sense 2/53/2


2.6.9-rc2
notas:~# mount /cdrom/
notas:~# umount /cdrom/
notas:~# /home/cijoml/eject
Here isn't opened
command failed - sense 2/53/2
notas:~# eject /cdrom/
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
program eject is using a deprecated SCSI ioctl, please convert it to SG_IO
Here is cd-rom opened
eject: unable to eject, last error: Nep??pustn? argument
notas:~# /home/cijoml/eject
Here is cd-rom opened
eject worked

2004-09-16 09:10:25

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> Dne ?t 16. z??? 2004 09:36 jste napsal(a):
> > (don't top post, and don't trim cc list!)

don't trim the cc list!!

> > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > notas:/home/cijoml# mount /cdrom/
> > > notas:/home/cijoml# umount /cdrom/
> > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > eject: unable to eject, last error: Nep??pustn? argument
> > >
> > > As you can see, I dont't enter to directory...
> > >
> > > And output is included
> > >
> > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)
> >
> > That's the important bit, the reason you get EINVAL passed back is
> > because eject tries the floppy eject as well and decides to print the
> > warning from that. It really should just stop of it sees -EIO, only
> > continue if EINVAL/ENOTTY is passed back.
> >
> > Try this little c program and report back what it tells you. Compile
> > with
> >
> > gcc -Wall -o eject eject.c
> >
> > and run without arguments.
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <fcntl.h>
> > #include <string.h>
> > #include <sys/ioctl.h>
> > #include <linux/cdrom.h>
> >
> > int main(int argc, char *argv[])
> > {
> > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > struct cdrom_generic_command cgc;
> > struct request_sense sense;
> >
> > memset(&cgc, 0, sizeof(cgc));
> > memset(&sense, 0, sizeof(sense));
> >
> > cgc.cmd[0] = 0x1b;
> > cgc.cmd[4] = 0x02;
> > cgc.sense = &sense;
> > cgc.data_direction = CGC_DATA_NONE;
> >
> > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > printf("eject worked\n");
> > return 0;
> > }
> >
> > printf("command failed - sense %x/%x/%x\n", sense.sense_key, sense.asc,
> > sense.ascq); return 1;
> > }
>
> 2.4.27-mh1
> notas:~# /home/cijoml/eject
> ATAPI device hdc:
> Error: Not ready -- (Sense key=0x02)
> (reserved error code) -- (asc=0x53, ascq=0x02)
> The failed "Start/Stop Unit" packet command was:
> "1b 00 00 00 02 00 00 00 00 00 00 00 "
> command failed - sense 2/53/2

Your tray is still locked, are you sure it isn't mounted?

--
Jens Axboe

2004-09-16 09:14:32

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

> > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > notas:/home/cijoml# mount /cdrom/
> > > > notas:/home/cijoml# umount /cdrom/
> > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > eject: unable to eject, last error: Nep??pustn? argument
> > > >
> > > > As you can see, I dont't enter to directory...
> > > >
> > > > And output is included
> > > >
> > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)
> > >
> > > That's the important bit, the reason you get EINVAL passed back is
> > > because eject tries the floppy eject as well and decides to print the
> > > warning from that. It really should just stop of it sees -EIO, only
> > > continue if EINVAL/ENOTTY is passed back.
> > >
> > > Try this little c program and report back what it tells you. Compile
> > > with
> > >
> > > gcc -Wall -o eject eject.c
> > >
> > > and run without arguments.
> > >
> > > #include <stdio.h>
> > > #include <stdlib.h>
> > > #include <fcntl.h>
> > > #include <string.h>
> > > #include <sys/ioctl.h>
> > > #include <linux/cdrom.h>
> > >
> > > int main(int argc, char *argv[])
> > > {
> > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > struct cdrom_generic_command cgc;
> > > struct request_sense sense;
> > >
> > > memset(&cgc, 0, sizeof(cgc));
> > > memset(&sense, 0, sizeof(sense));
> > >
> > > cgc.cmd[0] = 0x1b;
> > > cgc.cmd[4] = 0x02;
> > > cgc.sense = &sense;
> > > cgc.data_direction = CGC_DATA_NONE;
> > >
> > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > printf("eject worked\n");
> > > return 0;
> > > }
> > >
> > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > sense.asc, sense.ascq); return 1;
> > > }
> >
> > 2.4.27-mh1
> > notas:~# /home/cijoml/eject
> > ATAPI device hdc:
> > Error: Not ready -- (Sense key=0x02)
> > (reserved error code) -- (asc=0x53, ascq=0x02)
> > The failed "Start/Stop Unit" packet command was:
> > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > command failed - sense 2/53/2
>
> Your tray is still locked, are you sure it isn't mounted?

Yes I am. This is written into console and I am logged only into this console
and I copied whole commands from login to eject... :(

M.

2004-09-16 10:24:20

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > notas:/home/cijoml# mount /cdrom/
> > > > > notas:/home/cijoml# umount /cdrom/
> > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > >
> > > > > As you can see, I dont't enter to directory...
> > > > >
> > > > > And output is included
> > > > >
> > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output error)
> > > >
> > > > That's the important bit, the reason you get EINVAL passed back is
> > > > because eject tries the floppy eject as well and decides to print the
> > > > warning from that. It really should just stop of it sees -EIO, only
> > > > continue if EINVAL/ENOTTY is passed back.
> > > >
> > > > Try this little c program and report back what it tells you. Compile
> > > > with
> > > >
> > > > gcc -Wall -o eject eject.c
> > > >
> > > > and run without arguments.
> > > >
> > > > #include <stdio.h>
> > > > #include <stdlib.h>
> > > > #include <fcntl.h>
> > > > #include <string.h>
> > > > #include <sys/ioctl.h>
> > > > #include <linux/cdrom.h>
> > > >
> > > > int main(int argc, char *argv[])
> > > > {
> > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > struct cdrom_generic_command cgc;
> > > > struct request_sense sense;
> > > >
> > > > memset(&cgc, 0, sizeof(cgc));
> > > > memset(&sense, 0, sizeof(sense));
> > > >
> > > > cgc.cmd[0] = 0x1b;
> > > > cgc.cmd[4] = 0x02;
> > > > cgc.sense = &sense;
> > > > cgc.data_direction = CGC_DATA_NONE;
> > > >
> > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > printf("eject worked\n");
> > > > return 0;
> > > > }
> > > >
> > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > sense.asc, sense.ascq); return 1;
> > > > }
> > >
> > > 2.4.27-mh1
> > > notas:~# /home/cijoml/eject
> > > ATAPI device hdc:
> > > Error: Not ready -- (Sense key=0x02)
> > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > The failed "Start/Stop Unit" packet command was:
> > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > command failed - sense 2/53/2
> >
> > Your tray is still locked, are you sure it isn't mounted?
>
> Yes I am. This is written into console and I am logged only into this
> console and I copied whole commands from login to eject... :(

For the third time, don't trim the cc list! group reply please.

Something else must be keeping your drive locked. What else do you have
running in the system? It's enough if one app is just holding the drive
open, the drive wont get unlocked on umount then.

--
Jens Axboe

2004-09-16 11:47:11

by Denis Vlasenko

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

> > > > 2.4.27-mh1
> > > > notas:~# /home/cijoml/eject
> > > > ATAPI device hdc:
> > > > Error: Not ready -- (Sense key=0x02)
> > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > The failed "Start/Stop Unit" packet command was:
> > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > command failed - sense 2/53/2
> > >
> > > Your tray is still locked, are you sure it isn't mounted?
> >
> > Yes I am. This is written into console and I am logged only into this
> > console and I copied whole commands from login to eject... :(
>
> For the third time, don't trim the cc list! group reply please.
>
> Something else must be keeping your drive locked. What else do you have
> running in the system? It's enough if one app is just holding the drive
> open, the drive wont get unlocked on umount then.

Michal, you can use 'lsof -nP' to check for that
--
vda

2004-09-16 12:22:35

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > >
> > > > > > As you can see, I dont't enter to directory...
> > > > > >
> > > > > > And output is included
> > > > > >
> > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output
> > > > > > error)
> > > > >
> > > > > That's the important bit, the reason you get EINVAL passed back is
> > > > > because eject tries the floppy eject as well and decides to print
> > > > > the warning from that. It really should just stop of it sees -EIO,
> > > > > only continue if EINVAL/ENOTTY is passed back.
> > > > >
> > > > > Try this little c program and report back what it tells you.
> > > > > Compile with
> > > > >
> > > > > gcc -Wall -o eject eject.c
> > > > >
> > > > > and run without arguments.
> > > > >
> > > > > #include <stdio.h>
> > > > > #include <stdlib.h>
> > > > > #include <fcntl.h>
> > > > > #include <string.h>
> > > > > #include <sys/ioctl.h>
> > > > > #include <linux/cdrom.h>
> > > > >
> > > > > int main(int argc, char *argv[])
> > > > > {
> > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > struct cdrom_generic_command cgc;
> > > > > struct request_sense sense;
> > > > >
> > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > memset(&sense, 0, sizeof(sense));
> > > > >
> > > > > cgc.cmd[0] = 0x1b;
> > > > > cgc.cmd[4] = 0x02;
> > > > > cgc.sense = &sense;
> > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > >
> > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > printf("eject worked\n");
> > > > > return 0;
> > > > > }
> > > > >
> > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > sense.asc, sense.ascq); return 1;
> > > > > }
> > > >
> > > > 2.4.27-mh1
> > > > notas:~# /home/cijoml/eject
> > > > ATAPI device hdc:
> > > > Error: Not ready -- (Sense key=0x02)
> > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > The failed "Start/Stop Unit" packet command was:
> > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > command failed - sense 2/53/2
> > >
> > > Your tray is still locked, are you sure it isn't mounted?
> >
> > Yes I am. This is written into console and I am logged only into this
> > console and I copied whole commands from login to eject... :(
>
> For the third time, don't trim the cc list! group reply please.
>
> Something else must be keeping your drive locked. What else do you have
> running in the system? It's enough if one app is just holding the drive
> open, the drive wont get unlocked on umount then.

only thing which access cdrom is cpudynd and it access harddrive too....

notas:~# fuser /dev/hdc
/dev/hdc: 8102
notas:~# ps aux|grep 8102
root 8102 0.0 0.1 1536 456 ? SNs 13:49
0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc

nothing more

Michal

2004-09-16 12:23:21

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 13:44 Denis Vlasenko napsal(a):
> > > > > 2.4.27-mh1
> > > > > notas:~# /home/cijoml/eject
> > > > > ATAPI device hdc:
> > > > > Error: Not ready -- (Sense key=0x02)
> > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > The failed "Start/Stop Unit" packet command was:
> > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > command failed - sense 2/53/2
> > > >
> > > > Your tray is still locked, are you sure it isn't mounted?
> > >
> > > Yes I am. This is written into console and I am logged only into this
> > > console and I copied whole commands from login to eject... :(
> >
> > For the third time, don't trim the cc list! group reply please.
> >
> > Something else must be keeping your drive locked. What else do you have
> > running in the system? It's enough if one app is just holding the drive
> > open, the drive wont get unlocked on umount then.
>
> Michal, you can use 'lsof -nP' to check for that
> --
> vda

Thanks fuser helped too...

M.

2004-09-16 12:27:17

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > > >
> > > > > > > As you can see, I dont't enter to directory...
> > > > > > >
> > > > > > > And output is included
> > > > > > >
> > > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO (Input/output
> > > > > > > error)
> > > > > >
> > > > > > That's the important bit, the reason you get EINVAL passed back is
> > > > > > because eject tries the floppy eject as well and decides to print
> > > > > > the warning from that. It really should just stop of it sees -EIO,
> > > > > > only continue if EINVAL/ENOTTY is passed back.
> > > > > >
> > > > > > Try this little c program and report back what it tells you.
> > > > > > Compile with
> > > > > >
> > > > > > gcc -Wall -o eject eject.c
> > > > > >
> > > > > > and run without arguments.
> > > > > >
> > > > > > #include <stdio.h>
> > > > > > #include <stdlib.h>
> > > > > > #include <fcntl.h>
> > > > > > #include <string.h>
> > > > > > #include <sys/ioctl.h>
> > > > > > #include <linux/cdrom.h>
> > > > > >
> > > > > > int main(int argc, char *argv[])
> > > > > > {
> > > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > > struct cdrom_generic_command cgc;
> > > > > > struct request_sense sense;
> > > > > >
> > > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > > memset(&sense, 0, sizeof(sense));
> > > > > >
> > > > > > cgc.cmd[0] = 0x1b;
> > > > > > cgc.cmd[4] = 0x02;
> > > > > > cgc.sense = &sense;
> > > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > > >
> > > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > > printf("eject worked\n");
> > > > > > return 0;
> > > > > > }
> > > > > >
> > > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > > sense.asc, sense.ascq); return 1;
> > > > > > }
> > > > >
> > > > > 2.4.27-mh1
> > > > > notas:~# /home/cijoml/eject
> > > > > ATAPI device hdc:
> > > > > Error: Not ready -- (Sense key=0x02)
> > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > The failed "Start/Stop Unit" packet command was:
> > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > command failed - sense 2/53/2
> > > >
> > > > Your tray is still locked, are you sure it isn't mounted?
> > >
> > > Yes I am. This is written into console and I am logged only into this
> > > console and I copied whole commands from login to eject... :(
> >
> > For the third time, don't trim the cc list! group reply please.
> >
> > Something else must be keeping your drive locked. What else do you have
> > running in the system? It's enough if one app is just holding the drive
> > open, the drive wont get unlocked on umount then.
>
> only thing which access cdrom is cpudynd and it access harddrive too....
>
> notas:~# fuser /dev/hdc
> /dev/hdc: 8102
> notas:~# ps aux|grep 8102
> root 8102 0.0 0.1 1536 456 ? SNs 13:49
> 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc

well there you go, that is what is keeping the drive locked. cdrom
cannot know which process locked it or not, all it knows is that the
usage count is non-zero on umount, so it doesn't unlock the tray.

--
Jens Axboe

2004-09-16 12:31:52

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 14:24 Jens Axboe napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > > > >
> > > > > > > > As you can see, I dont't enter to directory...
> > > > > > > >
> > > > > > > > And output is included
> > > > > > > >
> > > > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO
> > > > > > > > (Input/output error)
> > > > > > >
> > > > > > > That's the important bit, the reason you get EINVAL passed back
> > > > > > > is because eject tries the floppy eject as well and decides to
> > > > > > > print the warning from that. It really should just stop of it
> > > > > > > sees -EIO, only continue if EINVAL/ENOTTY is passed back.
> > > > > > >
> > > > > > > Try this little c program and report back what it tells you.
> > > > > > > Compile with
> > > > > > >
> > > > > > > gcc -Wall -o eject eject.c
> > > > > > >
> > > > > > > and run without arguments.
> > > > > > >
> > > > > > > #include <stdio.h>
> > > > > > > #include <stdlib.h>
> > > > > > > #include <fcntl.h>
> > > > > > > #include <string.h>
> > > > > > > #include <sys/ioctl.h>
> > > > > > > #include <linux/cdrom.h>
> > > > > > >
> > > > > > > int main(int argc, char *argv[])
> > > > > > > {
> > > > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > > > struct cdrom_generic_command cgc;
> > > > > > > struct request_sense sense;
> > > > > > >
> > > > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > > > memset(&sense, 0, sizeof(sense));
> > > > > > >
> > > > > > > cgc.cmd[0] = 0x1b;
> > > > > > > cgc.cmd[4] = 0x02;
> > > > > > > cgc.sense = &sense;
> > > > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > > > >
> > > > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > > > printf("eject worked\n");
> > > > > > > return 0;
> > > > > > > }
> > > > > > >
> > > > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > > > sense.asc, sense.ascq); return 1;
> > > > > > > }
> > > > > >
> > > > > > 2.4.27-mh1
> > > > > > notas:~# /home/cijoml/eject
> > > > > > ATAPI device hdc:
> > > > > > Error: Not ready -- (Sense key=0x02)
> > > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > > The failed "Start/Stop Unit" packet command was:
> > > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > > command failed - sense 2/53/2
> > > > >
> > > > > Your tray is still locked, are you sure it isn't mounted?
> > > >
> > > > Yes I am. This is written into console and I am logged only into this
> > > > console and I copied whole commands from login to eject... :(
> > >
> > > For the third time, don't trim the cc list! group reply please.
> > >
> > > Something else must be keeping your drive locked. What else do you have
> > > running in the system? It's enough if one app is just holding the drive
> > > open, the drive wont get unlocked on umount then.
> >
> > only thing which access cdrom is cpudynd and it access harddrive too....
> >
> > notas:~# fuser /dev/hdc
> > /dev/hdc: 8102
> > notas:~# ps aux|grep 8102
> > root 8102 0.0 0.1 1536 456 ? SNs 13:49
> > 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc
>
> well there you go, that is what is keeping the drive locked. cdrom
> cannot know which process locked it or not, all it knows is that the
> usage count is non-zero on umount, so it doesn't unlock the tray.

And what should I do? I need cpu scalling. And under 2.6 it works (cd-rom
opening after umount) strange as I post before

Michal

2004-09-16 12:35:08

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 14:24 Jens Axboe napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > > > >
> > > > > > > > As you can see, I dont't enter to directory...
> > > > > > > >
> > > > > > > > And output is included
> > > > > > > >
> > > > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO
> > > > > > > > (Input/output error)
> > > > > > >
> > > > > > > That's the important bit, the reason you get EINVAL passed back
> > > > > > > is because eject tries the floppy eject as well and decides to
> > > > > > > print the warning from that. It really should just stop of it
> > > > > > > sees -EIO, only continue if EINVAL/ENOTTY is passed back.
> > > > > > >
> > > > > > > Try this little c program and report back what it tells you.
> > > > > > > Compile with
> > > > > > >
> > > > > > > gcc -Wall -o eject eject.c
> > > > > > >
> > > > > > > and run without arguments.
> > > > > > >
> > > > > > > #include <stdio.h>
> > > > > > > #include <stdlib.h>
> > > > > > > #include <fcntl.h>
> > > > > > > #include <string.h>
> > > > > > > #include <sys/ioctl.h>
> > > > > > > #include <linux/cdrom.h>
> > > > > > >
> > > > > > > int main(int argc, char *argv[])
> > > > > > > {
> > > > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > > > struct cdrom_generic_command cgc;
> > > > > > > struct request_sense sense;
> > > > > > >
> > > > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > > > memset(&sense, 0, sizeof(sense));
> > > > > > >
> > > > > > > cgc.cmd[0] = 0x1b;
> > > > > > > cgc.cmd[4] = 0x02;
> > > > > > > cgc.sense = &sense;
> > > > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > > > >
> > > > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > > > printf("eject worked\n");
> > > > > > > return 0;
> > > > > > > }
> > > > > > >
> > > > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > > > sense.asc, sense.ascq); return 1;
> > > > > > > }
> > > > > >
> > > > > > 2.4.27-mh1
> > > > > > notas:~# /home/cijoml/eject
> > > > > > ATAPI device hdc:
> > > > > > Error: Not ready -- (Sense key=0x02)
> > > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > > The failed "Start/Stop Unit" packet command was:
> > > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > > command failed - sense 2/53/2
> > > > >
> > > > > Your tray is still locked, are you sure it isn't mounted?
> > > >
> > > > Yes I am. This is written into console and I am logged only into this
> > > > console and I copied whole commands from login to eject... :(
> > >
> > > For the third time, don't trim the cc list! group reply please.
> > >
> > > Something else must be keeping your drive locked. What else do you have
> > > running in the system? It's enough if one app is just holding the drive
> > > open, the drive wont get unlocked on umount then.
> >
> > only thing which access cdrom is cpudynd and it access harddrive too....
> >
> > notas:~# fuser /dev/hdc
> > /dev/hdc: 8102
> > notas:~# ps aux|grep 8102
> > root 8102 0.0 0.1 1536 456 ? SNs 13:49
> > 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc
>
> well there you go, that is what is keeping the drive locked. cdrom
> cannot know which process locked it or not, all it knows is that the
> usage count is non-zero on umount, so it doesn't unlock the tray.

This is written on cpudyn website:
Disk Standby

Tired of playing with hdparm and /etc/apm to save battery in your laptop or to
make your desktop more quiet? Don't waste more time, you've found the
solution :-)

Since version 0.2.0, the program is also able to put the computer disks in
standby mode, if a given period has passed without any I/O operation.

It works very well even with Journaled File Systems such as Ext3, XFS and
ReiserFS.

Options "-t timeout" and "-h dev0[,dev1]..." control this behaviour. It is
__not__ activated by default, -t _or_ -h activated. Please check the usage
and edit /etc/init.d/cpudyn if you need to activate it at startup time.

This feature works also with Linux 2.4.X and 2.5.X since version 0.30

Example:

cpudynd -i 1 -t 60 -h /dev/hda,/dev/hdc

2004-09-16 12:41:37

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 14:24 Jens Axboe napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > > > >
> > > > > > > > As you can see, I dont't enter to directory...
> > > > > > > >
> > > > > > > > And output is included
> > > > > > > >
> > > > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO
> > > > > > > > (Input/output error)
> > > > > > >
> > > > > > > That's the important bit, the reason you get EINVAL passed back
> > > > > > > is because eject tries the floppy eject as well and decides to
> > > > > > > print the warning from that. It really should just stop of it
> > > > > > > sees -EIO, only continue if EINVAL/ENOTTY is passed back.
> > > > > > >
> > > > > > > Try this little c program and report back what it tells you.
> > > > > > > Compile with
> > > > > > >
> > > > > > > gcc -Wall -o eject eject.c
> > > > > > >
> > > > > > > and run without arguments.
> > > > > > >
> > > > > > > #include <stdio.h>
> > > > > > > #include <stdlib.h>
> > > > > > > #include <fcntl.h>
> > > > > > > #include <string.h>
> > > > > > > #include <sys/ioctl.h>
> > > > > > > #include <linux/cdrom.h>
> > > > > > >
> > > > > > > int main(int argc, char *argv[])
> > > > > > > {
> > > > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > > > struct cdrom_generic_command cgc;
> > > > > > > struct request_sense sense;
> > > > > > >
> > > > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > > > memset(&sense, 0, sizeof(sense));
> > > > > > >
> > > > > > > cgc.cmd[0] = 0x1b;
> > > > > > > cgc.cmd[4] = 0x02;
> > > > > > > cgc.sense = &sense;
> > > > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > > > >
> > > > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > > > printf("eject worked\n");
> > > > > > > return 0;
> > > > > > > }
> > > > > > >
> > > > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > > > sense.asc, sense.ascq); return 1;
> > > > > > > }
> > > > > >
> > > > > > 2.4.27-mh1
> > > > > > notas:~# /home/cijoml/eject
> > > > > > ATAPI device hdc:
> > > > > > Error: Not ready -- (Sense key=0x02)
> > > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > > The failed "Start/Stop Unit" packet command was:
> > > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > > command failed - sense 2/53/2
> > > > >
> > > > > Your tray is still locked, are you sure it isn't mounted?
> > > >
> > > > Yes I am. This is written into console and I am logged only into this
> > > > console and I copied whole commands from login to eject... :(
> > >
> > > For the third time, don't trim the cc list! group reply please.
> > >
> > > Something else must be keeping your drive locked. What else do you have
> > > running in the system? It's enough if one app is just holding the drive
> > > open, the drive wont get unlocked on umount then.
> >
> > only thing which access cdrom is cpudynd and it access harddrive too....
> >
> > notas:~# fuser /dev/hdc
> > /dev/hdc: 8102
> > notas:~# ps aux|grep 8102
> > root 8102 0.0 0.1 1536 456 ? SNs 13:49
> > 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc
>
> well there you go, that is what is keeping the drive locked. cdrom
> cannot know which process locked it or not, all it knows is that the
> usage count is non-zero on umount, so it doesn't unlock the tray.

And very important info is, that same harddisk image I use on about 25 laptops
in company and those works fine with it. Only this one doesn't. And I can't
send it to Acer, coz under WinXP cdrom works fine :(

Michal

2004-09-16 12:45:33

by Marc Ballarin

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Thu, 16 Sep 2004 14:19:38 +0200
"Bc. Michal Semler" <[email protected]> wrote:

> only thing which access cdrom is cpudynd and it access harddrive too....
>
> notas:~# fuser /dev/hdc
> /dev/hdc: 8102
> notas:~# ps aux|grep 8102
> root 8102 0.0 0.1 1536 456 ? SNs 13:49
> 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc
>
> nothing more

Well, one user is enough to block. Just remove /dev/hdc from cpudynd's
options. There should be little or no gain by adding your CD-Rom, anyway.

Regards

2004-09-16 21:49:06

by CIJOML

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

Dne ?t 16. z??? 2004 14:24 Jens Axboe napsal(a):
> On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > Dne ?t 16. z??? 2004 12:22 Jens Axboe napsal(a):
> > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > On Thu, Sep 16 2004, Bc. Michal Semler wrote:
> > > > > > > > notas:/home/cijoml# mount /cdrom/
> > > > > > > > notas:/home/cijoml# umount /cdrom/
> > > > > > > > notas:/home/cijoml# strace -o eject /dev/hdc
> > > > > > > > eject: unable to eject, last error: Nep??pustn? argument
> > > > > > > >
> > > > > > > > As you can see, I dont't enter to directory...
> > > > > > > >
> > > > > > > > And output is included
> > > > > > > >
> > > > > > > > ioctl(3, CDROMEJECT, 0xbffffac8) = -1 EIO
> > > > > > > > (Input/output error)
> > > > > > >
> > > > > > > That's the important bit, the reason you get EINVAL passed back
> > > > > > > is because eject tries the floppy eject as well and decides to
> > > > > > > print the warning from that. It really should just stop of it
> > > > > > > sees -EIO, only continue if EINVAL/ENOTTY is passed back.
> > > > > > >
> > > > > > > Try this little c program and report back what it tells you.
> > > > > > > Compile with
> > > > > > >
> > > > > > > gcc -Wall -o eject eject.c
> > > > > > >
> > > > > > > and run without arguments.
> > > > > > >
> > > > > > > #include <stdio.h>
> > > > > > > #include <stdlib.h>
> > > > > > > #include <fcntl.h>
> > > > > > > #include <string.h>
> > > > > > > #include <sys/ioctl.h>
> > > > > > > #include <linux/cdrom.h>
> > > > > > >
> > > > > > > int main(int argc, char *argv[])
> > > > > > > {
> > > > > > > int fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
> > > > > > > struct cdrom_generic_command cgc;
> > > > > > > struct request_sense sense;
> > > > > > >
> > > > > > > memset(&cgc, 0, sizeof(cgc));
> > > > > > > memset(&sense, 0, sizeof(sense));
> > > > > > >
> > > > > > > cgc.cmd[0] = 0x1b;
> > > > > > > cgc.cmd[4] = 0x02;
> > > > > > > cgc.sense = &sense;
> > > > > > > cgc.data_direction = CGC_DATA_NONE;
> > > > > > >
> > > > > > > if (ioctl(fd, CDROM_SEND_PACKET, &cgc) == 0) {
> > > > > > > printf("eject worked\n");
> > > > > > > return 0;
> > > > > > > }
> > > > > > >
> > > > > > > printf("command failed - sense %x/%x/%x\n", sense.sense_key,
> > > > > > > sense.asc, sense.ascq); return 1;
> > > > > > > }
> > > > > >
> > > > > > 2.4.27-mh1
> > > > > > notas:~# /home/cijoml/eject
> > > > > > ATAPI device hdc:
> > > > > > Error: Not ready -- (Sense key=0x02)
> > > > > > (reserved error code) -- (asc=0x53, ascq=0x02)
> > > > > > The failed "Start/Stop Unit" packet command was:
> > > > > > "1b 00 00 00 02 00 00 00 00 00 00 00 "
> > > > > > command failed - sense 2/53/2
> > > > >
> > > > > Your tray is still locked, are you sure it isn't mounted?
> > > >
> > > > Yes I am. This is written into console and I am logged only into this
> > > > console and I copied whole commands from login to eject... :(
> > >
> > > For the third time, don't trim the cc list! group reply please.
> > >
> > > Something else must be keeping your drive locked. What else do you have
> > > running in the system? It's enough if one app is just holding the drive
> > > open, the drive wont get unlocked on umount then.
> >
> > only thing which access cdrom is cpudynd and it access harddrive too....
> >
> > notas:~# fuser /dev/hdc
> > /dev/hdc: 8102
> > notas:~# ps aux|grep 8102
> > root 8102 0.0 0.1 1536 456 ? SNs 13:49
> > 0:00 /usr/sbin/cpudynd -i 1 -p 0.5 0.9 -l 7 -t 120 -h /dev/hda,/dev/hdc
>
> well there you go, that is what is keeping the drive locked. cdrom
> cannot know which process locked it or not, all it knows is that the
> usage count is non-zero on umount, so it doesn't unlock the tray.

Well I killed cpudyn and everything behaves the same... :(

# fuser /dev/hdc
#

Michal

2004-09-16 22:22:57

by Tim Fairchild

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Friday 17 Sep 2004 07:48, Bc. Michal Semler wrote:
> Dne ?t 16. z??? 2004 14:24 Jens Axboe napsal(a):

> > well there you go, that is what is keeping the drive locked. cdrom
> > cannot know which process locked it or not, all it knows is that the
> > usage count is non-zero on umount, so it doesn't unlock the tray.
>
> Well I killed cpudyn and everything behaves the same... :(

Sorry to butt in, but I'm curious to know if this is the mitsumi drive on the
Acer TravelMate 242X you are referring to?

Thanks.

tim

2004-09-17 08:32:32

by James Cloos

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

I gave this program a try as well.

Eject has been failing on my laptop for quite a few kernel
revisions. Even using the keyboard's Fn+F10 fails.

Failures come with an extended beep -- 2 seconds or so --
and a system pause (smbios I presume).

Your eject (edited only to use /dev/hdb) reports:

:; ~/src/jens-eject
command failed - sense 2/53/0

-JimC

2004-09-17 08:49:55

by Jens Axboe

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

On Fri, Sep 17 2004, James Cloos wrote:
> I gave this program a try as well.
>
> Eject has been failing on my laptop for quite a few kernel
> revisions. Even using the keyboard's Fn+F10 fails.
>
> Failures come with an extended beep -- 2 seconds or so --
> and a system pause (smbios I presume).
>
> Your eject (edited only to use /dev/hdb) reports:
>
> :; ~/src/jens-eject
> command failed - sense 2/53/0

Exactly the same issue, read the thread - your tray is locked, because
someone else has the drive open.

--
Jens Axboe

2004-09-17 09:00:42

by Meelis Roos

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

JA> Exactly the same issue, read the thread - your tray is locked, because
JA> someone else has the drive open.

In my case it's kscd thats' keeping the device open. kscd is in D state,
wchan is ide_do_drive_cmd.

Perhaps it's in D state because I once forced the CD open using cdrecod
-eject.

--
Meelis Roos

2004-09-17 20:27:49

by James Cloos

[permalink] [raw]
Subject: Re: CD-ROM can't be ejected

>>>>> "Jens" == Jens Axboe <[email protected]> writes:

Jens> Exactly the same issue, read the thread - your tray is locked,
Jens> because someone else has the drive open.

Odd, since there is no disc in it. lsof shows nothing; manually
looking thru /proc shows nothing.

Is there any other way to find what does?

Is there anything internal in the kernel that might have it open
w/o reporting that fact to userspace?

-JimC