Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Could anyone explain what happens in system after unplugging CD-ROM during working with LiveCD session?

Suppose that I'm using Ubuntu LiveCD and suddenly by accident the CD-ROM disconnect for a matter of second because of for example power outage in the case of external devices or just opening the CD tray if the OS allows to do it. Assume that after a while the CD-ROM is plugged in again.

Can anyone explain what exactly happens then, why the OS stops or rather is working but not as before it and how, if it's possible, the stability and usefulness can be brought back and user can continue working with?

According to my observations based on Ubuntu LiveCDs (versions under 12, the kernel version is probably 2.6.XX) the system reaction is like following:

  • all applications in X desktop disappear (I think it's due to automatic sending a kill signal to all processes as if the OS wanted to shut down but actually it seems to wait for something) and it looks like only the background image with the cursor which can be moved all the time
  • all TTYs are available and can be displayed but there are only error messages there like INFO: task <process name>:<pid> blocked for more than 120 seconds and SquashFS error: unable to read [...]
  • all the time I can see blinking '_' and I can type something but pressing enter just make it skipped to the new line and obviously the OS doesn't execute it
  • terminal's shortcuts for cancelling and quit current process also don't work
  • magic SysRq combinations are generally working and I can see the actual output but I don't know which of them would be useful in this case

Can anyone explain this reaction and tell what exactly these errors mean? And what can one do then to fix it - is there any way for that and why not, if so?

Here: What does "INFO: task XXX blocked for more than 120 seconds" exactly mean on Linux? I've just read that "if a task is blocked, it waits for resources to become available again". So if I got it correctly it's waiting for resources - is it true or just wrong interpretation and it will wait endlessly - CD-ROM is surely plugged in again as fast as possible. How to understand it?

I know that processes are gone (or "blocked" as error messages are suggesting?), but how about files in the ramdisk, are they still there until reboot? Is this possible to access them somehow? Or for example just extract text strings and so on?

There is a magic SysRq shortcut which remount filesystems - are there any chances that it would help in such situations or should be tried eventually at the end after other trials? If the CD is working as a virtual fs, what effects can bring remounting filesystems in that case?


@bersch: It's surely a real situation - rare but possible. It happened to me so it happens and I just consider what should or actually what can I do next time - I like to understand things happen around me. It can happen when you're using for example a server machine with UPS and no optical drive or just laptop or netbook with battery power supply and with no CD-ROM built in and in both cases you have to use external CD-ROM connected to wall power supply to run LiveCD. I know that it's possible to boot through network or just use USB stick instead of CD but somethimes using LiveCD is necessary and irreplaceable. So just imagine what happen when in such circumstances there is a power outage and what's the effect of that: the computer - I mean all harware except CD-ROM is still powered on and working well due to UPS or battery but CD-ROM is already not so. It's rare because it's obviously impossible when you're using a standard laptop with CD-ROM inside which would be all the time powered as well as the rest of hardware from battery in such situation or standard pc which would shut down when the power is off the same as CD-ROM because of sharing a source of power supply and it can happen accidentally only in mentioned above cases. I really don't know why developers didn't predict it and did not include any solution for such eventualities. It's untypical but still possible and questions are not about only a hypothetical situation.

I would really like to know what then exactly happen in the system and how it's woring in this state: what's working and what's not, what can be done, if filesystem with files still exsists on ramdisk, if it can be restored, if processes are blocked or killed and so on - generally speaking how it works.

Where can I find out some more about it?

share|improve this question

1 Answer 1

  • Good Live System do not allow to unplug its CD, they are usually locked.
  • It should be also not possible to umount a CD, when there are some processes relay on it.

So if you however unplug your LiveCD and plug it in back, the OS does not check if you have plugged the same CD and your system will crash. The question why nobody implemented your desired behaviour till now I can not answer. Perhaps because everybody knows to not unplug a Live CD. However I think it could be possible with another underlying file system which can check if it's the same CD. And of course the network filesystems can recover from network failures because they are authenticate before reconnect.

There are blocking and non-blocking read modes. If you open a device or file you can decide what to do. As you already explained the process waits for input on blocking mode. On non-blocking mode the process reads a bunch of data and returns, even if there are no input it returns with a 0.

You describe a situation that never occurs under normal conditions, so it is not of interest. To avoid it try not to open the CD-ROM while a Live CD is running. Whereas I asking myself how it could be possible and is your question real or a hoax?

share|improve this answer
    
Danke! I really appreciate your reply but unfortunately it's not the answer I expected and I'm still looking for. The answer for your question is a bit too long to send it as a comment so I had to edit the main question - please look for it there. Generally I disagree that it "never occurs under normal conditions" - examples I wrote above deny it. –  user277216 Feb 6 at 3:16
    
@bersch it's simple to be possible: USB CD drive. Just unplug it from USB port, and you're done. No SCSI command will make the cable melt into the port. Another way, even with IDE/SATA devices would be using emergency CD extraction key: every CD/DVD drive has a little hole near/on the tray, plugging some pin into which will eject the (although if it's rotating, this will violently stop it and possibly damage the CD or the drive). –  Ruslan May 10 at 19:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.