Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: mount-filesystems runs before udev-settle is done (Read 248 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mount-filesystems runs before udev-settle is done

mount-filesystems have no dependency on udev-settle. This causes my md devices (/dev/md/xyz) to fail to mount.

Adding the dependency fixes it for me. Is this something that would make sense to have?

Re: mount-filesystems runs before udev-settle is done

Reply #1
Yup, it definitely makes sense. I should probably make the entire initial udev bundle a dependency.

Sidenote: Looking at this some more, I'm pretty sure the eudev-s6 script being a separate thing is totally pointless too and should be merged into the boot stuff.

Re: mount-filesystems runs before udev-settle is done

Reply #2
Just rebooted again, and having udev-settle as a dependency wasn't enough. Not sure if the udev bundle is enough. It's probably eudev's udevd that's needed.

Re: mount-filesystems runs before udev-settle is done

Reply #3
When I originally made this, I was trying to sort of copy what runit-rc was doing, but clearly that doesn't always make sense. For runit, it needed udevadm to be running (so it could force it to exit later) but there's no way for it to guarantee that unless udevd was run on the second stage and the udevadm stuff was all executed on the first stage. That doesn't matter to s6, we can do it the right way, as early in the boot process as possible. It's not like there's a non-niche reason why someone wouldn't want udevd running anyway (if you actually don't; we trust you know what you're doing and can handle all of that stuff yourself).

Re: mount-filesystems runs before udev-settle is done

Reply #4
Okay, I have just pushed new versions of s6 and s6-rc into the goblins repo. This change replaces eudev-s6 and makes it obsolete. It's now included in s6-rc and started on boot (so no need to bring up udevd anymore). All the udev stuff should trigger before any filesystems are mounted. If you're brave, feel free to enable the repo in your pacman.conf and see if it solves the problem. Just be careful with the goblins repo since this is the alpha stuff.

Code: [Select]
[goblins]
Include = /etc/pacman.d/mirrorlist

Sidenote: There's some other new stuff as well but I will document that later.

Re: mount-filesystems runs before udev-settle is done

Reply #5
Well nope, forget the above. There's some obvious mistakes, but even after correcting those it didn't behave like how I expected (udevadm trigger seems not to do anything if it's run too early which messes things up). Well that's why I put those in staging. :P

Re: mount-filesystems runs before udev-settle is done

Reply #6
Okay, now the staging s6 and s6-rc packages work correctly (there's also a new dhcpcd-s6 because of dependency reasons). Well at least they work on my machine anyway. The strategy here is basically start the udevd daemon -> udevadm to trigger events -> udevadm settle -> execute the mount bundle. That seems to be the correct sequence of events and it works as I expect.

I'm not sure if that actually solves your problem though. I think mdadm needs to be run earlier. I already have logic in place for cryptsetup-s6 and lvm-s6 so that they run before we try to mount fileystems (that's what the pre-mount bundle is for). If just the new staging s6-rc/s6 packages don't work, you could try adding mdadm to the pre-mount bundle, making a new database, and rebooting again. That might be the correct thing to do here. If so, I can make the change in the package pretty easily.

Re: mount-filesystems runs before udev-settle is done

Reply #7
Quote
The strategy here is basically start the udevd daemon -> udevadm to trigger events -> udevadm settle -> execute the mount bundle

Yeah, that sounds just about right. Hopefully I'll be able to test it later tonight.

Re: mount-filesystems runs before udev-settle is done

Reply #8
Something's still not right. I don't get enough log output to see exactly in which order the scripts are run, but I do see it logging the completion of mount-filesystems before the completion of udevadm.

That doesn't necessarily mean udevadm --settle didn't finish before mount-filesystems was started, but it is some kind of indication.

I don't think I need mdadm. In my case, the problem is that the symlinks under /dev/md/ haven't been created when mount-filesystems are executed. But they're there when I've logged in, without ever having run mdadm. So it should be an udev rule that adds them.

I'm pretty sure I didn't miss something in the upgrade. For example, I see it running the new udevadm script instead of the separate udev-trigger/settle scripts.

Re: mount-filesystems runs before udev-settle is done

Reply #9
Hmm could you confirm if it is indeed udev that creates those symlinks and not something else? The easy way to check would be to remove the "udev" line from the boot bundle as well as the the dependencies file in the mount bundle. Then make+switch to a new database (directly running the hook: "sh /usr/share/libalpm/scripts/s6-rc-db-update-hook" is a nice shortcut for that).

If there's no /dev/md/ symlinks after that, then we know for sure it's something with the udev scripts. Possibly making the bundle a dependency doesn't work like how I expect (waiting until everything in the bundle is done)?

Re: mount-filesystems runs before udev-settle is done

Reply #10
Hmm could you confirm if it is indeed udev that creates those symlinks and not something else? The easy way to check would be to remove the "udev" line from the boot bundle as well as the the dependencies file in the mount bundle. Then make+switch to a new database (directly running the hook: "sh /usr/share/libalpm/scripts/s6-rc-db-update-hook" is a nice shortcut for that).

If there's no /dev/md/ symlinks after that, then we know for sure it's something with the udev scripts. Possibly making the bundle a dependency doesn't work like how I expect (waiting until everything in the bundle is done)?
I don't know about /dev/md but LVM symlinks are definitely created by udev (i am currently using nldev for which i wrote special script to create these symlinks)

Re: mount-filesystems runs before udev-settle is done

Reply #11
Quote
Possibly making the bundle a dependency doesn't work like how I expect (waiting until everything in the bundle is done)?

I tested how bundle dependencies work, and perhaps this explains our problems.

I added two bundles A and B. Each having a single oneshot service, a and b.

A/a does not have any dependencies.

Now, if I add A (the bundle) as a dependency to b (the service), then it works as expected; starting the bundle B first starts A/a, and then b.

But, adding A (the bundle) as a dependency to B (the bundle), and then starting the bundle B does not start A/a first. It "fails" in the same way if I add a (the service) as a dependency to B (the bundle).


Re: mount-filesystems runs before udev-settle is done

Reply #13
And sure enough, adding udev as a dependency to mount-filesystems works!

In my tree, mount was the only bundle with dependencies.

Re: mount-filesystems runs before udev-settle is done

Reply #14
Should be fixed in s6-rc now. It's has the same number/version so you'll have to reinstall it from goblins. Be sure to resync the mirror (so pacman -Sy s6-rc). Not sure when the next mirror sync is, but it should update so you'll know it's the rebuilt s6-rc version.