I’m using the command line to purge some files from a local backup and I keep getting the following error:
Enter encryption passphrase:
System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
at System.Console.ReadKey(Boolean intercept)
at Duplicati.Library.Modules.Builtin.ConsolePasswordInput.ReadPassphraseFromConsole(Boolean confirm)
2 commandlineOptions) at Duplicati.Library.Main.Controller.SetupCommonOptions(ISetCommonOptions result, String& paths, IFilter& filter) at Duplicati.Library.Main.Controller.RunAction[T](T result, String& paths, IFilter& filter, Action1 method)
at Duplicati.Library.Main.Controller.PurgeFiles(IFilter filter)
at Duplicati.CommandLine.Commands.PurgeFiles(TextWriter outwriter, Action
1 setup, List1 args, Dictionary
2 options, IFilter filter) at Duplicati.CommandLine.Program.RunCommandLine(TextWriter outwriter, TextWriter errwriter, Action1 setup, String args)
My backup set has NO encryption since it’s just to a local drive so why does the command ask for an encryption passphrase and what does it want me to enter - and where - since there’s no encryption? Thanks.
What version please? This is easiest to get from web UI About --> System info in the base and server versions although there’s some chance command line would run differently due to the many places updates can reside.
While asking questions, I suppose I should also ask what OS this is, whether backup ever had encryption, and how you built the command line, e.g. did you export from the web UI? Note you can run it IN the web UI instead, which ought to take care of the console input issue (though it’d be nice to understand that – some versions did have problems). For encryption, you can also look at backup destination files, and check for any .aes endings.
Version: 188.8.131.52_beta_2018-04-02; OS is Windows 10; the backup has never had encryption. I tried in the UI first but got a too many commandline arguments (error 200 I think), I’m guessing because Duplicati was trying to run all of my advanced settings as well perhaps?
Anyway I just went to the regular commandline instead, not exported from the UI.
My commandline was simply:
duplicati.commandline.exe purge Y:\ “drive:\PATH TO FILES I WANT PURGED\*” --dry-run
Using “file://Y:\” made no difference - I got the same error about an encryption passphrase.
The backup files are all zips, i.e. not aes.
When running Duplicati.CommandLine.exe for a web UI job, one must be careful to bring the needed options. The easiest way to do this is to do MENU --> Configuration --> Export --> As Command-line
Change “backup” to the new command, and adjust the format to fit the syntax. Extra options are “usually” OK.
I can reproduce your error if I omit –no-encryption=true, which you can probably spot in the above job export.
The web UI’s Commandline is easier for me. The formats for backup and purge are similar. I get no error 200. When formats are dissimilar though, I can definitely get errors if I don’t adjust things to fit the command I do…
C:\Program Files\Duplicati 2>duplicati.commandline.exe help no-encryption
--no-encryption (Boolean): Disable encryption
If you store the backups on a local disk, and prefer that they are kept
unencrypted, you can turn of encryption completely by using this switch.
* default value: false
C:\Program Files\Duplicati 2>
so apparently one has to warn it, otherwise perhaps it wants the passphrase before noticing all files are .zip?
Yes that worked thanks. The problem with just using the exported commandline config was that it was throwing errors, so perhaps some of the commandline statements that are fine for backup cause an error in purge. This was also why I didn’t do it in the GUI - too many commandline errors.
At any rate, for anyone else trying to do a commandline purge from an unencrypted backup set, it needed both --no-encryption and my --dbpath.