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


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

bup init -r

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/", line 108, in __init__                                                                                             
    self._available_commands = self._get_available_commands()                                                                                                 
  File "/usr/lib/bup/cmd/../bup/", 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/", line 122, in __del__                                                                                              
  File "/usr/lib/bup/cmd/../bup/", line 147, in close                                                                                                
    raise ClientError('server tunnel returned exit code %d' % rv)                                                                                             
bup.client.ClientError: server tunnel returned exit code 255


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):


If you see a prompt like

The authenticity of host ' (' 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:

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

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