Can ping RPi, but can't SSH into it

Thanks for the reminder.

The current process I’m following is to disable NextPVR when I’m not using it, then enable it when I am, then disable when I’m finished, etc. After disabling NextPVR, I restart OSMC, which “refreshes” the Pi’s memory. Since I use the Pi/OSMC at least once a day, hangs don’t happen. My understanding of your request was that I reboot, generate kernel logs until it hangs, then post them. Is that correct?

I will continue to follow the current process for another day or so, then I’ll post my results and follow your approach to collect results when it hangs. It takes 2-3 days for that to happen.

If we can’t figure out what’s happening, I’ll try another fresh installation and see if that helps. Failing that, I’ll step into the Linux command line even further and write a cron job to restart (or reboot) once a day, or something like that.

I seem to be the only one with this problem, so it must be caused by something I’ve done or how I use OSMC?

Thanks again.

Here are results of running free and ps for the last several days:

free

Note that I’ve added a column, OSMC, that indicates when OSMC was restarted. One thing that struck me about the latest results is that each restart of OSMC brought back less “available” memory than before. Last night, after restart, free reported 296 MB of memory, while the previous restart reported 363 MB.

Here are the ps results:

One thing that jumped out at me was that now, ps is reporting two users named “OSMC” and is not reporting “Root” anymore.

If this is helping get to a resolution of my problem, I’ll keep doing it. If not, perhaps it’s time to let my system crash and report kernel logs, as requested by @JimKnopf?

Thank you again for the support.

@JimKnopf

I’ve posted additional results of my data collection efforts and await @dillthedog recommendations relative to them. I hate to disrupt that effort now if it’s becoming beneficial.

In reviewing your instructions above, I had some questions:

If there are multiple index id’s, which one is the correct one?

What is the “full log”? I’m not sure which index to report here versus above. Sorry to be thick.

Also, do I need to turn on debug logging for this exercise? I think not, but I want to confirm.

Thanks very much for your interest and support.

Welcome back. Some observations:

  1. It seems that after disabling NextPVR, the Kodi VSZ/RSS figures remain pretty stable. In parallel with these, the buff/cache figures also flatline, so there’s probably little file I/O occurring.

  2. The progressive reduction of available memory – even when NextPVR is disabled and the Kodi VSZ/RSS numbers are flatlining – is interesting. Perhaps something else is eating the available memory. Switching off Kodi altogether each night would be a useful test to see if available memory follows a similar pattern.

WRT to your question about kernel versus “full” log, I always thought (though am happy to be corrected) that using -k just produced a subset of the full log, and would therefore be of little help in this case.

Debug logs are specific to Kodi. You can leave it switched on but it’s an overhead and will create large logs if left to run for too long.

@JimKnopf described this above. Generally, you’ll be interested in the log for the previous boot, which would be -1. The boot before that one is -2, etc.

1 Like

It does look like something other than Kodi is chewing up memory. Why am I getting two “OSMC” users with the ps command? How do I switch off Kodi?

I’ll stand by for a steer from @JimKnopf on this before I proceed with kernel logs.

Once again, I appreciate the support. Thank you.

You’re sorting on RSS size, so the second “OSMC” line is a process that just happens to make it into second position by dint of it having the second largest RSS. It’s a process that’s run as part of your logon.

To switch off Kodi, run: systemctl stop mediacenter

as @dillthedog said, upload the full log; sometimes the kernel log is more handy but here we want all info available (if there are some useful at all)

exactly, as described in step 7.

OK. I understand now. I’ll go ahead and upload both the partial and full logs as described above, now that I understand what I’m supposed to do.

I’ll go ahead and proceed with @JimKnopf steps 1-11. Depending on what happens with that, I’ll proceed to shut down Kodi and see what effect that has on memory leakage.

Thanks again.

Well, my power went out at 0300 and disrupted my kernel logging. I decided to go ahead an post the kernel logs as directed above in case they may be interesting and to confirm I’m doing the right thing. For what it’s worth, I continued monitoring memory myself and my system was chewing it up throughout the kernel logging process.

I’ll start over again today, with step 11, and see if our power company can keep electricity on long enough for my Pi to run out of memory. :slightly_smiling_face:

Here is an excerpt from my terminal session this morning:

