I've updated the description to include all the steps necessary to
reproduce the issue on Ubuntu 22.04 (Cloud Image - Server Minimal
install).
This seems to be a `systemd` thing! lol
** Description changed:
The `systemd` service for starting the NBD Clients on boot isn't
working.
### Steps to Reproduce:
+
+ 0. Install NBD
+
+ ```
+ apt install nbd-server nbd-client
+ ```
1. Prepare an NBD server with a disk image to share. For instance:
```bash
truncate -s 1T /vol-0.img
```
2. Configure the NBD server by adding the following to
`/etc/nbd-server/conf.d/exports.conf`:
```
[vol0]
exportname = /vol-0.img
```
3. Configuring the client connection in `/etc/nbdtab`:
Contents of `/etc/nbdtab`:
```
nbd0 localhost vol0
```
4. Enable it on `systemd`:
```bash
systemctl enable nbd@nbd0
```
- 5. The service not coming up on the system's boot. Look:
+ Here's what I see:
+
+ ```
+ # systemctl enable nbd@nbd0
+ Created symlink /etc/systemd/system/dev-nbd0.device.requires/[email protected]
→ /lib/systemd/system/[email protected].
+ Unit /lib/systemd/system/[email protected] is added as a dependency to a
non-existent unit dev-nbd0.device.
+ ```
+
+ 5. Add `nbd` auto-load to system'd boot:
+
+ ```
+ echo nbd > /etc/modules-load.d/nbd.conf
+ ```
+
+ 6. Reboot
+
+ ```
+ sudo reboot
+ ```
+
+ 7. The service not coming up on the system's boot. Look:
After rebooting the system, the NBD clien for `nbd0` isn't running (but
it's enabled on systemd).
```
root@cephao-1-ceph-osd-1:~# systemctl status nbd@nbd0
○ [email protected] - NBD client connection for nbd0
- Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor
preset: enabled)
- Active: inactive (dead)
- Docs: man:nbd-client
+ Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor
preset: enabled)
+ Active: inactive (dead)
+ Docs: man:nbd-client
Feb 21 22:54:22 cephao-1-ceph-osd-1 systemd[1]: [email protected]: Dependency
Before=dev-nbd0.device ignored (.device units cannot be delayed)
```
- Then, after a restart, it works:
+ But if you try to start it again. It'll work:
```
- root@cephao-1-ceph-osd-1:~# systemctl restart nbd@nbd0
+ root@cephao-1-ceph-osd-1:~# systemctl start nbd@nbd0
root@cephao-1-ceph-osd-1:~# systemctl status nbd@nbd0
● [email protected] - NBD client connection for nbd0
- Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor
preset: enabled)
- Active: active (exited) since Wed 2024-02-21 22:57:37 UTC; 2s ago
- Docs: man:nbd-client
- Process: 1096 ExecStart=//sbin/nbd-client nbd0 (code=exited,
status=0/SUCCESS)
- Main PID: 1096 (code=exited, status=0/SUCCESS)
- CPU: 4ms
+ Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor
preset: enabled)
+ Active: active (exited) since Wed 2024-02-21 22:57:37 UTC; 2s ago
+ Docs: man:nbd-client
+ Process: 1096 ExecStart=//sbin/nbd-client nbd0 (code=exited,
status=0/SUCCESS)
+ Main PID: 1096 (code=exited, status=0/SUCCESS)
+ CPU: 4ms
Feb 21 22:57:37 cephao-1-ceph-osd-1 systemd[1]: Starting NBD client
connection for nbd0...
Feb 21 22:57:37 cephao-1-ceph-osd-1 nbd-client[1096]: Negotiation: ..size =
3145728MB
Feb 21 22:57:37 cephao-1-ceph-osd-1 nbd-client[1096]: Connected /dev/nbd0
Feb 21 22:57:37 cephao-1-ceph-osd-1 systemd[1]: Finished NBD client
connection for nbd0.
```
So this forces me to have the following `/etc/rc.local` file as a
workaround:
```
#!/bin/bash
- systemctl restart nbd@nbd0
+ sleep 6
+ systemctl start nbd@nbd0
```
- If this is not the proper way of automatically starting a `nbd0` NBD
- client, please, let me know! Perhaps documentation should be more clear.
+ Make it executable:
- Interesting reference:
- https://bugs.launchpad.net/ubuntu/+source/nbd/+bug/2054470
+ ```
+ chmod +x /etc/rc.local
+ ```
+
+ Reboot again, it'll be started on next boot!
+
+ I don't think that the `/etc/rc.local` should be part of this
+ procedure... =P
+
+ NOTE: Don't need to run `update-initramfs -k all -u`.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2054616
Title:
The systemd service for NBD Client doesn't come up on boot
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nbd/+bug/2054616/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs