You are not logged in.

#1 2015-11-19 14:22:47

dext
Member
From: Poland, Kraków
Registered: 2008-02-01
Posts: 98

Changing nice for root and login

I have an irritating problem since I use Chromium. From time to time it eats all my memory, and then if I open some big complicated page, or many pages at once, I basically loose control over my system - everything freezes.

What I have to do, is to change terminal - this works - then login as root and kill -9 chromium. But this is almost impossible. Login timeouts after 60 seconds, so waiting patiently after typing in the password doesn't help. Then after I even manage to login, typing and executing kill command is a big pain.

Can I somehow change system configuration, so login, every root terminal and it's children have nice -20? The basic idea is, that whatever is happening to the system, I should always be able to login as root and do stuff.

Offline

#2 2015-11-20 09:36:03

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Changing nice for root and login

Although, I think this it is a really bad thing to do (see below); I answer your question. I do not think there is a direct way to have a nice -20 as root at every login; but you can easily do the folling trick. Make a script /usr/local/bin/powerbash with the following content:

#! /bin/sh
exec nice -20 /bin/bash --login

and do a chsh to change your login shell by /usr/local/bin/powerbash. Note that you may have to boot with the noautogroup kernel parameter (otherwise the kernel might ignore the nice value).

But the description of your problem does not really make sense. You don't need to log as root to kill -9 chromium unless you have launched chromium as root (which is not a very good idea). The trick I describe won't render the root login faster. Note that what you describe seems to be a chromium bug.

Last edited by olive (2015-11-20 09:42:07)

Offline

#3 2015-11-20 11:21:02

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Changing nice for root and login

dext wrote:

it eats all my memory

"nice" isn't going to help you much with that, if the system is relying heavily on "swap".

Do you even need it?

This will show swap presence & usage:

free -m

Offline

#4 2015-11-20 11:59:54

dext
Member
From: Poland, Kraków
Registered: 2008-02-01
Posts: 98

Re: Changing nice for root and login

Thanks for help.

1. I don't need root for that, true. But I have a generic agenda behind this topic: I'd like to always be able to intervene on an overloaded system. Root account looks like a natural one to make it high priority. I'll try your solution Olive, thanks.

2. I do this as root also because when this happens my X session freezes, so I prefer to fight for a new root session which can potentially also sync and reboot.

3. I've disabled swap because of this problem and it's better, but I was counting on OOM killer to kick in - no luck. My theory is, that Chromium is aware it's running out of memory and it's trying to free it on it's own - the high load comes from Chromium.

Offline

#5 2015-11-20 12:23:53

loqs
Member
Registered: 2014-03-06
Posts: 17,440

Re: Changing nice for root and login

Offline

Board footer

Powered by FluxBB