Terminal requires a reset every time after 'pv' runs

I’m doing a btrfs incremental backup in Gnome terminal piping btrfs send to pv before piping it to btrfs receive. Every time after this executes I have to type reset in terminal for the terminal to show what I am typing. Otherwise, the terminal works but does not reflect anything I type visually. If I do it without the pv everything works normally. What’s the problem with pv?

btrfs send | pv | btrfs Is crashing your terminal? What terminal is it?

sudo btrfs send -p | pv | sudo btrfs receive
It’s the default Gnome terminal. And it’s not crashing, it stops reflecting keyboard input at the cursor. But it executes and runs normally otherwise.

Sounds like echo was turned off.
What does stty -a tell you the terminal settings are before and after?

here’s the diff:
Before: icrnl ixon isig icanon iexten echo -tostop
After: -icrnl -ixon -isig -icanon -iexten -echo tostop

Ok. something turned off echo (-echo).
What if you run without pv in the pipeline? Does echo stay on?
If echo is still turned off. You can try the two btrfs commands on there own.

I guess I’ll just ditch pv. Without pv everything works normal.

My guess is it is something to do with the way you are calling sudo twice. sudo bash -c 'btrfs send -p | pv | btrfs receive' would very likely work around the problem.

Thanks, Gregory, this was it.

Per sudo guys it is fixed in an upstream version already (not yet in F39 vanilla repo as of a couple of days ago).

1 Like