osmc@osmc:~$ sudo journalctl --list-boots --no-pager
-3 0d7c4bad9d6c44ccaa323765c857a4b6 Thu 2019-02-14 04:11:58 CST—Wed 2021-02-24 14:18:18 CST
-2 a1175cd944134c5eb6364b2ade124caf Wed 2021-02-24 14:18:19 CST—Wed 2021-02-24 16:41:37 CST
-1 bc64018f09a84f8f8a4549c231e9d82e Wed 2021-02-24 19:24:33 CST—Fri 2021-02-26 01:48:03 CST
 0 514d2385aeb34bf7852331bdfcd5762e Fri 2021-02-26 08:35:18 CST—Fri 2021-02-26 08:37:50 CST
osmc@osmc:~$ sudo journalctl -k -b -1 --no-pager|paste-log
https://paste.osmc.tv/osocuyibol
osmc@osmc:~$ sudo journalctl -b -1 index> --no-pager|paste-log
Failed to add match 'index': Invalid argument
https://paste.osmc.tv/cacerivogi
osmc@osmc:~$ sudo journalctl -b -1 --no-pager|paste-log
https://paste.osmc.tv/nitinewive
osmc@osmc:~$

Note that the partial log is here: https://paste.osmc.tv/osocuyibol
The full log is here: https://paste.osmc.tv/nitinewive

As always, thanks very much for your help.

Have had a quick look but except you often do ssh logins as user osmc there is not anything unusual so far.
So, keep on till the problem repeats with active persistent kernel logs. :+1:

this is a bit unexpected but possibly completely independent of the “hang” problem.
Please, could you present the urls from the both commands, here?

ls /var -al|paste-log
ls /var/cache -al|paste-log

Hmm. I thought all my samba problems were resolved?

Here is the session where I issued the commands:

osmc@osmc:~$ ls /var -al|paste-log
https://paste.osmc.tv/eledinixah
osmc@osmc:~$ ls /var/cache -al|paste-log
https://paste.osmc.tv/bebitiluke
osmc@osmc:~$

Note the logs are here: https://paste.osmc.tv/eledinixah and here: https://paste.osmc.tv/bebitiluke respectively.

Is there something I need to do to grant permission to make those directories?

Right now my Pi is chewing up a lot of space, even though I’m not even using it. I suspect it will hang today or tomorrow.

Thanks for your help.

no, sounds to be just a cosmetic issue; if you want you can run

sudo mkdir /var/cache/samba

which should create the missing folder with right permissions.

Do you mean memory space or file system space?

Thanks for the quick feedback. As long as it’s not going to hurt anything, I’ll go ahead and make the directory in question.

I meant memory space. Here are the results of df -h and free -m that I ran just now:

osmc@osmc:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        368M     0  368M   0% /dev
tmpfs           374M  376K  373M   1% /run
/dev/mmcblk0p2   29G  1.3G   27G   5% /
tmpfs           374M     0  374M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           374M     0  374M   0% /sys/fs/cgroup
/dev/mmcblk0p1  316M   29M  287M  10% /boot
tmpfs            75M     0   75M   0% /run/user/1000
osmc@osmc:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:            746         516          26           0         203         178
Swap:             0           0           0
osmc@osmc:~$

As I mentioned earlier, I suspect the Pi will run out of memory space today or tomorrow, and it will “hang”. I’ve noticed that available memory only declines. It never gets larger, as if one or more processes are not relinquishing memory after they run – or they never quit running. (I am a Linux illiterate, so I really have no idea what’s happening.)

Thanks again for your help.

Can you confirm that Kodi is now being stopped when you’re not using it?

Also, can you now see a new process consistently appearing at the top of the RSS list – and does it use an increasing amount of memory?

Apologies. I misunderstood my instructions. I have instituted kernel logging as described by @JimKnopf above. All I’ve been doing since then leaving NextPVR enabled and waiting for the Pi to hang. When it does, my plan was to post the kernel logs.

I’ll begin stopping the media center when I’m finished using it and issuing a ps aux command before and after I do that. I’ll continue doing that until it hangs again.

Does the above make sense, or should I start over?

Thanks for your assistance and patience.

Back again. I’m nothing if not persistent! :slight_smile:

