fix(base): don't wait infinitely for a device with non-persistent name - #1844
fix(base): don't wait infinitely for a device with non-persistent name#1844coiby wants to merge 1 commit into
Conversation
|
In fact c79fc8f fixed some bugs reported to openSUSE kump and their use of BTW, don't you know the UUID of the device to use |
aafeijoo-suse
left a comment
There was a problem hiding this comment.
Forget my previous comment, I overlooked the fact that we will continue waiting for the device to become available using its persistent path. So, this should be ok.
d8b507a to
55cb079
Compare
Thanks for reviewing the patch! I just pushed a new version. The is no code change. I only improved the commit message and hopefully it can bring more clarity. |
|
There is a merge commit in the PR. Can you rebase your branch on main to drop the merge commit? |
|
I am quite sure this change will reintroduce the problem fixed by commit c79fc8f. Your problem is calling dracut with --mount (or --add-device) with a non-persistent device name. The problem fixed with c79fc8f is: The scenario when this problem was found: The resulting initrd has: During boot dracut calls: We want to wait forever for the devices. After 90 seconds systemd prints "[ TIME ] Timed out waiting for device /dev/mapper/ systemctl show /dev/mapper/vg-lvol0 prints "JobRunningTimeoutUSec=1min 30s" systemd uses /dev/mapper/vg-lvol0, because that is what is found in the fstab - thus timing out the mount unit after 90 seconds. We need to set the timeout for the device as configured in the fstab. |
Currently, dracut will wait finitely for a block device e.g. /dev/sda2 when users use "dracut --add-device /dev/sda2". However, /dev/sda2 is not a persistant name and it can show as a different name and kdump can fail [1] as dracut will wait forever for /dev/sda2. Commit c79fc8f ("fix(dracut): rework timeout for devices added via --mount and --add-device") already sets infinite timeout for the underlying persistent device. There is no need to also set infinite timeout for non-persistent device name. Removing the redundant wait can automatically resolve the case where a device name changes. [1] rhkdump/kdump-utils#121 Reported-by: Alex Burmashev <alexander.burmashev@oracle.com> Reported-by: Harshvardhan Jha <harshvardhan.j.jha@oracle.com> Fixes: c79fc8f ("fix(dracut): rework timeout for devices added via --mount and --add-device") Signed-off-by: Coiby Xu <coxu@redhat.com>
Thanks for letting me know that dracut currently doesn't convert a disk name to a persistent name when writing to /etc/fstab! Fortunately, in the case of rhkdump/kdump-utils#121, I'm bit confused with c79fc8f. Because the commit message explicitly mentioned
Thanks for explaining the problem that c79fc8f tried to address in details! In your given example, you want to wait infinitely for /dev/mapper/vg-lvol0. But it seems even before commit c79fc8f, dracut already waits infinitely for /dev/mapper/vg-lvol0 because /dev/mapper/vg-lvol0 is already a persistent name, And if we still require users to use persistent device name when using So if I miss anything, can you point it out to help me understand the commit better? Thanks! |
260e5c9 to
db9639e
Compare
Thanks for the reminder! I didn't realize that Github will merge the main branch to update my branch. The merge commit is dropped now. |
|
After reading Jiri's comment now I remember the issue. As the commit message says: The problem is the opposite of what you want to fix. The idea was that if a user configures a device with a specific name via |
I also don't understand why we want to wait for the persistent name. I suppose Antonio was afraid of breaking someone else's usecase, because waiting for the persistent name was what happened before the commit. I just know we need to wait for the device name as supplied to --mount (whether persistent or not), because that is what will end up in the fstab and what systemd will put into its mount unit. |
Yes, that was the only reason. |
|
@aafeijoo-suse @jiribohac Thanks for helping me understand more about commit c79fc8f! But I'm still not sure what problem it tries to solve. At least for the issue described in Jiri's comment, I don't see the necessity of that commit because /dev/mapper/vg-lvol0 is a persistent name and dracut before this commit already waits forever for it. Admittedly, using persistent name can resolve the problem that a block devices change its name as described in rhkdump/kdump-utils#121 (comment). Then why not also using persistent name for the problem that commit c79fc8f tries to resolve? Btw, today I played with dracut for a while and notice the following things,
I wonder if the second situation captures the essence of the problem that commit c79fc8f tries to resolve. If the answer is yes, maybe we make |
Yes, exactly. The problem was not that dracut would not wait for the device. The problem was that it does not set up the infinite timeout for the systemd mount unit. So systemd times out and starts the emergency shell, while dracut still waits for the device.
In my example it's not even a matter of persistent vs non-persistent names. But instead of two different persistent names. |
Thanks for letting me know the problem is systemd mount unit times out! Then I can dig more into systemd mount unit timeout and also its relationship with systemd device service timeout. I did some experiments. So far my observations don't support "systemd times out and starts the emergency shell, while dracut still waits for the device".
I will rethink about it tomorrow. Meanwhile if you think I miss anything, please let me know, thanks! |
Yes, sorry, I made this inaccurate shortcut! It's the timeout of the device, which the mount unit depends on. |
|
@jiribohac Today I did an experiment to double confirm that the timeout of mount unit won't drop us into the emergency before the device service times out. Then it proves me wrong! In the experiment, the device service is supposed to time out after 45s and the mount unit is supposed to time out after 5s. And after about 7s, I'm dropped to the emergency shell, But @aafeijoo-suse according to your comment, bsc#1231792 seems to the be problem. Can you visit the bug and share more details? Thanks! |
how does wait_for_dev change the mount unit timeout? I can only see it changing the device timeout. The function does not even know the name of the mount unit. |
Sorry, I made a typo. "wait_for_dev indeed will change the the timeout " should be "wait_for_dev indeed won't change the the timeout".
At least for the example you gave, /dev/mapper/vg-lvol0 is already an persistent name and dracut before commit c79fc8f already sets infinite timeout for this device service. So I don't there is even a need for commit c79fc8f unless bsc#1231792 is somewhat a different problem. |
|
Hi @aafeijoo-suse and @jiribohac, if possible, can you check bsc#1231792 to help me understand what problem commit c79fc8f tries to resolve? Thanks! |
It has already been described here: #1844 (comment) |
Thanks for confirming #1844 (comment) is exactly bsc#1231792! What confused me is /dev/mapper/vg-lvol0 is already a persistent device name and I thought Then I downloaded Leap-16.0-Minimal-VM.x86_64-kvm-and-xen.qcow2 to find out what really happens. It turns out SUSE use persistent_policy=by-uuid, So before commit c79fc8f, infinite timeout is set for /dev/disk/by-uuid/69f27553-5f60-41e8-94a7-51e6b8da79fc but not /dev/mapper/vg-lvol0 in SUSE kdump initrd, |
|
needs rebase |
Currently, dracut will wait finitely for a block device e.g. /dev/sda2
when users use "dracut --add-device /dev/sda2". However, /dev/sda2 is
not a persistant name and it can show as a different name and kdump can
fail [1] as dracut will wait forever for /dev/sda2.
Commit c79fc8f ("fix(dracut): rework timeout for devices added
via --mount and --add-device") already sets infinite timeout for
the underlying persistent device. There is no need to also set infinite
timeout for non-persistent device name. Removing the redundant wait can
automatically resolve the case where a device name changes.
[1] rhkdump/kdump-utils#121
Reported-by: Alex Burmashev alexander.burmashev@oracle.com
Reported-by: Harshvardhan Jha harshvardhan.j.jha@oracle.com
Fixes: c79fc8f ("fix(dracut): rework timeout for devices added via --mount and --add-device")
Checklist