Duply / duplicity `LFTP not found` although installed

I would like to back up to my webspace with duply (duplicity frontend) via ftps.

When running the backup, duply prints out:

--- Start running command BKP at 2022-11-01 20:00:31.141 ---
/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/sh: line 1: lftp: command not found
LFTP not found:  Please install LFTP.
2022-11-01 20:00:31.357 Task 'BKP' failed with exit code '43'.
--- Finished state FAILED 'code 43' at 2022-11-01 20:00:31.357 - Runtime 00:00:00.215 ---

This although lftp is installed and i can run it in the terminal.

Any suggestions?

systemd.services.duplicity.path = [ pkgs.lftp ]

systemd services do not use the same $PATH as the rest of the system, so adding lftp to systemPackages does not help.

Hmm, i did that and still get:

--- Start running command BKP at 2022-11-02 15:31:54.545 ---
/nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/sh: line 1: lftp: command not found
LFTP not found:  Please install LFTP.
2022-11-02 15:31:54.716 Task 'BKP' failed with exit code '43'.
--- Finished state FAILED 'code 43' at 2022-11-02 15:31:54.716 - Runtime 00:00:00.170 ---

This also doesn’t help, it still shows that lftp is missing:

systemd.services.duplicity.path = [ pkgs.lftp ];  
services.duplicity.enable = true;
services.duplicity.targetUrl = "";

Also, when searching in Nixos options it doesn’t show me any option for systemd regarding duplicity.

Sorry, I read your post too quick, I thought you were using the duplicity nixos module, not duply. How are you running duply ? In a terminal ? In a systemd service ? In a cron job ?

Eventually i want to run it as a cron job but the error i described occurs when running it in the terminal. I ran it there to see if everything is working as intended.

I tried this just to see if it helps somehow, but i don’t want to run it like this eventually:

systemd.services.duplicity.path = [ pkgs.lftp ];  
services.duplicity.enable = true;
services.duplicity.targetUrl = "";

I would be willing to run duply with a systemd service if that makes it easier, i’m just not familiar with that (yet).

it should definitely work in a terminal.
So you say that running lftp works but duply no in the same terminal? Does duplicity work correctly?

Yes, duply works with my local backup (where it doesn’t have to use ftps), so duplicity must also be working, as duply is just a frontend. It prints some errors but is still working, maybe the .nix wrapper is not correct?

Let me show you 3 Screenshots, maybe this is helpful:

First, my local backup, which succeeds:

Second, the failed backup to ftps:

Third, running lftp in terminal:

image

I tried duply from the unstable channel but it shows the same errors.

but does duplicity work with your ftp target?

Sorry, i didn’t think of running duplicity without the wrapper.

It shows this:

~ ❯ duplicity /home/sperber/Downloads ftps://username:userpasswd@server.net//test                                                                                                                                                                       
LFTP version is 4.9.2
Attempt of list Nr. 1 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-uwg2_bqw-tempdir/mkstemp-laswiouj-1; ( cd /test/ && ls ) || ( mkdir -p /test/ && cd /test/ && ls )"': returned 1, with output:

cd: Fatal error: gnutls_handshake: An unexpected TLS packet was received.
mkdir: Fatal error: gnutls_handshake: An unexpected TLS packet was received.

So, something is up either with lftp or some encryption service.

oooh the wrapper is incorrectly done:

it resets the PATH instead of adding to it with --prefix PATH :
Would you mind making a PR, testing that it solves your issue, and pinging me on it?

I’m rather new to Linux and especially to NixOS and have no idea about github or editing a wrapper.

I wrote an email to the package maintainer, hopefully he will fix it.

I could file an issue on nixpkgs Github if that helps. Should i do that or wait for the maintainer?

I did the PR then: duply: fix ftp usage by symphorien · Pull Request #199525 · NixOS/nixpkgs · GitHub

I would like you to check that is solves your issue: inside nix-shell -p git git-extras:

git clone https://github.com/nixos/nixpkgs
cd nixpkgs
git pr https://github.com/NixOS/nixpkgs/pull/199525
nix-build -A duply

and test that result/bin/duply works correctly.

2 Likes

Thank you for your effort!

Good news and bad news:

It progressed further than usual, pointing out errors in my exclude file for duply. Before, it didn’t do that.

However, after fixing them, i still get the following error:

Btw, how can i delete all the files downloaded / installed during this after we are finished trying it out? I’ve never used nix-shell before and it downloaded close to 3GB.

remove the result symlink that contained duply, and then run nix-collect-garbage

Alright, thank you …

@symphorien i’m still having the issue with missing lftp. I’m on 22.11 and have duply installed as a system package. Using duply from unstable also shows missing lftp.

Your fix solved this problem when i tested it though and i thought that it would now also be solved if i use the package from the Nixos repo.

Am i missing something?

For reference, here is the output of duply from just now:

~ ❯ duply manitu backup
Start .duply-wrapped v2.4, time is 2022-12-05 14:20:41.
Using profile '/home/sperber/.duply/manitu'.
/nix/store/sibv8i5ms84br3bl98i29r6j28bjvn6y-duply-2.4/bin/.duply-wrapped: line 623: WARNING:: command not found
Using installed duplicity version 0.8.23, /nix/store/sibv8i5ms84br3bl98i29r6j28bjvn6y-duply-2.4/bin/.duply-wrapped: line 617: warning::command not found ( Could not parse the python interpreter used from duplicity (/nix/store/kai9s6mi2c16sk5ba8z8mnl1h6zl8dgx-duplicity-0.8.23/bin/duplicity). Result was ' /nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash -e'.), gpg 2.3.7 (Home: /home/sperber/.gnupg), awk 'GNU Awk 5.1.1, API: 3.1', grep 'grep (GNU grep) 3.7', bash '5.1.16(1)-release (x86_64-pc-linux-gnu)'.
Signing disabled. No GPG_KEY entries in config.
Checking TEMP_DIR '/tmp' is a folder and writable (OK)
Test - Encryption with passphrase (OK)
Test - Decryption with passphrase (OK)
Test - Compare (OK)
Cleanup - Delete '/tmp/.35088.1670246442_*'(OK)

--- Start running command PRE at 2022-12-05 14:20:42.504 ---
Skipping n/a script '/home/sperber/.duply/manitu/pre'.
--- Finished state OK at 2022-12-05 14:20:42.514 - Runtime 00:00:00.010 ---

--- Start running command BKP at 2022-12-05 14:20:42.539 ---
/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/sh: line 1: lftp: command not found
LFTP not found:  Please install LFTP.
2022-12-05 14:20:42.702 Task 'BKP' failed with exit code '43'.
--- Finished state FAILED 'code 43' at 2022-12-05 14:20:42.702 - Runtime 00:00:00.163 ---

--- Start running command POST at 2022-12-05 14:20:42.737 ---
Skipping n/a script '/home/sperber/.duply/manitu/post'.
--- Finished state OK at 2022-12-05 14:20:42.754 - Runtime 00:00:00.017 ---

Wasn’t the fix just to allow duply to find lftp in $PATH? (Previously it’d hardcode a fixed $PATH, so it’d ignore the surrounding environment.)

Do you have lftp in $PATH?

Right… If i add lftp to my system packages, it works. I thought you added it as a dependency for duply as you mentioned something about making it work out of the box.

Thanks.