nbd-client fails to connect Error: Socket failed: Connection refused
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nbd |
New
|
Unknown
|
|||
nbd (Ubuntu) |
Fix Released
|
High
|
Mitchell Dzurick | ||
Noble |
Fix Committed
|
High
|
Mitchell Dzurick |
Bug Description
[ Impact ]
nbdtab uses a port of 0 by default which is not sensible. This means that if you do not set a default port in nbdtab, it will fail.
You will see an error such as: Error: Socket failed: Connection refused
[ Test Plan ]
$ lxc launch ubuntu:noble n-vm --vm
$ lxc shell n-vm
# apt update -y && apt install -y nbd-client nbd-server
# dpkg -s nbd-client | grep Version:
Version: 1:3.26.1-1build1
# modprobe nbd
# truncate -s 1T /vol-0.img
# cat > /etc/nbd-
[vol0]
exportname = /vol-0.img
_EOF_
# systemctl restart nbd-server.service
Verify that NBD is working properly:
# nbd-client localhost /dev/nbd0 -name vol0
It should work.
To clean it up:
# nbd-client -d /dev/nbd0
Now, trigger the problem:
# cat >> /etc/nbdtab << _EOF_
nbd0 localhost vol0
_EOF_
# nbd-client nbd0
You should see the error:
# nbd-client nbd0
Error: Socket failed: Connection refused
Test the fix:
# add-apt-repository -y ppa:mitchdz/
# apt update -y && apt upgrade -y
# dpkg -s nbd-client | grep Version:
Version: 1:3.26.
# nbd-client -d /dev/nbd0
< no errors here>
[ Where problems could occur ]
* This changes the default port, so issues using custom ports could arise. This seems unlikely since it is a one line change that should get overridden.
Related branches
- Andreas Hasenack: Approve
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 57 lines (+37/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/0002-Set-sensible-default-for-port.patch (+27/-0)
debian/patches/series (+1/-0)
- Bryce Harrington (community): Approve
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 57 lines (+37/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/0002-Set-sensible-default-for-port.patch (+27/-0)
debian/patches/series (+1/-0)
Changed in nbd: | |
status: | Unknown → New |
Changed in nbd (Ubuntu): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
description: | updated |
summary: |
- nbd-client fails to connect when using /etc/nbdtab on Ubuntu 24.04 - (Noble) + nbd-client fails to connect Error: Socket failed: Connection refused |
description: | updated |
Changed in nbd (Ubuntu Noble): | |
status: | Triaged → In Progress |
importance: | Undecided → High |
It seems to be an upstream issue: https:/ /github. com/NetworkBloc kDevice/ nbd/issues/ 156