Here’s what I’m doing now: When I’m finished with OSMC, I run a script that shuts down Kodi, but takes ps aux readings before and after the stop mediacenter command is run. When I want to use OSMC, I run a similar script that starts Kodi and takes ps aux readings before and after the start mediacenter command is run. The scripts write out results in a file together with the time they’re run.

Using this approach, we can see how memory usage by processes changes while Kodi is “idle” and while it’s running. I’m also running persistent kernel logs in case they might become useful. I’ve just gone through a cycle where I shut Kodi down, started it, and shut it down again. ps aux results are presented below:

Sun Feb 28 16:59:16 CST 2021
Before Stop
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
osmc       462 25.9 26.9 677356 206116 ?       Sl   Feb26 869:41 /usr/lib/kodi/kodi.bin --standalone -fs
root       160  0.0  1.1  59952  9012 ?        Ss   Feb26   0:01 /lib/systemd/systemd-journald
After Stop
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       160  0.0  1.2  59952  9336 ?        Ss   Feb26   0:01 /lib/systemd/systemd-journald
osmc      3594  0.3  0.7  12036  5712 ?        Ss   16:58   0:00 /lib/systemd/systemd --user
Sun Feb 28 17:00:10 CST 2021
Before Start
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       160  0.0  1.2  59952  9336 ?        Ss   Feb26   0:01 /lib/systemd/systemd-journald
osmc      3594  0.1  0.7  12036  5712 ?        Ss   16:58   0:00 /lib/systemd/systemd --user
After Start
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       160  0.0  1.2  59952  9404 ?        Ss   Feb26   0:01 /lib/systemd/systemd-journald
osmc      3594  0.1  0.7  12036  5712 ?        Ss   16:58   0:00 /lib/systemd/systemd --user
Sun Feb 28 17:46:21 CST 2021
Before Stop
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
osmc      3687 26.2 26.1 654240 199656 ?       Sl   17:00  12:06 /usr/lib/kodi/kodi.bin --standalone -fs
root       160  0.0  1.2  59944  9520 ?        Ss   Feb26   0:02 /lib/systemd/systemd-journald
After Stop
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       160  0.0  1.2  59944  9780 ?        Ss   Feb26   0:02 /lib/systemd/systemd-journald
osmc      4009  0.6  0.7  12036  5640 ?        Ss   17:46   0:00 /lib/systemd/systemd --user

I hope the above results are readable.

Before I get too far along with the approach, I want to make sure I’m doing the right thing. I’ll note that just before I shut Kodi down the first time, it had only 63 MB of “available” memory left. It was cruising toward a hang event, but once I shut Kodi down, the memory was relinquished and the process consuming the most memory was root.

I think, per @dillthedog, we’re looking to see what happens to “RSS” on repeated restarts of Kodi, and perhaps if there is a growth in memory usage while Kodi is stopped, but correct me if I’m wrong.

We’ll probably go through another cycle or two of starts and stops tonight, and I’ll post results in the above format if that’s helpful.

Thanks again for the help.

@FrogFan @dillthedog: I don’t understand the idea behind starting and stopping the mediacenter?
If you know it’s most likely that kodi is the devil with a memory leak, why not let it run continously which is the normal usage?
If you are not sure that kodi.bin is causing a memory leak, why only monitor user specific processes instead of all with all available memory information like ps aefvx or at least ps afvx ?

Sorry, if I missed something in the beginning of the thread.

@JimKnopf

I’ll let @dillthedog provide the answers to your questions. For my part, I’m just a user with a problem looking for a solution and thankful for all the help I can get. :slightly_smiling_face:

My Pi is chewing up a lot of memory just sitting there – so much, I think, that it has to be one of the “top” processes that is responsible.

We first thought the problem was with NextPVR, so we went through a series of exercises to disable and enable that addon. We discovered, I think, that it was not causing the problem, so attention shifted to Kodi. That’s when we started stopping and starting Kodi. I went through an additional start/stop cycle last night and can post results of that, or I can go another day and then post.

I’m still running persistent kernel logs and can post them at any time. In particular, if we decide to quit starting and stopping Kodi, then I predict the Pi will run out of memory and hang in 2-3 days.

If there are other things I need to be doing, please advise.

I appreciate your support and the support from @dillthedog. I really hope to get this problem resolved soon. I’ve got my wife using OSMC now, and that was a struggle. Now I have to babysit her when she’s running it in order to collect this data and help her if it hangs.