Repository: mudler/LocalAI

Issue #3498: Local-AI Service Is Unkillable on Ubuntu 24.04
Created: 2024-09-09T15:54:26Z
Discussed in https://github.com/mudler/LocalAI/discussions/3483

Originally posted by helf-charles September  5, 2024
Hey there, everyone. I've been Googling this question for the last day and spent a good half hour or so searching the GitHub discussions for a related thread. Hopefully, there wasn't a super obvious search term that I overlooked.
Basically, my issue is as described in the title. After playing with this application for a bit, I realized that there was no "stop" or "terminate" command clearly listed in any of the documentation (either via -help flag or the .io website). Since I had a resource monitor actively measuring resource usage, I went ahead and issued a KILL signal to the local-ai process. It appeared to die for a few seconds... then, resurrected itself as a zombie process and started back up all over again.
That didn't seem right at all.
I then attempted a sudo kill -9 PROCESS_ID_HERE on the local-ai instance. Once again, it immediately started back up with a brand new PID. Quite concerning, but maybe it's not as serious as I'm thinking. I then decide to reboot my machine and check. To my surprise, local-ai is up and running once again, even though I barely had time to open up a terminal and search for it, let alone issue the local-ai run command to get a model up and going.
This really gives me the heebie-jeebies, on top of the annoyance of now having roughly 1.2GB of RAM permanently dedicated to a local-ai instance that I might not want to have active every time I'm on my machine.  Is there some way of killing local-ai that's just hidden away in documentation? Could it be an odd compatibility bug that requires a bit of fiddling to remedy? Or, have I stumbled upon a genuine oversight that needs to be addressed?
Please and thank you!
EDIT: After much investigation, I've discovered that the Local-AI service in Ubuntu actively and intentionally restarts itself anytime it is terminated. This is a pretty serious vulnerability that needs to be remedied. Not only does LocalAI not come with an uninstaller, but you literally cannot uninstall LocalAI completely from Ubuntu 24.04 unless you spam kill commands to the process while simultaneously attempting to delete the service before it starts itself back up. The only reason I even thought to do this is because I happen to know that there's a short window between Zombie state and process reinitialization in memory that can be exploited to terminate a problematic process before it fully gains a foothold.
I will be warning other AI users about this flaw and cautioning them against using LocalAI until it is remedied. A Linux service should never, under any circumstances, engage in this behavior unless it is absolutely vital to machine functioning. This needs to be taken seriously as a potential security threat.

Duplicate issue #3599: Local-AI Service Is Unkillable on Ubuntu 24.04
Created: 2024-09-19T02:28:03Z
Discussed in https://github.com/mudler/LocalAI/discussions/3483

Originally posted by helf-charles September  5, 2024
Hey there, everyone. I've been Googling this question for the last day and spent a good half hour or so searching the GitHub discussions for a related thread. Hopefully, there wasn't a super obvious search term that I overlooked.
Basically, my issue is as described in the title. After playing with this application for a bit, I realized that there was no "stop" or "terminate" command clearly listed in any of the documentation (either via -help flag or the .io website). Since I had a resource monitor actively measuring resource usage, I went ahead and issued a KILL signal to the local-ai process. It appeared to die for a few seconds... then, resurrected itself as a zombie process and started back up all over again.
That didn't seem right at all.
I then attempted a sudo kill -9 PROCESS_ID_HERE on the local-ai instance. Once again, it immediately started back up with a brand new PID. Quite concerning, but maybe it's not as serious as I'm thinking. I then decide to reboot my machine and check. To my surprise, local-ai is up and running once again, even though I barely had time to open up a terminal and search for it, let alone issue the local-ai run command to get a model up and going.
This really gives me the heebie-jeebies, on top of the annoyance of now having roughly 1.2GB of RAM permanently dedicated to a local-ai instance that I might not want to have active every time I'm on my machine.  Is there some way of killing local-ai that's just hidden away in documentation? Could it be an odd compatibility bug that requires a bit of fiddling to remedy? Or, have I stumbled upon a genuine oversight that needs to be addressed?
Please and thank you!
EDIT: After much investigation, I've discovered that the Local-AI service in Ubuntu actively and intentionally restarts itself anytime it is terminated. This is a pretty serious vulnerability that needs to be remedied. Not only does LocalAI not come with an uninstaller, but you literally cannot uninstall LocalAI completely from Ubuntu 24.04 unless you spam kill commands to the process while simultaneously attempting to delete the service before it starts itself back up. The only reason I even thought to do this is because I happen to know that there's a short window between Zombie state and process reinitialization in memory that can be exploited to terminate a problematic process before it fully gains a foothold.
I will be warning other AI users about this flaw and cautioning them against using LocalAI until it is remedied. A Linux service should never, under any circumstances, engage in this behavior unless it is absolutely vital to machine functioning. This needs to be taken seriously as a potential security threat.

Closing comment (2024-09-19T09:32:52Z): Dup of #3498