running borgmatic borg check --repair doesn't show request to type "YES" to continue #694
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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
Run borgmatic borg check --repair on a busted repo
Steps to reproduce (if a bug)
Actual behavior (if a bug)
output looks like this:
command waits indefinitely at this point.
Expected behavior (if a bug)
command waits for user input
Other notes / implementation ideas
If I type "YES" after the warning, it works and then I see the line asking me to confirm with YES and the command continues/completes. See the attached image for YES above the request for YES.
Environment
borgmatic version: [1.7.12]
borgmatic installation method: [sudo pip install --upgrade borgmatic]
Borg version: [1.2.4 and tested 1.1.16]
Python version: [3.9.2]
Database version (if applicable): [N/A]
operating system and version: [proxmox 7.4-3 / Debian 11 bullseye]
I appreciate you taking the time to file this one. So far I haven't been able to reproduce it locally. What's supposed to happen (and what I'm seeing) is that giving
--repair
or--progress
flags should switch borgmatic out of logging mode to interactive mode so that the Borg prompt actually shows up properly. But given that your Borg output text is purple instead of gray/white, that means that switch isn't happening.So some ideas on things to try:
... to see if the interactive terminal detection is broken. The output should show
True
if it's working.echo $TERM
which should show anything other thandumb
. That also impacts borgmatic's interactive terminal detection.su -
orsudo su -
) and then running your fullborgmatic check
command change anything?Thanks!
Here are the results of the tests:
python command:
echo $TERM
terminal
GNOME Terminal 3.38.3 (Cinnamon 5.6.8)
switching to super user
(same thing)
Happy to help!
Thanks for trying these out. It looks like borgmatic is correctly detecting the interactive console, and so that's not the source of the issue. I tried running this locally with GNOME Terminal and a remote repo; still no luck reproducing.
Do you have the interest and ability to try temporarily installing some modified versions of borgmatic source files with additional debug logging on your machine? There is a particular section of logic in the check action I'd be interested in debugging, because I don't see how it can not work—but it's clearly not working on your system.
Either way, please let me know and I can get you some modified source files.
Is there a way to do it without breaking my current install? I use the pre built binary and copy it to
/usr/bin
which is pretty easy.I just tested on my other proxmox install using borgmatic 1.6.3 and borg 1.1.14 and it behaves similarly but the text is different.
The latter is pretty vanilla proxmox.
edit: this is using juice ssh on my phone. $TERM is linux.
If the only changes are the addition of more debugging logs, then it shouldn't break your install. "Shouldn't" being the operative word.
Are you talking about Borg's pre-built binary? The modifications I'm talking about would only be to borgmatic.. not Borg. So presumably that would only require dropping in some source files to replace the existing ones. And then you could always blow them away via
pip install --upgrade borgmatic
.oh right yes nevermind thats borg.
Does global (sudo without --user) install matter?
Nope, shouldn't matter. It'll just mean your source file are in a different place.
pip show borgmatic
should show the path underLocation:
sure send over the modified source files. ill give them a shot.
Okay, the two modified files are attached. In terms of where to put these on your system: Let's say that the output of
pip show borgmatic | grep ^Location
is:Then that probably means
execute.py
should get copied over/usr/lib/python3.10/site-packages/borgmatic/execute.py
or similar andcheck.py
should get copied over/usr/lib/python3.10/site-packages/borgmatic/borg/check.py
or similar. Make sure you do not copy it overactions/check.py
—that's a different file.After installing these modified source files, running borgmatic again should produce the usual output but with the addition of a bunch of new "#694: ..." log lines. Seeing your entire output including those lines would be most helpful.
Thanks for your patience here!
command executed and waiting for input presumably:
I type "YES" and hit enter:
and canceled.
Thanks! However, it looks like
check.py
might not be in the right spot, because I'm not seeing any of its debugging output. Are you sure you put it intoborgmatic/borg/check.py
, overwriting the existing file there?Also, could I see the
consistency
section of your borgmatic configuration file?recopied the two files and tried again. note im using python 3.9 not 3.10 in your example above.
and sorry about weird line wraps. i did this on a phone.
consistency section
here is where check.py is
OMG, I just figured it out, and the answer has been staring me in the face the whole time! Here's your original command:
Instead of running borgmatic's
check
action directly, this command runs borgmatic'sborg
action, designed for running arbitrary Borg commands. And thatborg
action has a limitation that it captures and logs all output—preventing interactive Borg prompts from working.The reason I couldn't reproduce this was because I wasn't running the
borg
action, I was running borgmatic'scheck
directly:This action is smarter (because it actually parses the flags instead of blindly passing them to Borg), and realizes if
--repair
is given the borgmatic needs to run in interactive mode to support Borg's prompts. So if you try thatcheck
action instead ofborg check
, I believe it'll work for you too.The other bit of serendipity is that there's already a soon-to-be-released fix implemented such that the
borg
action will no longer capture output for logging—and instead pass through Borg output unmolested. This means that, among other things, theborg check --repair
prompt will work as of the next release.I hope this gets to the bottom of the issue you were having. Thanks for sticking with this, and let me know if you have any questions! You can roll back the modified source files simply by running
sudo pip install --upgrade borgmatic
.either I first tried to run an older version or missed it in the command line options docs.
when was check added to borgmatic?
heres an idea!:
when running a borg command that exists in borgmatic, pop up a prompt to confirm the user wants to run the borg command over the native command.
I'm pretty sure it's been there since the beginning! But I'm glad to hear it looks like the prompt is working properly for you now.
That's a great idea. What I'll do is log a prominent warning when this happens.
FYI the fix to
borgmatic borg
has just been released in borgmatic 1.7.13.Thanks for your help on this!