Error Using xbstream, compression, and encryption together

I am using this command:

innobackupex --encrypt=AES256 --encrypt-key-file=/usr/lib/backup/BACKUP.key --user=x --password=‘x’ --stream=xbstream /usr/lib/backup/ > /usr/lib/backup/g.“$TIMESTAMP”.xbstream

Then I wanted to check if I can restore my file using:

xbstream -x < /usr/lib/backup/g.2013-09-22_07-30-35.xbstream -C /usr/lib/backup/res

but gives me the error:

xb_stream_read_chunk(): wrong chunk magic at offset 0x0.

I tried decrypting the file first as well, which gives me an OK message for the decryption, but I get the same error when I run the xbstream command again.

How can I fix this?


Can you tell me which xtrabackup version you are using? Because looks like there are some bugs related to this.

One more thing that the stream must be decrypted first before read by xbstream so I would suggest to use both at the same time. something like

xbcrypt -d --a AES256 -f [COLOR=#252C2F]/usr/lib/backup/BACKUP.key | xbstream -x -C [COLOR=#252C2F]/usr/lib/backup/res

xtrabackup version 2.1.5 for Percona Server 5.1.70 unknown-linux-gnu (x86_64) (revision id: 680)

I tried the command you gave me with a couple changes like adding -i for the input file, and it seems to have worked. I still have to try restoring the file to a new database to confirm if it is correct, but it looks good, and no error messages.

Here was the command that worked for me, for anyone looking for this answer:
xbcrypt -d -a AES256 -f /usr/lib/backup/BACKUP.key -i myfile.xbstream | xbstream -x -C /usr/lib/backup/res

niljoshi, thanks so much! I will be testing these files tomorrow, if I don’t report back, you can assume it worked successfully.