How to fix bup bup.client.ClientError: server tunnel returned exit code 255

Problem:

When running bup using the bup remote functionality, e.g. using

bup init -r 192.168.1.215:/var/bup

you see these error messages:

Traceback (most recent call last):                                                                                                                            
  File "/usr/lib/bup/cmd/bup-init", line 45, in <module>                                                                                                      
    cli = client.Client(argv_bytes(opt.remote), create=True)                                                                                                  
  File "/usr/lib/bup/cmd/../bup/client.py", line 108, in __init__                                                                                             
    self._available_commands = self._get_available_commands()                                                                                                 
  File "/usr/lib/bup/cmd/../bup/client.py", line 181, in _get_available_commands                                                                              
    raise ClientError('unexpected help header ' + repr(line))                                                                                                 
bup.client.ClientError: unexpected help header b''                                                                                                            
Exception ignored in: <function Client.__del__ at 0x7fa7d7e2bb80>                                                                                             
Traceback (most recent call last):                                                                                                                            
  File "/usr/lib/bup/cmd/../bup/client.py", line 122, in __del__                                                                                              
    self.close()                                                                                                                                              
  File "/usr/lib/bup/cmd/../bup/client.py", line 147, in close                                                                                                
    raise ClientError('server tunnel returned exit code %d' % rv)                                                                                             
bup.client.ClientError: server tunnel returned exit code 255

Solution

You need to accept the remote host key and setup passwordless login, else bup won’t be able to connect to the host using SSH.

Just SSH to the host without username (since bup will not use an explicit username either):

ssh 192.168.1.215

If you see a prompt like

The authenticity of host '10.11.12.15 (10.11.12.15)' can't be established.
ECDSA key fingerprint is SHA256:ZaIJ51uHwI9Q3i/CKdjF3Erwt27CjQqa4YL45UV5rwM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

enter yes and press return.

If you see a password prompt, you have not setup SSH correctly.

I use the following ~/.ssh/config on the bup client:

Host 192.168.1.215
  User bup
  IdentityFile /home/uli/.ssh/id_bup
  IdentitiesOnly yes

and I have copy-&-pasted the content of /home/uli/.ssh/id_bup.pub to /home/bup/.ssh/authorized_keys on the bup server in order to setup passwordless login.