CD is ejectable after boot [solved]

Questions about problems with your hardware. For example, if you the kernel hangs during boot because of an hardware failure or if you have a problem with a driver not working or missing.
rodwright
Posts: 6
Joined: 03 Mar 2015, 20:19

CD is ejectable after boot [solved]

Postby rodwright » 27 Mar 2015, 04:41

In previous versions of SystemRescueCD, after booting with default options, the eject button on the CD drive was disabled. This was a good thing, since it is still mounted on /livemnt/boot. Now, with version 4.5.1, pressing the eject button ejects the CD, even though mount still shows it being mounted. This causes I/O errors when attempting to execute some programs.

I can create a custom CD where I have edited /lib/udev/rules.d/60-cdrom_id.rules to comment out the line containing DISK_EJECT_REQUEST and that prevents the eject button from working. However, if I boot that custom CD using a docache option, I can't eject the CD with the button!

Is there a way to enable the button if the disk is not mounted and disable it if it is mounted?
Last edited by rodwright on 27 Mar 2015, 20:32, edited 1 time in total.

rodwright
Posts: 6
Joined: 03 Mar 2015, 20:19

Re: CD is ejectable after boot

Postby rodwright » 27 Mar 2015, 20:31

Ok, after some digging, I figured out what's going on. It's because of a bug in udev. To work around the bug, you'll need to create a custom cd. After extracting it, edit the file /mnt/custom/customcd/files/lib/udev/rules.d/60-cdrom_id.rules. In the file, you'll see a line that says:

Code: Select all

ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"


Change it to say:

Code: Select all

ENV{DISK_EJECT_REQUEST}=="?*", RUN+="/usr/bin/eject $devnode", GOTO="cdrom_end"


then continue creating your custom cd. When you're done, the old behavior will return (ignore the eject button if media is busy, i.e., mounted and in use by the kernel, but unmount and eject it if the kernel isn't using it).

The string after the RUN+= in the line above is the command that udev runs when it detects a button press event. The problem was that udev's own command (cdrom_id --eject-media) wasn't asking the kernel if it was still using the drive, it just ejected it. The kernel wouldn't know anything was wrong until it tried to access the media, at which point you'd get I/O errors. The workaround is to not use udev's command but use the /usr/bin/eject command. It in turn runs umount, which will return nonzero exit status if the media is busy causing /usr/bin/eject to abort ejection.

This bug is supposedly fixed in a later version of udev, but it was easier for me to use this workaround than start over with a newer SystemRescueCD.


Return to “Hardware and drivers”

Who is online

Users browsing this forum: No registered users and 3 guests