I recently got four working ATV1’s for $10 Canadian (~$7.50 USD) each and I wanted to see if I could turn them into something useful to give to some friends in early 2019. Sorry if these things seem obvious to you Linux experts, but I’m primarily a Windows guy and have to Google every command to do stuff on Linux.
I chose the only one that had a defective 160Gb disk and replaced it with an old 80GB I had lying around and since I was going to order a CrystalHD card to try it out, I might as well work on the one I had to take apart. I restored the old Apple TV software using this site:
After I downloaded and installed the 2017.08-1-HDD to a Lexar 32Gb USB stick, I was ready to install. It booted right up to the OSMC installer and after selecting the OSMC skin, everything looked ready to roll.
It seemed to play short videos and music from my UPNP servers, but when I tried to attach big picture libraries it would crash (a lot!). The memory available from the system info would drop into the 40’s and never go beyond 70mb. I thought maybe it was due to me installing LXDE as per this YouTube video:
I had originally installed LXDE to get access to some SMB shares from my NAS server, and it actually worked pretty well after I installed SMB4K. I could then download picture libraries to my ATV as the Kodi file manager wouldn’t even connect to them.
However, the picture crashing got even worse, so I blew it all away and did a fresh OSMC install. Low memory and crashing on pictures persisted. Being a Windows guy, I thought how about getting virtual memory to help me out here. I went to this forum and did the fixe according to this post:
I created the advancedsettings.xml and adding the commands from the post above. There was no effect on pictures crashing.
I then thought about swap as per this post and learned about perftune:
That lead me to this excellent post by Ghost:
However, changing the /usr/bin/performance_tuner file to increase the size of the swap file had no effect, the swap file stayed at ~131mb. I noticed from the perftune post above there is a system setting called swappiness. That led me to another post:
I started editing the /etc/sysctl.d/101-osmc-device.conf (actually I started editing all of the configs to get my values to stick) and got the swappiness up to 80 and constantly checking to see that it sticked by rebooting and typing cat /proc/sys/vm/swappiness as per this article:
This helped a bit, but checking the size of the swap file (swapon -s), sometimes it was almost full so I decided to increase the size to twice the installed memory. Because changing the size of the performance turner file didn’t help, I searched for how to brute force it.
This article was helpful:
I did this:
- Make all swap off
sudo swapoff -a
- Resize the swapfile
sudo dd if=/dev/zero of=/swap bs=1M count=512
- Make swapfile usable
sudo mkswap /swap
- Make swapon again
sudo swapon /swap
And it WORKED! I can load picture libraries, have slideshows and it hasn’t crashed yet. Videos and music still work fine. I use SFTP on FileZilla to transfer pictures and other media over from my servers, that works well! I’ll see if lowering the swappiness makes any difference but I’m happy with things and sometimes I’m getting 150mb free while the swapfile uses almost 130mb. It seems to work pretty good so I’ll wait for the CrystalHD card and then when all is right, I’ll load the other three with OSMC.
PS, thanks to sam_nazarko for those great previous answers. I really hope the CrystalHD card will work with 2017.08-1-HDD