Kodi Community Forum
Linux Setting nice level of Kodi on Ubuntu 15.04 - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Linux Setting nice level of Kodi on Ubuntu 15.04 (/showthread.php?tid=246175)



Setting nice level of Kodi on Ubuntu 15.04 - pwriesnik - 2015-11-03

I am currently starting Kodi 15.2 after autologin by starting the xserver.

Code:
main@htpc:~$ cat .bash_profile
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx -- -bs
fi

Code:
main@htpc:~$ cat .xinitrc
nice -n -20 kodi

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

Code:
main@htpc:~$ 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?

Thanks!


RE: Setting nice level of Kodi on Ubuntu 15.04 - ronie - 2015-11-03

might be a permission issue?
setting the nice level requires root privileges i think.


RE: Setting nice level of Kodi on Ubuntu 15.04 - pwriesnik - 2015-11-03

Ah, thanks, I read somewhere else that only root can set nice levels lower than zero.


RE: Setting nice level of Kodi on Ubuntu 15.04 - pwriesnik - 2015-11-03

Thanks to ronie's help, I figured out that it was the sudo issue. A fix would be to call nice with sudo, making

Code:
main@htpc:~$ 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

Code:
%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.


RE: Setting nice level of Kodi on Ubuntu 15.04 - fritsch - 2015-11-03

See: /etc/security/limits.conf in http://forum.kodi.tv/showthread.php?tid=231955