[How to] Enable swapfile on LibreELEC

  • From @escalade in Remix


    By default LibreELEC does not have a swapfile.


    You can enable a swapfile by:

    cp /etc/swap.conf /storage/.config

    then edit it and change

    SWAP_ENABLED="no" to SWAP_ENABLED="yes".

    SWAPFILESIZE="128" to your required swapfile size - normally 4 x RAM but RAM should be enough for a normal LE system.


    When you reboot, a swapfile the size of SWAPFILESIZE is generated in /storage/.config/swapfile.

  • I'm using LibreELEC in a RPi 3b, and I've learned now about what's swap is!

    So, I will using for sure (since some time my machine freezes [but this is because of some addons that I use ˆˆ])

    What do you recommend for swap size here? I read about 2 x RAM. So If I want this, I'll put SWAPFILESIZE="2000"?


    Thanks for this "How to" :)

    Supercalifragilisticexpialidocious! (inscribed in large friendly letters)

    My hardware is a Raspberry Pi 3b

  • You can enable a swapfile by:

    cp /etc/swap.conf to /storage/.config

    This did not work (At least not here in RPi). What worked here was just cp /etc/swap.conf /storage/.config


    Edit: Or maybe you are just saying to copy the files, not a command ^^, sorry!

    Supercalifragilisticexpialidocious! (inscribed in large friendly letters)

    My hardware is a Raspberry Pi 3b

  • Hey, and if, for some reason, I want to undo swapfile I just need delete the file and reboot?

    Supercalifragilisticexpialidocious! (inscribed in large friendly letters)

    My hardware is a Raspberry Pi 3b

  • 1. My mistake. Should have been a command (Edited original post)

    2. Start with RAM size and see how it grows. Increase as necessary.

    3. Just delete /storage/.config/swap.conf and reboot to remove the swapfile

  • I tried this, but looks like the file is protected somehow. My LibreELEC installation is brand new on a RPi3.


    Nano says:

    [ File '/etc/swap.conf' is unwritable ]

  • I tried this, but looks like the file is protected somehow. My LibreELEC installation is brand new on a RPi3.


    Nano says:

    [ File '/etc/swap.conf' is unwritable ]

    You have to edit /storage/.config/swap.conf and not /etc/swap.conf

    Supercalifragilisticexpialidocious! (inscribed in large friendly letters)

    My hardware is a Raspberry Pi 3b