tcpconsole is a network emergency console for Linux (as it uses lowlevel Linux specific systemcalls). When your system no longer responds to ssh/telnet logins, you can still connect to tcpconsole (using standard telnet) and get a screendump of the physical console, the process list, do sysrq calls (for system debugging and crash recovery) and list the contents of the Linux kernel message buffer (dmesg).
The program does not do any forking and as little as possible other resource-allocation.
Please note that this is intended to be used on a management LAN only as the password is transmitted in clear-text accross the network (as using SSL would require all kinds of resources).
It uses the following techniques to become as much available as possible:
- it locks all memory pages in physical RAM so that if one or more processes are claiming all memory, tcpconsole won't be swapped out
- it gives itself (for that it must run as root) maximum priority (by setting its nice value to -20 and by setting the schedule priority to realtime (if available)) in case one or more processes is using all CPU time
- it does not fork any child processes (in case the process table is full)
- if possible it opens all required files and allocates all required memory at startup (again for when physical memory gets scarce)
- a decent C compiler (like gcc or tcc)
- glibc 2.15+ / musl 1.1.5+ (or so)
- make
- systemd (it should work with other init systems too, but systemd is the only option for now)
- mounted proc filesystem
- Linux 3.4+ with the following options enabled (these are defaults nowadays unless you have a custom kernel):
- CONFIG_MAGIC_SYSRQ=y
- CONFIG_PRINTK=y
- CONFIG_VT=y
- CONFIG_VT_CONSOLE=y
make
make install
$ nc server.lan 4095
"'Password: Y0urP@s$w0rd
Enter 'h' for help
(server.lan) emergency console >