I've created a simple nbd-server instance which is sharing a single 1GB file which I created with:
dd if=/dev/zero of=nbd.file bs=1048576 count=1024
The nbd.conf file looks like this:
[generic]
[export1]
exportname = /Users/michael/Downloads/nbd-3.21/nbd.file
I start the server on my Mac as follows:
nbd-server -d -C /Users/michael/Downloads/nbd-3.21/nbd.conf
But when I try to connect the Linux client I get an error:
$ nbd-client -p -b 4096 nbd-server.local -N export1 /dev/nbd0
Negotiation: ..size = 1024MB
Error: Failed to setup device, check dmesg
Exiting.
There is nothing in dmesg and I can't find any documentation on exactly what went wrong. The server output looks like this, showing no obvious errors:
** Message: 20:05:55.820: virtstyle ipliteral
** Message: 20:05:55.820: connect from 192.168.1.105, assigned file is /Users/michael/Downloads/nbd-3.21/nbd.file
** Message: 20:05:55.820: No authorization file, granting access.
** Message: 20:05:55.820: Size of exported file/device is 1073741824
** Message: 20:05:55.821: Starting to serve
Error: Connection dropped: Connection reset by peer
Exiting.
All of these error messages lead me to believe the issue is on the client: it doesn't like something, so it terminates the connection. If I daemonize the server it happily lets the client try to reconnect.
I thought perhaps I should have more lines in my config file, but I don't see any obvious optional config items that would help. I thought perhaps there was some minimum file size, so I bumped it up from 16MB to 1GB.
What does the error "Failed to setup device" mean? How can I troubleshoot what is going wrong or fix it?
question from:
https://stackoverflow.com/questions/65895405/nbd-client-failed-to-setup-device 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…