1 This is a howto on regaining control of your Linux computer when
2 you messed up your normal way to interact with it: keyboard, mouse,
3 video or network access.
5 # You can't interact with your computer anymore
7 You switched video mode and lost your mouse. Or the screen is suddenly
8 blank or freezed. Or you keyboard input echoes garbage. Or if you use
9 a server, you can't no more ssh to it.
11 Your computer is in most likelihood still working ok under the hood,
12 and there are quite always better ways to recover than to reboot cold.
14 ## Keyboard input echoes garbage
16 Most likely culprit is wrong configuration of your tty device. This is
17 not critical as you can always switch tty. In general, typing Ctrl-V
18 Ctrl-O will restore sane values.
20 ## Mouse invisble or unusable because moving erratically
22 The mouse invisible can happen inside some sophisticated applications
23 (e.g.: some versions of VirtualBox). The best way here is, after
24 possibly switching console, to stop the faulty application.
26 If the mouse seems moving too fast or too slowly, try changing mouse
27 parameters with tools like xset, or their highlevel desktop cousins.
28 For instance, in Gnome, look for Mouse in the System/Preferences menu.
30 An erratically moving mouse may indicate, as with keyboard garbage,
31 that the mouse device is badly configured; this used to happen in the
32 past with serial mice. This can also happen if you use the mouse both
33 in X and the console with gpm.
35 In nothing of the above solves the issue, restarting the X system may
38 ## Screen is freezed or blank
40 Switch to a console, stop cleanly your graphical applications if
41 possible, then restart the X system. If you use gdm, this is how to do
42 it on a Debian system:
44 /usr/sbin/invoke-rc.d gdm stop
45 /usr/sbin/invoke-rc.d gdm start
47 ## Nothing solves the issue: trying the network
49 If nothing of the above works, and you can't even get a text console
50 by hitting Shift-Alt-F1, you may connect to your computer through
51 telnet, ssh... That is, you have telnetd or sshd running on it. If not
54 ## Nothing solves the issue: trying a serial link
56 The file controlling where to start login processes is /etc/inittab.
57 You will have something like that inside:
59 1:2345:respawn:/sbin/getty 38400 tty1
60 2:23:respawn:/sbin/getty 38400 tty2
61 #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
63 The 2 first lines will give you a login prompt at the screen
64 (reachable with Alt-F1 and Alt-F2 in text mode, and with Shift-Alt-F1
65 and Shift-Alt-F2 in graphical mode).
67 The last one (in general commented out with the #), will start getty
68 on a serial device. Using a second computer running a tool like
69 minicom and linking it using a null modem to the first one, you will
70 get a login prompt on that second computer screen to allow
71 troubleshoot the first one.
73 What if the line is commented out, what is a null modem, what to do if
74 I have no serial port, and how do I configure minicom? Answers in next
77 # Computer control recovery preparation using a serial link
79 So my advice to maximize your odds to cleanly regain control of your
80 computer is to prepare for that case in advance, by allowing a serial
81 link login. A serial link login has not the security problem of
82 allowing network access.
84 ## No serial port on my computer
86 Except for servers, the rule now is no serial port. But the rule is
87 also to have USB everywhere, and luckily hardware converters
88 serial/link exist. Linux has drivers for a lot of these converters,
89 and you should have no problem getting one, see for instance:
90 [[http://www.gooze.eu/catalog/embedded-components/cables]]
92 The Linux driver creates a device name like /dev/ttyUSB0 instead of
95 ## Starting a login process on my serial port
97 You have to edit and uncomment the line in /etc/inittab. Line:
99 #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
101 becomes in case of a serial/usb converter:
103 T0:23:respawn:/sbin/getty -L ttyUSB0 9600 vt100
105 You must force the init process to take into account the modified file
112 The link above about serial/usb converters offers also null modems.
113 If you don't mind a bit of soldering, it's quite easy to
114 [build one yourself](http://www.lammertbies.nl/comm/info/RS-232_null_modem.html).
116 ## Minicom configuration
118 What is needed at the other end of our serial link is a dumb serial
119 terminal. It happens that if you don't have one in your attic, you
120 can emulate one with a second computer. Minicom is one of these
123 At that point, you may also discover that you don't have a serial port
124 either on that second computer! Time to go shopping for a second
125 serial/usb converter... It's of course possible to have a serial port
126 on the blocked computer and none on the terminal emulator.
128 So when you have all the hardware, you can install and configure
129 minicom. Notice that you will have to run minicom as root, or give
130 lax permissions to your serial devices. Minicom configuration file
131 is called /etc/minicom/minirc.dfl under Debian and should contain:
142 You should only have to change the first line to adapt of your specific serial device name.
143 You may have to hit CR to get the login prompt.
145 ## If everything fails
147 Nothing of the above works? You are in for a reboot, but if the
148 keyboard driver is still alive, you can still get a more a less clean
149 shutdown using the [SysRq](http://www.linuxhowtos.org/Tips%20and%20Tricks/sysrq.htm).