borgmatic restore fails with "Error running actions for repository 'utf-8' codec can't decode byte 0xff in position 61: invalid start byte" #476
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#476
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Hi all,
I have an docker-compose file for an wordpress setup, including borgmatic.
If I try to restore the database, it fails during the restore.
Somebody any Idea if I make an mistake or is their an bug in the sql-hook?
Thanks
Henning
docker-compose.yml
config.yml
Steps to reproduce (if a bug)
running:
Actual behavior (if a bug)
After some parts of the databse are restore, it fails with this error:
Expected behavior (if a bug)
The borgmatic command works and return 0.
Other notes / implementation ideas
Coping the sql dump from the repo, and importing it on the db container via
mysql -u root -pabcde < database.sql
works.Environment
borgmatic version: 1.5.18
borgmatic installation method: docker-compose
Borg version: borg 1.1.17
Python version: Python 3.8.10
Database version (if applicable): mysql Ver 15.1 Distrib 10.5.12-MariaDB, for Linux (x86_64) using readline 5.1
operating system and version:
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.13.6
PRETTY_NAME="Alpine Linux v3.13"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
Thank you for taking the time to report this! The error message has the look of a Python unicode error, but based on this output, I can't currently pinpoint where it's occurring or reproduce the issue. My guess, based on your MySQL options (
--default-character-set=utf8mb4
), is that MariaDB is outputting some text in a character encoding that borgmatic is misinterpreting.Would it be possible for you to provide a santized version of your database in which this issue is occurring? Even something with all or most of the values removed, assuming that still produces the same issue with borgmatic. Thanks!
Thanks for your quick response. I will try tomorrow to create a sanitized version of the sql database.
I'm new to databases, so if I do something wrong (reomove to mutch, make in invalid or stuff like that) please tell and give me a hint :-)
I removed all before and after the position there it fails.
It looks like the "bad" part is this
Thank you! I've been trying to reproduce this, and thus far I've gotten no repro when running MariaDB via Docker (with the restored "problem" data) and borgmatic running on my host. So now I'm trying to run everything in Compose as per your example. Can I get a look at the portions of your Compose file that define both the
wordpress_network
and themysql-socket-vol-1
? Appreciate it.Hi, both things are only for nicer naming :-)
However, it looks I used the "wrong" backup for posting. Sorry :-(
I add a new "dump" and also an full docker-compose project, including an repo which fails.
Due the "large" db_data part, it can not be uploaded here, but you can find download it: https://07q.de/data/borg.tar.xz (a bit slow, but should work)
Extract and just run (I hope, I removed all absolute paths):
docker-compose up -d
docker-compose exec borgmatic borgmatic restore -v2 --archive latest
Passwords are in the docker-compose.yml or config.yml files.
Thank you so much for including a full repro environment. I had to change the MariaDB image version to 10.6.5 to get it to start, but now it's running and I have a full repro of the problem! Now, to figure out what's going on...
I have a fix! So the problem was that borgmatic was calling
mysql --verbose
as part of doing a database restore, which caused MySQL to spew every single database statement to stdout, which caused borgmatic to try to decode them all so it could stuff them into logs. But if the database contained any non-UTF-8 values, this blew up! The fix was to remove the--verbose
flag tomysql
. After all, there's no good reason to log the entire contents of the database when doing a restore.Thanks again for your patience and help here. Wouldn't have been able to do it without your repro environment. This fix will be part of the next release.
Thanks a lot for your quick bugfix.
I'm happy I can continue using borgmativ without any bad feeling. :-D
Just released in borgmatic 1.5.22!