rsync to librelec box

  • I know there are a lot of threads like this but none of them seem to have the answer.

    I need to copy files to a directory on my libreelec box using rsync and ssh, ie running rsync /source/directory [email protected]:/dest/directory on a remote machine

    I have found the network tools addon that contains rsync, and I can use that to copy files *from* libreelc to other systems, but that isn't what I need.The issue is when I try to copy from another system to libreelec I get

    sh : rsync : command not found

    Because the rsync binary isn't on the default PATH and rsync doesn't read .profile or any other file so I'm limited to /usr/bin and the other read-only directories.

    Why don't I just sync the files the other way? After all, it's a sync, I imagine you're thinking. Yes, but this is a pre-existing bash script containing 500 lines of stuff that sh doesn't understand (eg array variables) so I can't run it on the libreelec system.

    Anybody got any ideas how to make this work? Or can I get bash for libreelec? That'd be a good start.

  • rsync -e ssh --rsync-path=/storage/.kodi/addons/virtual.network-tools/bin/rsync -av <source>. root@<libreelec-host>:<dest>

    If you want to get real bash on LibreElec, you might have to compile it with some options turned off. In case of Debian /bin/bash at least two linked libraries are not on libreelec. Or configure and build bash with --enable-static-link

    Edited 3 times, last by tokul (August 16, 2020 at 3:34 PM).

  • I have just been through this so that I can use my libreelec box (a droidbox) as an rsync server. I can now backup to its HDD from my Synology NAS.

    As already stated the rsync command is in: (once you've installed from the repo)

    /storage/.kodi/addons/virtual.network-tools/bin/rsync

    In that folder (since the root filesystem is read-only) create an rsyncd.conf file with the following contents (but change the path you want the backup folders to go into)

    pid file = /var/run/rsyncd.pid

    lock file = /var/run/rsync.lock

    log file = /var/log/rsync.log

    port = 873

    uid = nobody

    [files]

    path = /media/HDD/NAS_Backup

    comment = RSYNC FILES

    read only = false

    timeout = 300

    The [files] entry here creates a 'module' called files, that will be available to the backup app on your NAS.

    You can change the port number here, but you must match it in the entry in the backup app (eg Hyper Backup)

    In the directory where the rsync binary is located, start the rsync daemon (do all of this via ssh using PUTTY or similar)

    rsync --daemon --config=./rsyncd.conf

    Check that it is runing: (following command should return 2 lines, the first being the' rsync --daemon....' command)

    ps | grep rsync

    Now it is useful to keep an eye on the log file before continuing..

    tail -f /var/log/rsync.log

    Now you can create a new backup config on your NAS. The example below is using Hyper Backup (Synology)

    When you create a new backup session and get to the page below, enter the ip address of your libreelec box, the port number, and other options similar to those below.

    The dropdown for 'Backup Module' should present you with a list of the modules as per the rsyncd.conf file. - Note that this step will only work once the rsync daemon is running on your libreelec box.

    Then enter a name for the backup dir that will be generated

    On the following screens select what you want to backup, provide a sheduled time, and 'APPLY'. You get asked if you want to run the backup now. Select yes to test it out.

    Keep an eye on the rsync log file, and in the directory that you are expecting the backup files to appear in (/media/HDD/NAS_Backup in my case).

    Hope this works for you

    Edited 2 times, last by crispy123 (November 22, 2020 at 8:51 PM).