That worked. Thanks for the help! Graham
On 26/04/2020 17:35, Craig Barratt via BackupPC-users wrote:
Sorry, the correct form should be "$@": #!/bin/sh -f exec /bin/tar -c "$@" (Note that you want to force tar to have the -c option, not exec). CraigOn Sun, Apr 26, 2020 at 5:14 AM Graham Seaman <[email protected] <mailto:[email protected]>> wrote:Hi Craig I set sudoers to allow backuppc to run tar as root with no password, and incremental backups work fine. This is only marginally less secure than the old setup, which allowed backuppc to run the script which called tar, so I guess I can live with this. But in case you have any other ideas, here's my tiny script that's now definitely what's causing the problem (the quote marks are double quotes, not two single quotes): #!/bin/sh -f exec -c /bin/tar "$*" Graham On 26/04/2020 04:09, Craig Barratt via BackupPC-users wrote:It would be helpful if you included the edited script in your reply. Did you use double quotes, or two single quotes? I'd recommend trying without the script, just the make sure it works correctly. Then you can be sure it's an issue with how the script handles/splits arguments. Craig On Sat, Apr 25, 2020 at 2:49 PM Graham Seaman <[email protected] <mailto:[email protected]>> wrote: Craig Quoting $* gives me a new error: /bin/tar: invalid option -- ' ' (I get exactly the same error whether I use $incrDate or $incrDate+) That script is to avoid potential security problems from relaxing the rules in sudoers, so I'd rather not get rid of it, but I'm a bit surprised no-one else has the same problems (and that it apparently used to work for me once) Graham On 25/04/2020 17:59, Craig Barratt via BackupPC-users wrote:Graham, Your script is the problem. Using $* causes the shell the resplit arguments at whitespace. To preserve the arguments you need to put that in quotes: exec /bin/tar -c "$*" Craig On Sat, Apr 25, 2020 at 5:04 AM Graham Seaman <[email protected] <mailto:[email protected]>> wrote: Thanks Craig That's clearly the problem, but I'm still mystified. I have backuppc running on my home server; the storage is on a NAS NFS mounted on the home server. Backing up other hosts on my network (both full and incremental) over rsync works fine. The home server backs up using tar. The command in the log is: Running: /usr/bin/sudo /etc/backuppc/localtar/tar_create.sh -v -f - -C /etc --totals --newer=2020-04-22 21:18:10 . If I set $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+'; then incremental backups of the home server fail with: /bin/tar: Substituting -9223372036854775807 for unknown date format ‘2020-04-22\\’ /bin/tar: 21\:18\:10: Cannot stat: No such file or directory If instead I set: $Conf{TarIncrArgs} = '--newer=$incrDate $fileList'; then incremental backups fail with: /bin/tar: Option --after-date: Treating date '2020-04-22' as 2020-04-22 00:00:00 /bin/tar: 21\:18\:10: Cannot stat: No such file or directory Could it be to do with my localtar/tar_create.sh? (I created this so long ago I no longer remember where it came from). This is just: #!/bin/sh -f exec /bin/tar -c $* Thanks again Graham On 25/04/2020 02:59, Craig Barratt via BackupPC-users wrote: > Graham, > > This is a problem with shell (likely ssh) escaping of arguments that > contain a space. > > For incremental backups a timestamp is passed as an argument to tar > running on the client. The argument should be a date and time, eg: > > --after-date 2020-04-22\ 21:18:10' > > Notice there needs to be a backslash before the space, so it is part of > a single argument, not two separate arguments. > > You can tell BackupPC to escape an argument (to protect it from passing > via ssh) by adding a "+" to the end of the argument name, eg: > > $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+'; > > > Craig > > On Fri, Apr 24, 2020 at 3:17 PM Graham Seaman <[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> wrote: > > > > > > > > > Ok, I guess its this (from the start of XferLOG.bad): > > /bin/tar: Option --after-date: Treating date '2020-04-22' as 2020-04-22 > 00:00:00 > /bin/tar: 21\:18\:10: Cannot stat: No such file or directory > > which is kind of confusing, as it goes on to copy the rest of the > directory and then says '0 Errors'. Anyway, its correct that there is no > file called '21:18:10'. Any idea why it thinks there should be? > > Graham > > > On 24/04/2020 20:59, Craig Barratt via BackupPC-users wrote: > > Graham, > > > > Tar exit status of 512 means it encountered some sort of error > (eg, file > > read error) while it was running on the target client. Please look at > > the XferLOG.bad file carefully to see the specific error from tar. > > > > If you are unable to see the error, please send me the entire > > XferLOG.bad file? > > > > Craig > > > > On Fri, Apr 24, 2020 at 12:13 PM Graham Seaman > <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>> > > <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>> wrote: > > > > I have a persistent problem with backing up one host: I can do > a full > > backup, but an incremental backup fails on trying to transfer > the first > > directory: > > > > tarExtract: Done: 0 errors, 2 filesExist, 81381 sizeExist, 18122 > > sizeExistComp, 2 filesTotal, 81381 sizeTotal > > Got fatal error during xfer (Tar exited with error 512 () status) > > Backup aborted (Tar exited with error 512 () status) > > > > All other hosts work ok. So I'm guessing it must be a file > permission > > error. Looking at the files, everything seems to be owned by > > backuppc.backuppc, so I don't know where/what else to look > for. Any > > suggestions? > > > > Thanks > > Graham > > > > > > _______________________________________________ > > BackupPC-users mailing list > > [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>> > > List: > https://lists.sourceforge.net/lists/listinfo/backuppc-users > > Wiki: http://backuppc.wiki.sourceforge.net > > Project: http://backuppc.sourceforge.net/ > > > > > > > > _______________________________________________ > > BackupPC-users mailing list > > [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users > > Wiki: http://backuppc.wiki.sourceforge.net > > Project: http://backuppc.sourceforge.net/ > > > > > _______________________________________________ > BackupPC-users mailing list > [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users > Wiki: http://backuppc.wiki.sourceforge.net > Project: http://backuppc.sourceforge.net/ > > > > _______________________________________________ > BackupPC-users mailing list > [email protected] <mailto:[email protected]> > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users > Wiki: http://backuppc.wiki.sourceforge.net > Project: http://backuppc.sourceforge.net/ > _______________________________________________ BackupPC-users mailing list [email protected] <mailto:[email protected]> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/ _______________________________________________ BackupPC-users mailing list [email protected] <mailto:[email protected]> List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project:http://backuppc.sourceforge.net/_______________________________________________ BackupPC-users mailing list [email protected] <mailto:[email protected]> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/ _______________________________________________ BackupPC-users mailing list [email protected] <mailto:[email protected]> List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project:http://backuppc.sourceforge.net/_______________________________________________ BackupPC-users mailing list [email protected] <mailto:[email protected]> List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/ _______________________________________________ BackupPC-users mailing list [email protected] List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
_______________________________________________ BackupPC-users mailing list [email protected] List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
