** 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: - truncate -s 1T /vol-0.img - - - 2. Configure the NBD server by adding the following to `/etc/nbd-server/conf.d/exports.conf`: + 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`: - systemctl enable nbd@nbd0 - Here's what I see: - # systemctl enable nbd@nbd0 Created symlink /etc/systemd/system/dev-nbd0.device.requires/nbd@nbd0.service → /lib/systemd/system/nbd@.service. Unit /lib/systemd/system/nbd@.service 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 + root@demo-nbd-test:~# systemctl status nbd@nbd0 ○ nbd@nbd0.service - NBD client connection for nbd0 Loaded: loaded (/lib/systemd/system/nbd@.service; enabled; vendor preset: enabled) Active: inactive (dead) Docs: man:nbd-client - Feb 21 22:54:22 cephao-1-ceph-osd-1 systemd[1]: nbd@nbd0.service: Dependency Before=dev-nbd0.device ignored (.device units cannot be delayed) + Feb 21 22:54:22 demo-nbd-test systemd[1]: nbd@nbd0.service: Dependency Before=dev-nbd0.device ignored (.device units cannot be delayed) - But if you try to start it again. It'll work: - - root@cephao-1-ceph-osd-1:~# systemctl start nbd@nbd0 - root@cephao-1-ceph-osd-1:~# systemctl status nbd@nbd0 + root@demo-nbd-test:~# systemctl start nbd@nbd0 + root@demo-nbd-test:~# systemctl status nbd@nbd0 ● nbd@nbd0.service - NBD client connection for nbd0 Loaded: loaded (/lib/systemd/system/nbd@.service; 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. + Feb 21 22:57:37 demo-nbd-test systemd[1]: Starting NBD client connection for nbd0... + Feb 21 22:57:37 demo-nbd-test nbd-client[1096]: Negotiation: ..size = 3145728MB + Feb 21 22:57:37 demo-nbd-test nbd-client[1096]: Connected /dev/nbd0 + Feb 21 22:57:37 demo-nbd-test 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 sleep 6 systemctl start nbd@nbd0 - Make it executable: - 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 ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs