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 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 ?
File "/usr/bin/duplicity", line 458, in with_tempdir
File "/usr/bin/duplicity", line 444, in main
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
File "/usr/lib64/python2.4/site-packages/duplicity/", line 213, in GPGWriteFile
data =
File "/usr/lib64/python2.4/site-packages/duplicity/", line 407, in next
result = self.process(, size)
File "/usr/lib64/python2.4/site-packages/duplicity/", line 487, in process
data, last_block = self.get_data_block(fp, size - 512)
File "/usr/lib64/python2.4/site-packages/duplicity/", line 508, in get_data_block
buf =
File "/usr/lib64/python2.4/site-packages/duplicity/", line 338, in read
buf =
IOError: [Errno 22] Invalid argument

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

read_size = min(64*1024, max_size)


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.


Leave a Reply