Saturday, July 15, 2017

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, 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
Error: Read failed: Connection reset by peer


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.

        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 10809 /dev/nbd1

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


  1. I am thankful for this blog to gave me much knowledge regarding my area of work. I also want to make some addition on this platform which must be in knowledge of people who really in need. Thanks.HPE ProLiant ML350 Gen9

  2. This blog is really helpful to deliver updated educational affairs over internet which is really appraisable. I found one successful example of this truth through this blog. I am going to use such information now.Cisco UCS C220 M4

  3. Sometimes is becomes very hard to take appreciation for your hard work. But sometime only few technical point makes your work worthwhile. Suggestion under this blog is quite good.HPE ProLiant ML10 Gen9