Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1490039 - Using nbd for swap causes dependency problems
Summary: Using nbd for swap causes dependency problems
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: nbd
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Robin Lee
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-09 15:07 UTC by Göran Uddeborg
Modified: 2017-10-04 22:22 UTC (History)
6 users (show)

Fixed In Version: nbd-3.16.2-1.fc27 nbd-3.16.2-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-30 06:52:20 UTC
Type: Bug


Attachments (Terms of Use)
My modified service file (646 bytes, text/plain)
2017-09-09 15:07 UTC, Göran Uddeborg
no flags Details

Description Göran Uddeborg 2017-09-09 15:07:13 UTC
Created attachment 1324090 [details]
My modified service file

Description of problem:
I have a diskless box where I try to use nbd for swap partition.  Out of the box, this causes a timeout and failure on startup.  When systemd tries to start the dev-nbd0.swap unit, it waits for dev-nbd0.device, but that apparently doesn't start up, so there is a timeout.  The nbd@nbd0.service unit comes up much later, so even if there wasn't the timeout, there would be no swap space available.

I tried to add a dependency from dev-nbd0.swap to nbd@nbd0.service, but that causes a loop: nbd@nbd0.service depends on sysinit.target which depends on swap.target which depends on dev-nbd0.swap which would then close the loop with my attempted dependency on nbd@nbd0.service.

Related to this: there is a Before=dev-%i.device entry in the nbd@.service file, but that is ignored according to systemd:

sep 05 10:56:11 pluto systemd[1]: nbd@nbd0.service: Dependency Before=dev-nbd0.device ignored (.device units cannot be delayed)


Version-Release number of selected component (if applicable):
nbd-3.16.1-1.fc26.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. Enable nbd@nbd0.service
2. Add an entry to swap on /dev/nbd0 in /etc/fstab


Additional info:
After some experimentation, I've come up with an alternative systemd service file for nbd which seems to work correctly.  See the attachment for the details.  The key difference from the distributed one is that my version do not include default dependencies.  Instead it lists a number of "lower level" dependencies I believe are needed.  In addition, it also retriggers udevadm for the device after coming up, so systemd will be aware the device is ready.  I'm not sure if this latter problem could also be avoided with the appropriate dependencies; I haven't found out how if so.

I'm not sure if this is the best solution, or even if it is correct.  It seems to work in my use case.

Comment 1 Robin Lee 2017-09-23 06:54:33 UTC
Forwarded upstream: https://github.com/NetworkBlockDevice/nbd/issues/55

Comment 2 Fedora Update System 2017-09-24 09:38:46 UTC
nbd-3.16.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-be2432ba4e

Comment 3 Fedora Update System 2017-09-24 09:39:11 UTC
nbd-3.16.2-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-3dd9359533

Comment 4 Fedora Update System 2017-09-24 20:53:48 UTC
nbd-3.16.2-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-3dd9359533

Comment 5 Fedora Update System 2017-09-25 06:21:08 UTC
nbd-3.16.2-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-be2432ba4e

Comment 6 Fedora Update System 2017-09-30 06:52:20 UTC
nbd-3.16.2-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2017-10-04 22:22:09 UTC
nbd-3.16.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.