Discussion:
[Duplicity-talk] Duplicity fails when run as cron script: `OSError: [Errno 2] No such file or directory`
Niklaas Baudet von Gersdorff
2015-10-13 18:37:10 UTC
Permalink
I get the following error when running duplicity from a crontab on a
FreeBSD 10.1 system. Running the same script manually works without any
problems.
See http://www.nongnu.org/duplicity/
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon Oct 5 19:54:28 2015
Cleanup of temporary directory /tmp/duplicity-qD5xDy-tempdir failed - this is probably a bug.
===== Begin GnuPG log =====
File "/usr/local/bin/duplicity", line 1509, in <module>
with_tempdir(main)
File "/usr/local/bin/duplicity", line 1503, in with_tempdir
fn()
File "/usr/local/bin/duplicity", line 1352, in main
do_backup(action)
File "/usr/local/bin/duplicity", line 1484, in do_backup
check_last_manifest(col_stats) # not needed for full backup
File "/usr/local/bin/duplicity", line 1177, in check_last_manifest
last_backup_set.check_manifests()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 190, in check_manifests
remote_manifest = self.get_remote_manifest()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 224, in get_remote_manifest
manifest_buffer = self.backend.get_data(self.remote_manifest_name)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 646, in get_data
fin = self.get_fileobj_read(filename, parseresults)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 609, in get_fileobj_read
return tdp.filtered_open_with_delete("rb")
File "/usr/local/lib/python2.7/site-packages/duplicity/dup_temp.py", line 118, in filtered_open_with_delete
fh = FileobjHooked(path.DupPath.filtered_open(self, mode))
File "/usr/local/lib/python2.7/site-packages/duplicity/path.py", line 755, in filtered_open
return gpg.GPGFile(False, self, gpg_profile)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpg.py", line 174, in __init__
'logger': self.logger_fp})
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 369, in run
create_fhs, attach_fhs)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 419, in _attach_fork_exec
if process.pid == 0: self._as_child(process, gnupg_commands, args)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 460, in _as_child
os.execvp( command[0], command )
File "/usr/local/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/local/lib/python2.7/os.py", line 382, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
===== End GnuPG log =====
Do I have to pass certain environment variables in the cron file? Does
anybody have an idea why this happens?

I am aware of the fact that I am using a deprecated version of duplicity
(see first line of log above). Unfortunately, version 0.7 hasn't made it
to the ports system of FreeBSD yet:

https://www.freshports.org/sysutils/duplicity/
--
Niklaas
e***@web.de
2015-10-13 18:45:45 UTC
Permalink
Post by Niklaas Baudet von Gersdorff
I get the following error when running duplicity from a crontab on a
FreeBSD 10.1 system. Running the same script manually works without any
problems.
See http://www.nongnu.org/duplicity/
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon Oct 5 19:54:28 2015
Cleanup of temporary directory /tmp/duplicity-qD5xDy-tempdir failed - this is probably a bug.
===== Begin GnuPG log =====
File "/usr/local/bin/duplicity", line 1509, in <module>
with_tempdir(main)
File "/usr/local/bin/duplicity", line 1503, in with_tempdir
fn()
File "/usr/local/bin/duplicity", line 1352, in main
do_backup(action)
File "/usr/local/bin/duplicity", line 1484, in do_backup
check_last_manifest(col_stats) # not needed for full backup
File "/usr/local/bin/duplicity", line 1177, in check_last_manifest
last_backup_set.check_manifests()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 190, in check_manifests
remote_manifest = self.get_remote_manifest()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 224, in get_remote_manifest
manifest_buffer = self.backend.get_data(self.remote_manifest_name)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 646, in get_data
fin = self.get_fileobj_read(filename, parseresults)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 609, in get_fileobj_read
return tdp.filtered_open_with_delete("rb")
File "/usr/local/lib/python2.7/site-packages/duplicity/dup_temp.py", line 118, in filtered_open_with_delete
fh = FileobjHooked(path.DupPath.filtered_open(self, mode))
File "/usr/local/lib/python2.7/site-packages/duplicity/path.py", line 755, in filtered_open
return gpg.GPGFile(False, self, gpg_profile)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpg.py", line 174, in __init__
'logger': self.logger_fp})
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 369, in run
create_fhs, attach_fhs)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 419, in _attach_fork_exec
if process.pid == 0: self._as_child(process, gnupg_commands, args)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 460, in _as_child
os.execvp( command[0], command )
File "/usr/local/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/local/lib/python2.7/os.py", line 382, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
===== End GnuPG log =====
Do I have to pass certain environment variables in the cron file? Does
anybody have an idea why this happens?
I am aware of the fact that I am using a deprecated version of duplicity
(see first line of log above). Unfortunately, version 0.7 hasn't made it
https://www.freshports.org/sysutils/duplicity/
try setting PATH env var in crontab.

..ede/duply.net
Philip Jocks
2015-10-13 18:40:55 UTC
Permalink
Hej Niklaas,
Post by Niklaas Baudet von Gersdorff
I get the following error when running duplicity from a crontab on a
FreeBSD 10.1 system. Running the same script manually works without any
problems.
See http://www.nongnu.org/duplicity/
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Mon Oct 5 19:54:28 2015
Cleanup of temporary directory /tmp/duplicity-qD5xDy-tempdir failed - this is probably a bug.
===== Begin GnuPG log =====
File "/usr/local/bin/duplicity", line 1509, in <module>
with_tempdir(main)
File "/usr/local/bin/duplicity", line 1503, in with_tempdir
fn()
File "/usr/local/bin/duplicity", line 1352, in main
do_backup(action)
File "/usr/local/bin/duplicity", line 1484, in do_backup
check_last_manifest(col_stats) # not needed for full backup
File "/usr/local/bin/duplicity", line 1177, in check_last_manifest
last_backup_set.check_manifests()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 190, in check_manifests
remote_manifest = self.get_remote_manifest()
File "/usr/local/lib/python2.7/site-packages/duplicity/collections.py", line 224, in get_remote_manifest
manifest_buffer = self.backend.get_data(self.remote_manifest_name)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 646, in get_data
fin = self.get_fileobj_read(filename, parseresults)
File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 609, in get_fileobj_read
return tdp.filtered_open_with_delete("rb")
File "/usr/local/lib/python2.7/site-packages/duplicity/dup_temp.py", line 118, in filtered_open_with_delete
fh = FileobjHooked(path.DupPath.filtered_open(self, mode))
File "/usr/local/lib/python2.7/site-packages/duplicity/path.py", line 755, in filtered_open
return gpg.GPGFile(False, self, gpg_profile)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpg.py", line 174, in __init__
'logger': self.logger_fp})
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 369, in run
create_fhs, attach_fhs)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 419, in _attach_fork_exec
if process.pid == 0: self._as_child(process, gnupg_commands, args)
File "/usr/local/lib/python2.7/site-packages/duplicity/gpginterface.py", line 460, in _as_child
os.execvp( command[0], command )
File "/usr/local/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/local/lib/python2.7/os.py", line 382, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
===== End GnuPG log =====
Do I have to pass certain environment variables in the cron file? Does
anybody have an idea why this happens?
we always pass

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SHELL=/bin/sh

in crontab on FreeBSD.

Cheers,

Philip
Niklaas Baudet von Gersdorff
2015-10-20 09:39:36 UTC
Permalink
Thanks, Edgar and Philip.
Post by Philip Jocks
we always pass
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SHELL=/bin/sh
Setting
Post by Philip Jocks
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
solved this for me. Great.
--
Niklaas
Loading...