Kodi Community Forum

Full Version: Setting nice level of Kodi on Ubuntu 15.04
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am currently starting Kodi 15.2 after autologin by starting the xserver.

[email protected]:~$ cat .bash_profile
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx -- -bs

[email protected]:~$ cat .xinitrc
nice -n -20 kodi

But for some reason, kodi doesn't take the nice level it should, because

[email protected]:~$ ps -elf | grep kodi
0 S main      1823  1822  0  80   0 -  1118 wait   00:52 tty1     00:00:00 /bin/sh /usr/bin/kodi
0 R main      1825  1823 32  80   0 - 833132 -     00:52 tty1     03:57:31 /usr/lib/kodi/kodi.bin

shows a nice level of 0 (8th column of the output of "ps -elf"). Any ideas what I am doing wrong? Has anybody succeeded in changing the nice level?

might be a permission issue?
setting the nice level requires root privileges i think.
Ah, thanks, I read somewhere else that only root can set nice levels lower than zero.
Thanks to ronie's help, I figured out that it was the sudo issue. A fix would be to call nice with sudo, making

[email protected]:~$ cat .xinitrc
sudo nice -n -15 sudo -u $USER kodi

But this would ask for my sudo password in .xinit, therefore do a "sudo visudo", and add

%sudo   ALL = (ALL) NOPASSWD: /usr/bin/nice,/usr/bin/renice

at the end of the file, which allows main to run nice and renice without asking for superuser pw.

Thanks, case closed.
See: /etc/security/limits.conf in 231955 (thread)