Ubuntu – How to open tty or execute some script when the shortcut Ctrl+Alt+F[1-6] doesn’t work and X11 is partially frozen but system is still working

freezegnomettyUbuntu

I'm using Ubuntu 10.10 with Gnome on Acer Aspire One netbook. The X11 or just some parts of Gnome like panels and partially windows (details described below) are frozen which doesn't allow to do anything with mouse (although the cursor can move, but clicking anywhere brings no results – panels are frozen (the clock is standing etc) and windows minimized), but generally the system, all processes (obviously except gnome shell) and hardware are working right – all leds (main hard disk, external swap disk, network) are blinking from time to time and there is a power supplied to USB ports so for example a keyboard is working and also some shortcuts like Super+D (minimizing and maximizing all windows but all I can see is only one blank window with plain surface and no contents displayed, the other windows I probably moved to another workspace with a shortcut or they are not showed due to the problem) but Ctrl+Alt+F[1-6] unfortunately not and I don't know the reason but I assume it probably never have been working before (I just had no opportunity to use it in the past and check if it works) even when it's pressed on external USB keyboard.

The things I already used to try are:

  • Firstly just waiting hoping that Gnome will handle it alone because it happened during doing some windows' actions like moving. minimizing and so on.
  • Secondly the shortcut Alt+F2 during the focus was on desktop and then typing certain commands to run (like trying to force playing some sound to ensure that system is reacting, xdotool to emulate shortcut opening tyy or just running sudo chvt) with no seeing what I'm doing and typing in hope that it's working in background but sadly it brings no effects.
  • Then some other Gnome's shortcuts but they are not working in such circumstances or I just can't see their results by now.
  • Finally I used to try to execute a bash script from pendrive with autorun.inf file inside – I'm aware that it couldn't run automatically after plugging in but as I suppose it should probably ask in dialog box what to do after detecting it and then I would try to allow execution trying to choose "run" option not seeing it but acting step by step from memory like I observed on the second machine and executing playing sound as a proof the system is alive and then try it with some more useful commands as I mentioned above but I have another computer with identical OS and configuration on which I verified it and it probably wouldn't ask – I assume that the frozen one would react in the same way – it just opens directory window when there is no autorun there or do nothing when autorun file exists and is detected – however please notice that the pendrive is mounted automatically – maybe it still would be helpful somehow.

The thing which I also tried is obviously Ctrl+Alt+F[1-6] but it's sadly not effective too. I have no idea why it doesn't work but I think there is no chance to fix it right now or maybe I don't know about something.

I'm looking for even extreme solutions – the point is how can I execute even small piece of code in such a case to execute chvt or xdotoll or eventually hibernate processes and copy RAM contents to external disk to secure unsaved data?

Is there a possibility or any even theoretical chance to get an access to the computer/tty through making direct connection via crossover network cable between two computers if I've never installed or configured anything related to it before now? Or is there any other way to make connection with the frozen computer to get a remote access and control it in my situation?

I have an external automatically mounting CD-ROM, maybe that could be used for something helpful? Moreover I can see and hear a reaction after plugging something to USB port because the hard disk start working hard for a moment.

The main aim is to open tty or run script with the same commands that I would typed there like as a first of all refreshing gnome-shell or then some other marked above because system is still working. That's why I believe that there exist more reasonable and less drastic methods than cold boot attack which I've just read about and there is no need to do it.

The computer will be working until I will find some satisfying solution allowing bringing back a stability or although save a RAM state which is just one line of code but I need to know the way to execute it.

EDIT: I've got a new idea – the 4GB swap partition is mounted and still working as well as system. The idea is to run something big which would need and use almost all RAM memory during the rest of processes are unused and sleeping, causing moving the rest of contents to the swap partition, then unplug the external USB drive which work as swap and then trying to extract some text strings from it. The computer has only 1GB of RAM so it may be possible. How about it? It's still a necessity to execute some code or commands but maybe is it possible to do it somehow with some shortcuts? I mean executing any active, hard working, RAM consuming processes. How do you rate a reasonableness and generally what do you think about it? How would I do it?

I forgot to mention that the computer is all the time connected to my WLAN and connection is not broken.

Best Answer

GNOME cannot interfere with Ctrl-Alt-F[N], since this is caught by the kernel, which implements VT switching. I.e., those key events never reach userspace, which is why you/your DE/any DE cannot override them or use them for some other purpose.

So if you can't switch VTs, there is a system level issue. In my first comment I said this sounds like panicing/busy looping, which it does. However, having that last 8 hours is pretty weird -- my next thought is it is I/O failure. Since you are using ubuntu 10.10, I presume this is an older netbook and the problem is new, even though you are still running the same old software. You also mention the problem has happened before but perhaps has been getting more serious, which again points to (disk) I/O failure -- your harddrive is dying. This creates a very nasty, unavoidable snag if the root filesystem is involved.

Unfortunately, you won't be able to tell for sure until you can look at the system logs. Right now, even if you had sshd running, I suspect you would not be able to get in because, again, it's the whole system that's frozen.

You can try shutting down and rebooting (moral of story: save work frequently, and save to some backup medium -- cloud, usb stick, whatever -- often as well). If it really is disk failure, you may be lucky to get anything off the disk. If you can reboot, the first thing you should do is:

cd /var; tar -cjf log

Then save /var/log.tar.bz2 to something so you can look at the logs on another computer, because (once again) if it is disk failure, this one is not going to be much good until you replace it. You may be able to duct-tape the problem by running e2fsck -cc (see man e2fsck) on the partitions, but that requires mounting the disk without the system on it running (e.g., if you can boot a liveCD from the external CD-ROM).

Related Question