How to avoid a situation where the system is too out-of-memory to even show or kill processes?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












I recently ran into a situation where a system was too out-of-memory to even run pkill or htop, or to even create a swap file.



(But somehow I could still SSH into the system, so at least I had a shell.)



I ended up getting lucky by noticing that I could run ps and kill if I don't run the login shell, but I'm wondering if I hadn't been lucky, what could I have possibly done to avoid rebooting, assuming I still had the login shell?



Is there e.g. to reserve a specific amount of memory for a particular executable to always be able to run? Or is there a way to kill processes from within Bash that doesn't require a fork?







share|improve this question




















  • look at this: unix.stackexchange.com/questions/44985/…
    – Arpit Agarwal
    Nov 11 '17 at 20:40










  • Probably this will help you: how to create a user with limited ram usage
    – FaxMax
    Nov 11 '17 at 20:43














up vote
0
down vote

favorite
1












I recently ran into a situation where a system was too out-of-memory to even run pkill or htop, or to even create a swap file.



(But somehow I could still SSH into the system, so at least I had a shell.)



I ended up getting lucky by noticing that I could run ps and kill if I don't run the login shell, but I'm wondering if I hadn't been lucky, what could I have possibly done to avoid rebooting, assuming I still had the login shell?



Is there e.g. to reserve a specific amount of memory for a particular executable to always be able to run? Or is there a way to kill processes from within Bash that doesn't require a fork?







share|improve this question




















  • look at this: unix.stackexchange.com/questions/44985/…
    – Arpit Agarwal
    Nov 11 '17 at 20:40










  • Probably this will help you: how to create a user with limited ram usage
    – FaxMax
    Nov 11 '17 at 20:43












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I recently ran into a situation where a system was too out-of-memory to even run pkill or htop, or to even create a swap file.



(But somehow I could still SSH into the system, so at least I had a shell.)



I ended up getting lucky by noticing that I could run ps and kill if I don't run the login shell, but I'm wondering if I hadn't been lucky, what could I have possibly done to avoid rebooting, assuming I still had the login shell?



Is there e.g. to reserve a specific amount of memory for a particular executable to always be able to run? Or is there a way to kill processes from within Bash that doesn't require a fork?







share|improve this question












I recently ran into a situation where a system was too out-of-memory to even run pkill or htop, or to even create a swap file.



(But somehow I could still SSH into the system, so at least I had a shell.)



I ended up getting lucky by noticing that I could run ps and kill if I don't run the login shell, but I'm wondering if I hadn't been lucky, what could I have possibly done to avoid rebooting, assuming I still had the login shell?



Is there e.g. to reserve a specific amount of memory for a particular executable to always be able to run? Or is there a way to kill processes from within Bash that doesn't require a fork?









share|improve this question











share|improve this question




share|improve this question










asked Nov 11 '17 at 20:02









Mehrdad

1,12831430




1,12831430











  • look at this: unix.stackexchange.com/questions/44985/…
    – Arpit Agarwal
    Nov 11 '17 at 20:40










  • Probably this will help you: how to create a user with limited ram usage
    – FaxMax
    Nov 11 '17 at 20:43
















  • look at this: unix.stackexchange.com/questions/44985/…
    – Arpit Agarwal
    Nov 11 '17 at 20:40










  • Probably this will help you: how to create a user with limited ram usage
    – FaxMax
    Nov 11 '17 at 20:43















look at this: unix.stackexchange.com/questions/44985/…
– Arpit Agarwal
Nov 11 '17 at 20:40




look at this: unix.stackexchange.com/questions/44985/…
– Arpit Agarwal
Nov 11 '17 at 20:40












Probably this will help you: how to create a user with limited ram usage
– FaxMax
Nov 11 '17 at 20:43




Probably this will help you: how to create a user with limited ram usage
– FaxMax
Nov 11 '17 at 20:43















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403943%2fhow-to-avoid-a-situation-where-the-system-is-too-out-of-memory-to-even-show-or-k%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403943%2fhow-to-avoid-a-situation-where-the-system-is-too-out-of-memory-to-even-show-or-k%23new-answer', 'question_page');

);

Post as a guest













































































UqvtsEc3zUw3kBDF o1SufJcl7AUEZlRWUUA W6Y AQPH zOZb16 l9KL9Ubt l2 ADf60JCtv 9lkXPcS
cmMoxAau

Popular posts from this blog

How to check contact read email or not when send email to Individual?

How many registers does an x86_64 CPU actually have?

Displaying single band from multi-band raster using QGIS