super root shell/mode/api
Hello!
I'm a C/C++ Open Source Software Developer / SysAdmin.
Excuse my English, it's not my first language.
First thank You for Linux, I'm using it since 1998!
Some days ago I've lost some important data on a Linux machine, because of an out of memory and swap situation.
When I was coding on c-64 and it crashes I pressed my Cartridge button and could save what I wanted, execute code and so on. Some may remember this old school times :)
Now 20 years has passed and a web page can block my whole machine?!?!?!?
1989 c-64 higher data safety then 2009 Linux?!?!?
I've read the OOM discussion and I know that it's not easy to find a perfect solution, but don't implementing any solution is the worst solution at all.
I know there is an OOM handling, but the only thing that happened was the hard disk light flashing for more or less 30 minutes and I was forced to press the reset button and my data was lost :(
I think it would be simply awesome to have a Linux Kernel mode similar to the c-64 cartridge concept.
Maybe call it in honor to the c-64 'cartridge freeze mode' or so :)
You hit a button combination and you enter in a Linux Kernel ncurses menu and/or shell and/or GUI, where you can for example:
save processes, memory e.g. from 0x00000 - 0xFFFFF
protected ssh/telnet access
examine memory dumps
hex editor
assembler/disassembler
statistics
password protected area
anti root-kit/virus tool (the 'cartridge freeze mode' can be loaded from protected memory or even protected media for this case) anti virus modules
swap out processes that take too much memory
all thinks you can do with SysRq Keys
terminate processes
search for graphics
screen-shots
backup
hibernation
core dumps
top like screen
virtual machines
grep text in ascii, unicode
continue everything: freeze and defreeze
the shell could be accessible always without freezing everything, like a super root shell/mode/api
you can load user executables/modules for this mode too
That would rock!
Please consider doing something similar!
Thanks for reading!
Regards
Andrea Gedda
Quoted 4 lines · Andrea
I know there is an OOM handling, but the only thing that happened was the hard disk light flashing for more or less 30 minutes and I was forced to press the reset button and my data was lost :(
One trick I found very useful to make OOM much less painful is to make the swap partition small (not zero though).
The traditional suggestion of 2x RAM is far too large on modern systems and since Linux is rather inefficient at swapping having so much swap space just prolongs the death struggle.
With a smaller swap partition (not more than 100-200MB) the OOM killer kicks in relatively quickly when something goes wrong and kills the offending process.
Quoted 7 lines
I think it would be simply awesome to have a Linux Kernel mode similar to the c-64 cartridge concept.
Maybe call it in honor to the c-64 'cartridge freeze mode' or so :)
You hit a button combination and you enter in a Linux Kernel ncurses menu and/or shell and/or GUI, where you can for example:
You could do all that today by using a suitable kexec/kdump kernel setup with sysrq-C.
The kdump kernel can do all that based on the image of the previous kernel. Some of it is very easy (e.g. for disassemble just run "crash"), other parts don't make sense (e.g. swap out processes -- the parent kernel already did that)
Traditional distributions just dump the image, but there's no principle reason it couldn't do more.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 9 lines
Some days ago I've lost some important data on a Linux machine, because of an out of memory and swap situation.
When I was coding on c-64 and it crashes I pressed my Cartridge button and could save what I wanted, execute code and so on. Some may remember this old school times :)
Now 20 years has passed and a web page can block my whole machine?!?!?!?
Your distribution failed to configure your system sensibly in that case. Linux has supported a strict overcommit mode for some years, and in that mode a process isn't permitted to drive the system so far out of memory it locks up or hangs.
You can also set some limits on a given process (which with certain versions of firefox - especially old ones or if you have the flash plugin is a good idea).
First call - ask your distribution why it isn't using strict overcommit.
Quoted 4 lines · Alan Cox
Your distribution failed to configure your system sensibly in that case. Linux has supported a strict overcommit mode for some years, and in that mode a process isn't permitted to drive the system so far out of memory it locks up or hangs.
Err... strict overcommit is vm.overcommit_memory=2, right? That means no overcommit at all (as far as the documentation goes, anyway).
Which distros enable that by default?
Quoted 3 lines
You can also set some limits on a given process (which with certain versions of firefox - especially old ones or if you have the flash plugin is a good idea).
Indeed. Or just limit the users, so that root always has room to work.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 4 lines · Alan Cox
Your distribution failed to configure your system sensibly in that case. Linux has supported a strict overcommit mode for some years, and in that mode a process isn't permitted to drive the system so far out of memory it locks up or hangs.
Err... strict overcommit is vm.overcommit_memory=2, right? That means no overcommit at all (as far as the documentation goes, anyway).
exactly
Quoted 1 line
Which distros enable that by default?
I don't know if mainline distros do this, but some distros dedicated to embedded systems have been using that for ages, almost since Alan published his first overcommit patch a long time ago. It's the only way to reach very long uptimes on servers, as it also protects you against your own mistakes (eg: stupid actions such as "vi access.log" when the file is larger than memory).
Willy
Quoted 7 lines · Willy Tarreau
I don't know if mainline distros do this, but some distros dedicated to embedded systems have been using that for ages, almost since Alan published his first overcommit patch a long time ago. It's the only way to reach very long uptimes on servers, as it also protects you against your own mistakes (eg: stupid actions such as "vi access.log" when the file is larger than memory).
Shouldn't the vi case be taken care of by good ulimits? Certainly that's what I've seen openSUSE do by default (although strangely SLES 10 doesn't)...
The last I heard about overcommit was that there were always some legitimate programs that could run that would be stopped by having it on (evolution always seemed to be mentioned for some reason). As such it would be surprising to see any of the desktop distros enabling it by default.
I've been wondering for a while with my EeePC if strict overcommit is a no brainer if you are running without swap... In such systems the only things that can be forced out of RAM are mmap'd files (?) so does overcommit even happen?
Signature · 1 line
Sitsofe | http://sucs.org/~sits/