Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a customized Linux distro that I am able to boot from CD-R, where using start-up scripts I am able to run udev to discover and setup my device nodes, and then install a CLFS distro onto the HDD. Everything goes well except when I am "done".
I am unable to successfully eject the CD-R. When I attempt to do so (using the 'eject' command), the CD-ROM tray opens up and then immediately shuts close again, never giving me a chance to physically remove the CD-R.
The interesting part is that once this happens, I still have a command prompt and a shell running, however I cannot run any system commands. It is as if the CD-R is no longer mounted, which probably is the case.
Anyhow, what can I do to get the CD-ROM tray to remain open so that I can have an opportunity to remove the media?
Btw, my CD-ROM device is /dev/hdb and /dev/cdrom has been setup properly using udev and related rules. So everything is good with respect to that.
Last edited by dwhitney67; 01-21-2008 at 11:31 PM.
eject is supposed to unmount but run..... man eject....... you may notice -v switch
[gordy@gs ~]$ eject -v cdrom
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/hda'
eject: `/dev/hda' is mounted at `/media/cdrom'
eject: unmounting device `/dev/hda' from `/media/cdrom'
eject: `/dev/hda' is a multipartition device
eject: trying to eject `/dev/hda' using CD-ROM eject command
eject: CD-ROM eject command succeeded
2) in fstab....change to users,blah blah 0 0 in lieu of user (root) using root powers and see if that makes a difference.
I found an error in one of my scripts, corrected it, and now I cannot get the CD-tray to open at all.
Using your advice, I ran the eject command with the "-v" option. Here is the output I received:
Code:
/usr/bin/eject: device name is '/dev/cdrom'
/usr/bin/eject: expanded name is '/dev/cdrom'
/usr/bin/eject: '/dev/cdrom' is a link to '/dev/hdb'
/usr/bin/eject: '/dev/hdb' is not mounted
/usr/bin/eject: '/dev/hdb' is not a mount point
/usr/bin/eject: '/dev/hdb' is a multipartition device
/usr/bin/eject: trying to eject '/dev/hdb' using CD-ROM eject command
/usr/bin/eject: CD-ROM eject command failed
/usr/bin/eject: trying to eject '/dev/hdb' using SCSI commands
/usr/bin/eject: SCSI eject succeeded
Don't let that last line fool you. As I stated earlier, the CD-tray did not eject!
Any ideas as to where else I can focus on to resolve this issue?
P.S. The CD-ROM drive is a Plextor PX-230A IDE/ATAPI unit.
Last edited by dwhitney67; 01-23-2008 at 08:29 AM.
do you mind posting the script that you fixed please, in case others can suggest an alternative in your intentions...
2) post all lines of cd/dvd removeable media in your /etc/fstab
and are you using HAL daemon to automount or udev or manual commands.
3) leaping ahead...its messy but without fixing your script...delete your fsab lines...change hal rules not automount and use manual commands then a manual umount should work.
I use users...not user in fstab to allow normal user to mount/umount cds
To fulfill your request, I've provided the information below. Please remember that I am booting from a CD, and then attempting to eject such CD when I am done.
# Used only when booting from CD-ROM
#
# file system mount-point type options dump fsck
# order
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/hdb /cdrom iso9660 ro,noauto 0 0
/dev/hdb /mnt/cdrom iso9660 ro,noauto 0 0
For /to_install/do_install_wrapper.sh:
Code:
#!/bin/sh
#
# File: do_install_wrapper.sh
#
# Import common functions
. /to_install/do_common.sh
# enable udev (device discoverer)
KickoffUdev
# run the script that will launch the setup user-interface
/to_install/do_install_or_update.sh
# allow writes to the HDD to be flushed
sync
sync
sync
# sleep for an arbitrary amount of time
sleep 3
echo "************************************************************************"
echo "************************************************************************"
echo "****"
echo "**** Please reboot the system after you have removed the CDROM."
echo "****"
echo "************************************************************************"
echo "************************************************************************"
# eject the CD-R from the drive
eject /dev/cdrom
# don't let the script exit; this will mask the "kernel panic" that would
# otherwise ensue.
while true
do
sleep 60;
done
For /to_install/do_install_or_update.sh (with non-relevant stuff snipped out):
Code:
#!/bin/sh
#
# File: do_install_or_update.sh
#
# Import common functions
. /to_install/do_common.sh
# setup /tmp and /var/log as ramdisks
mke2fs /dev/ram0 >/dev/null 2>/dev/null
mke2fs /dev/ram1 >/dev/null 2>/dev/null
mount /dev/ram0 /tmp >/dev/null 2>/dev/null
mount /dev/ram1 /var/log >/dev/null 2>/dev/null
...
export LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/lib:/usr/local/qt/lib
export PATH=/usr/X11R6/bin:$PATH
# Determine the video chip-set used on the system. VIDEO is returned.
DetermineVideoType
/usr/X11R6/bin/xinit /bin/UpdateUI $CDVERSION $PARAM -- /usr/X11R6/bin/X -config /etc/X11/$VIDEO/xorg.conf 2>/dev/null
For /to_install/do_common.sh:
Code:
#!/bin/sh
# File: do_common.sh
#
# Purpose: Defines common function(s) uses by the "do" scripts
#
PATH=$PATH:/usr/X11R6/bin
# Function: KickoffUdev()
#
# Runs the udev daemon to setup the device nodes appropriate for the
# hardware in the system.
#
KickoffUdev()
{
echo "Mounting kernel-based file systems..."
mount -n /proc
mount -n /sys
echo "Starting udevd..."
mount -n -t tmpfs -o mode=0755 udev /dev
cp -a /lib/udev/devices/* /dev
chmod 1777 /dev/shm
echo "" > /sys/kernel/uevent_helper
udevd --daemon
echo "Performing Coldplugging..."
mkdir -p /dev/.udev/queue
udevtrigger
udevsettle
}
# Function: DetermineVideoType()
#
# Determines the video chip-set used on the running system, and
# returns the type in a variable called VIDEO. Possible return
# values for VIDEO are: ati, chips, intel, or vesa.
#
DetermineVideoType()
{
VIDEO=vesa
if [ `scanpci | grep "ATI" -c` -eq 1 ]
then
VIDEO=ati
elif [ `scanpci | grep "Chips and Technologies" -c` -eq 1 ]
then
VIDEO=chips
elif [ `scanpci | grep "82852/855GM" -c` -eq 3 ]
then
VIDEO=intel
fi
}
The final part of the do_install_or_update.sh script launches X11 and a Qt GUI that prompts the operator whether to install the OS and proprietary applications to the HDD, or to update, etc. The final option available is to "Cancel".
When I select "Cancel", the GUI app terminates, followed by X11, and then control is returned to do_install_wrapper.sh. I see the "Please reboot the system..." banner but the CD-R is never ejected.
My system does not use HAL, thus there is no automounter.
I think that your problem may be that you have /dev/hdb listed twice in /etc/fstab. Try removing the first of the two lines (/cdrom), reboot, and see what happens.
I agree but is this script on a re-mastered cdr or on the hard drive...your first post, I thought the cdr was used to install an os onto the hd....now I am not so sure.
btw, that looks like an oldish kernel...I assume http://trac.cross-lfs.org/ allows you to update to a new kernel if you wanted to?
you are more advanced than me...I have never used LFS.
I think that your problem may be that you have /dev/hdb listed twice in /etc/fstab. Try removing the first of the two lines (/cdrom), reboot, and see what happens.
--------------------------
Steve Stites
I did this, and then repeated again with by removing the second entry as well, and still no joy.
I agree but is this script on a re-mastered cdr or on the hard drive...your first post, I thought the cdr was used to install an os onto the hd....now I am not so sure.
btw, that looks like an oldish kernel...I assume http://trac.cross-lfs.org/ allows you to update to a new kernel if you wanted to?
you are more advanced than me...I have never used LFS.
The issues I am having pertain to the OS that is running on the CD-R, not the HDD. With operator input, the scripts running on the CD-R will install a CLFS (Cross-Compile LFS) OS onto the HDD. When the process is done, and the system is rebooted without the CD-R, the distro on the HDD boots fine and from there, the CD-ROM drive works like a charm.
The OS running on the CD-R is a morph of the CLFS. In lieu of using a huge suite of packages, I rely on BusyBox for my shell and various system utilities. The 'eject' command is not part of BusyBox; it is provided by the eject-2.1.5 source package.
News update... I have found that I can eject the CD-R if I place two 'eject' statements back-to-back in my script. When the second 'eject' is called, the "CDROM eject" command works, as opposed to the first time where it fails and 'eject' issues a "SCSI eject" command.
Now for another problem, if I install the CLFS distro onto the HDD, and following this the two eject commands are issued, then half of my screen is filled with error messages similar to the following:
I'm leaving to go on holiday tomorrow, and I won't be able to return to this problem for a few weeks. For now, I've decided to use the kludge I discovered earlier.
For my do_install_wrapper.sh script, I have modified it to use two 'eject' commands. This forces the CD-ROM tray to eject the disk. Here's the modified portion of the script:
Code:
...
echo "************************************************************************"
echo "************************************************************************"
echo "****"
echo "**** Please reboot the system after you have removed the CDROM."
echo "****"
echo "************************************************************************"
echo "************************************************************************"
# eject the CD-R from the drive
# The rationale for having 2 eject calls is to convince the system that we want
# our CD-R to be ejected. With only one eject call, such will not happen. For
# some reason, the first attempt clears settings within the drive which then
# allow for the second call to succeed.
eject -s /dev/cdrom >/dev/null 2>/dev/null
eject -r /dev/cdrom >/dev/null 2>/dev/null
# don't let the script exit; this will mask the "kernel panic" that would
# otherwise ensue.
runForever=true
while [ $runForever = true ]
do
runForever=true # a statement is needed; this is as good as any.
done
No I was not able to return to this issue. It would be nice to resolve, however I just learned to accept it. The issue will only be seen at the factory (or by service personnel) and never by the client. Nevertheless, it would be nice to clean it up.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.