Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EJECT CD linux 3

Status
Not open for further replies.

Themuppeteer

Programmer
Apr 4, 2001
449
BE
Hello, I have a system that boots from its cdrom. Now, to perform upgrades, the cd has to be ejected. This does not
work because Linux doesn't want to eject himself,that is
quite logical.
How do we do it now ? ,we reboot the system, and then,before the system loads,we push the eject button and when you're fast enough, you'll get the cd. This is not the right way. What we want to do, is before the system reboots, so when all processes are finished, then the system should wait and the user can press the eject button.

Anyone know how to do this ? Any other tips ?

Please let me know :)



The Muppeteer.



Don't eat yellow snow...
 
Sure, do "cd /" then type "umount cdrom (or /mnt/cdrom)" you might have to be root to unmount the drive. Then once it's unmounted hit the eject button to eject the cdrom and reboot the box. d3funct
zimmer.jon@cfwy.com
The software required `Windows 95 or better', so I installed Linux.

 
Sorry, this does not work :-(
the error I get is:

umount: /mnt/cdrom: device is busy
The Muppeteer.



Don't eat yellow snow...
 
If you get the error device busy, it means that you have at least one process accessing the device. Find out which process and terminate it.
You do not have to unmount before you eject a cdrom. Just type : eject cdrom Too bad I.T. is not cash business

Luc Foata
Unix sysadmin, Oracle DBA
 
Of course I've already tried the eject cdrom ,and yes I've also used umount /mnt/cdrom , that all works,if you don't boot from your cdrom (!), if you do boot from your cdrom like I do, then there are always running processes on your cdrom :-( and you can't eject.
You should eject before the mount I guess, but I don't know how.
I would be glad,if only I could just eject the cdrom and let the system wait...halt...crash...whatever,as long as the cdrom comes out (I will reboot after that anyway).
Isn't there some sort of low level (assembler?) command to eject the cdrom without even wondering if linux runs on the machine ? (I don't know).

This really isn't a simple question,it is a serious problem.

I really hope somenone can help me...

Thnx.

The Muppeteer.



Don't eat yellow snow...
 
I boot from my cdrom, because:
It is a machine which runs linux, and it runs with the customer, it has no harddisk,only a cdrom and a small flash disk. There,the software keeps running until the customer
gets a new version of software to put on the machine. He just has to put in the new version cdrom and the rest happens automatically... The Muppeteer.



Don't eat yellow snow...
 
Could you make some changes to the machines shutdown routine to eject the tray after it unmounts, but before it halts completely?

Greg.
 
you mean in the /etc/rc.d/rc0.d/S01halt file ?
don't forget that you can't write on a cdrom...
btw. If anyone replies,I get a message and I will try to answer immediately ! :) The Muppeteer.



Don't eat yellow snow...
 
The only suggestion I can make here now is that you create a ramdisk so that once your system is loaded into ram you will have access to the cdrom. d3funct
zimmer.jon@cfwy.com
The software required `Windows 95 or better', so I installed Linux.

 
If the Linux station is on a network, you could boot from a network server using a floppy.

Hope this helps Too bad I.T. is not cash business

Luc Foata
Unix sysadmin, Oracle DBA
 
Thnx for all the replies, but nothing this far has really helped me a lot further (sorry)... I found someone on another forum with the same problem who solved it meantime.
I have been mailing around with mr Powell for a while and this is what he send me...

Inittab is the file that controls how your standard
init works. Init is just like any other executable in
Linux, it just happens to run at PID 1. When linux
boots and finishes initializing everything it looks
for init in /bin and /sbin on the root file system
(most likely your CD or a RAM drive). If it finds
init it runs init as PID 1. Init is then responsible
for running everything else, so in reality every
process and application is a child of init in Linux.

It's easy to write your own init, it's just like any
other C program. The tricky part is you have to do
everything init usually does for you, such as start X
windows.

I was a linux newbie when I started creating my
bootable CD but now I am very experienced. Writing
your own init and controlling Linux is surprisingly
easy to do.

So if you write your own init you'll be able to
unmount the CD-ROM and eject it when you shutdown or
reboot for the next CD you are putting in. Otherwise
you will not be able to eject the CD because Linux has
it mounted and it will never let you eject a mounted
CD (what a pain!).

See "man initrd" for more information on how Linux
boots.

Regards,
Paul
------------------------- The Muppeteer.



Don't eat yellow snow...
 
Hello,

I still have no ejected cdrom doh...
In the /etc/inittab file, the first action ecexuted,
is that the sysinit ?
I have put in the beginning of the file:

aa::sysinit:echo "HELLO WORLD !"
ab::sysinit:umount /dev/cdrom
ac::sysinit:eject cdrom

and I was hoping that this would be the first thing that would happen if the machine booted, but apperantly there happened a lot more before that,includeing the darn mount
of my cdrom...

I didn't get a 'device is busy' error now, but a
: /etc/mtab not found' error.

All help is welcome !! :)

thnx for all the replies.
The Muppeteer.



Don't eat yellow snow...
 
don't forget that the instruction right after the umount on shutdown is good enough to,...if I only knew where it was...

I forgot to mention that is see the 'Hello world' but its under the 'mounting cdrom'-message I get... The Muppeteer.



Don't eat yellow snow...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top