How to fix: Duplicity error 22: Invalid argument

The latest version of duplicity which can run on RHEL 5 without too many dependency problems (available from Dag’s repository at http://packages.sw.be/duplicity/) has a nasty bug which results in the following error message:

IOError: [Errno 22] Invalid argument


Traceback (most recent call last):
File "/usr/bin/duplicity", line 463, in ?
with_tempdir(main)
File "/usr/bin/duplicity", line 458, in with_tempdir
fn()
File "/usr/bin/duplicity", line 444, in main
full_backup(col_stats)
File "/usr/bin/duplicity", line 155, in full_backup
bytes_written = write_multivol("full", tarblock_iter, globals.backend)
File "/usr/bin/duplicity", line 87, in write_multivol
globals.gpg_profile,globals.volsize)
File "/usr/lib64/python2.4/site-packages/duplicity/gpg.py", line 213, in GPGWriteFile
data = block_iter.next(bytes_to_go).data
File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 407, in next
result = self.process(self.input_iter.next(), size)
File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 487, in process
data, last_block = self.get_data_block(fp, size - 512)
File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 508, in get_data_block
buf = fp.read(read_size)
File "/usr/lib64/python2.4/site-packages/duplicity/diffdir.py", line 338, in read
buf = self.infile.read(length)
IOError: [Errno 22] Invalid argument

The problem can be easily fixed by changing line no. 507 from:

read_size = min(64*1024, max_size)

to:

read_size = min(64*1024, max(max_size, 512))

The problem also occurs if you forget to pass “–exclude /selinux” to duplicity.

More info about the bug.

Share

Leave a Reply