Kill Kodi in Ubuntu problem
#1
I have two devices, host and client, but running kodi. The host is a linux box running Ubuntu 16.4 with a upnp shared libary and the client is an iPad. Normally everything works perfectly, and I applaud the Kodi development team for how easy this is to setup.

However, whenever my network connection on the linux box disconnects and reconnects the upnp service stops responding to client requests. On the client device I get the message "Couldn't connect to network server". My solution has been to restart kodi manually whenever this happens. I would like to automate this.

My plan is to write a script for the /etc/network/if-up.d/ folder and have it kill any running kodi processes and then start kodi again.

When I try to kill the kodi process, the thing survives all attempts to kill it from the command line. killall kodi, killall kodi.bin, nothing seems to actually close the window that is open. I've run kill -9 pid, same effect. Clicking around the window still works as if I didn't kill anything. And ps -ef | grep kodi shows the same process I just tried to kill with the same pid.

I'm on Ubuntu 16.4, X86_64, running Kodi 15.2 Git: (unknown) (Compiled: 15.2+dfsg1-3ubuntu1

Startup log file is here: http://paste.ubuntu.com/23150367/

If someone knows why I can't kill Kodi from the command line, I'd really appreciate some assistance. Thanks!
Reply
#2
I've always found killall -9 kodi.bin works
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
LOL! Thanks. Looks like I gave up too quickly. That command actually does work for me.
Reply
#4
Why not sending a quit message with kodi-send?
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#5
I suggest installing a supported kodi version from our PPAs first and see if the problem still occurs.
You are running an old and unsupported debianized kodi
Reply
#6
Hi,
I need to know what's the point of kill command without -9 if it never never works and you have to retry with -9? Maybe my system is flawed, but at this point I don't know what to do to make it correct and have kill without -9 work. killall kodi, killall kodi.bin, nothing works, without -9. Kodi hangs at shutdown almost all the times now, version 18, version 17, and that is seriously getting on my nerves. Kodi is the center piece of my HTPC. Without it, I cannot get a Linux HTPC that works correctly. So ideally I would need it to stop freezing, or at least figure out why kill doesn't work without -9.
Reply
#7
What about enabling debugging, exit Kodi and if you see it hang on exit take a look at the log and see where it hangs?!

If you don't know where log is: https://kodi.wiki/view/Log_file/Easy

Follow those steps mentioned in the link above and provide the log.

For the -9 see: https://en.wikipedia.org/wiki/Signal_(IP...of_signals

it's the same as you would enter: kill -SIGKILL <pid> where "<pid>" needs to be replaced with the actual process ID. To get the process ID: pgrep -li kodi* to list all running process IDs from Kodi (if there are multiple).
Reply
#8
(2019-03-09, 23:56)EricBuist Wrote: Hi,
I need to know what's the point of kill command without -9 if it never never works and you have to retry with -9?
 This is one of the most misunderstood concepts in the *nix world.

Firstly, the "kill" command doesn't actually kill process - it simply sends them a message.  To see the list of messages, type "kill -l" (that's an L, not 1).  For a brief explanation:
 
  • 1 = SIGHUP, or "hangup", from the days of "telnet" and "nohup" but... essentially means "reload your config file".  Think F5 in a browser to refresh the screen.
  • 2/3 = INTERRUPT/QUIT, equivalent of a CTRL+C.
  • 15 (default if no value is given) = TERMINATE, meaning STOP.  When a process receives this it should write to its logfile, clean up after itself (including cleanly stopping any child processes). 2 & 3 may leave stuff behind for debugging.
  • 6 = ABORT.
All of these are "trapable" - they should be interpreted by the receiving process, and that process should respond accordingly.  There are two signals that cannot be trapped:
  • 11 = SEGV, or the equivalent of a "segmentation fault".  Basically it means "dump your RAM out - drop everything - then stop dead"
  • 9 = shotgun through the head, throw the body out of the window.

So you can see there's a difference between 15 ("could you stop shouting?") and 9 ("I've just shot my screaming kid to quieten her").  Generally, 9 should NEVER be used as the first choice, but as a last resort as it leaves detritus (dirty filesystem, unresolved file locks, orphaned child processes) which needs to be manually cleaned up.

Now, to return to your question: you question may as well read "what's the point of speaking if my offspring don't listen" - the fault isn't with the kill command, but in those receiving the message - if they don't respond correctly to a requested signal, there's something wrong with the process itself and not with the command issuing the request.  (There are plenty of processes where a SIGKILL works so I refuse to believe "it never never works".)

As seen later on in the post, "kill -9" was the wrong approach, "kodi-send" can be used instead, so it's clear the process behaves as expected.  Sending harsh kill messages is probably the reason why kodi no longer behaves as expected.

Hope that helps. It bugs me when I hear people (especially programmers) say "I need to kill that process" when they mean "I need to control that process" or "I need to stop that process".
Reply

Logout Mark Read Team Forum Stats Members Help
Kill Kodi in Ubuntu problem0