nbd fails with "Negotiation: Error: Server closed connection"

While experimenting with nbd (network block device) on Linux, I ran into connection failures, where both my server and client died:

** Message: virtstyle ipliteral
** Message: connect from 127.0.0.1, assigned file is /home/user/fs/image
** Message: Authorized client
** Message: Starting to serve
** Message: Size of exported file/device is 33554432
Negotiation: Error: Server closed connection
Exiting.
Error: Read failed: Connection reset by peer

Exiting.

Turned out, this was due to me starting the server using the command line options specifying the file to serve.
./nbd-server localhost:10809 /home/user/fs/image 

Apparently this simply does not work.

Solution was to create the server config file and leave out the server command line options completely.

[export]
        exportname = /home/user/fs/image
authfile = /etc/nbd-server/allow

 

Then run the client with the name specified in the config.

sudo ./nbd-client -name export 127.0.0.1 10809 /dev/nbd1

I could have saved some time debugging this if I just had read the this bug report thoroughly enough:

Comments

Popular posts from this blog

iMovie event library on a network drive, NAS

Proxmox PCIe passthrough on HP gen8 - failed to set iommu for container

Backup and restore observium