why is the `tcgetattr` error seen when ssh is used for dumping the backup file on another server?
database-backups, mysql, ssh
Solution
I've seen this error when forcing pseudo-terminal allocation using `ssh -t -t` or `ssh -tt`.
The `tcgetattr` function is used to look up the attributes of the pseudoterminal represented by a file descriptor; it takes a file descriptor and a pointer to a termios structure to store the terminal metadata in. It looks to me from the stub code in glibc that this error represents a null pointer for the `termios` struct. I am not sure whether these same error handling semantics are in place for the platform-specific implementations of `tcgetattr`.
If you want to suppress this error, invoke `ssh` like so:
ssh 2>/dev/null
This will redirect STDERR to `/dev/null`; you won't see the error when invoking with this redirection. Note that this will mask other errors with `ssh`; you may need to remove this for debugging purposes.
Problem
I want to dump a tables backup on another server and I am using ssh for doing it. when I run the below command, it gives an error but dump file is copied to destination. ``` mysqldump -u username -ppassword dbname tablename | ssh -t -t servers_username@domain_name 'cat > /tmp/bckp.sql'; ``` tcgetattr: Invalid argument If I press CTRL+c then it appends error message with `Killed by signal 2.` Why is this error?