Sample Header Ad - 728x90

What causes \r's to be inserted before \n's when retrieving a binary file over ssh, and how do I circumvent it?

6 votes
2 answers
1463 views
I have inherited a Ubuntu 14.04 production server which needs to be upgraded to 20.04, and I would like a sandboxed version to experiment with first, hence I want to dump and restore the filesystems over the network from either a MacOS or another 14.04 virtualbox instance. An earlier version of this question is at https://askubuntu.com/q/1314747/963 . The server cannot "see" my machines so I cannot easily run dump and push the result remotely to my machine, but need to invoke ssh from my machine to run dump. ssh -t me@there "echo MYPASSWORD | sudo -S dump -y -f - /boot 2>/dev/null " > boot.dump Problem is that I've found that running this command inserts a lot of \r characters in front of \n characters which ruins the dump file so restore cannot use it. I understand that this is probably due to a driver translating linefeeds to the characters needed for printing, but I do not see where this is triggered. How should I do this to get the correct binary dump file?
Asked by Thorbjørn Ravn Andersen (1064 rep)
Feb 9, 2021, 04:08 PM
Last activity: Sep 13, 2021, 12:59 PM