The adventures of an ATV1 newbie, I needed more swap :-)

#1

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:
https://www.tweaking4all.com/home-theatre/appletv/restore-appletv-os-offline-1stgen/
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:
https://www.youtube.com/watch?v=35YVtazPoBs

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:
https://discourse.osmc.tv/t/kodi-temp-cache-files-filling-disk/37703/9
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:
https://discourse.osmc.tv/t/any-benefit-of-swap/5786
That lead me to this excellent post by Ghost:
https://discourse.osmc.tv/t/my-small-experience-with-atv1-and-osmc/69982
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:
https://discourse.osmc.tv/t/constant-crashes-with-logs/15715/22
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:
https://www.howtoforge.com/tutorial/linux-swappiness/
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:
https://www.digitalocean.com/community/questions/how-to-change-swap-size-on-ubuntu-14-04
I did this:

  1. Make all swap off
    sudo swapoff -a
  2. Resize the swapfile
    sudo dd if=/dev/zero of=/swap bs=1M count=512
  3. Make swapfile usable
    sudo mkswap /swap
  4. 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

0 Likes

#2

You need to use a Jarvis release (2016) or so for CrystalHD to work.

For the price of the CrystalHD cards, a Pi would work better

Sam

1 Like

#3

Thanks, I thought in a previous post you mentioned that 2017.01 might support the ChrystalHD?

0 Likes

#4

Yes, I believe that was a Jarvis version.

0 Likes

#5

Great, thanks!
That’s what I’ll use when I get in the card :slight_smile:

0 Likes

#6

I got a ChrystalHD and yes it’s still supported in 2017.01
It doesn’t seem to do all good for H264 but I haven’t tuned it as per my post above.

0 Likes