Skip to content

Commit

Permalink
Do not call udevadm settle, only Debian uses this
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
  • Loading branch information
troglobit committed Oct 4, 2016
1 parent 0f840e6 commit 8f05b36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion finit.c
Expand Up @@ -354,7 +354,11 @@ int main(int argc, char* argv[])
if (fexist("/sbin/udevadm")) {
run("/sbin/udevadm trigger --action=add --type=subsystems");
run("/sbin/udevadm trigger --action=add --type=devices");
run("/sbin/udevadm settle --timeout=120");
/*
* Debian also calls `settle` here, but not Archlinux ...
* ... with settle some systems stop working (pulseaudio)
* run("/sbin/udevadm settle --timeout=120");
*/
}

/*
Expand Down

4 comments on commit 8f05b36

@xhebox
Copy link
Contributor

@xhebox xhebox commented on 8f05b36 Oct 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@troglobit Something new when i replaced evdev with libinput:
I found that pulseaudio is possibly not broke by settle, but my xorg.(You know musl does not support "RTLD_LAZY"...etc) Now, it worked after settle. I added Autoadddevices false to my xorg config file. I don't know why, but it just worked....And also worked well if settle was not executed.

Anyway when settle is executed, something may just go wrong without any warning. And without it, almost no damages(trigger is synced...it will not release the control until finished...on my computer, it cost 0.1 sec...the only situation i can imagine usefully is that you have hundreds of divices plugged in...of course you will need to recheck it).

I suggested that it should be added in rc.local or something else that can be modified easily, not add it there. Maybe we could write it in doc to remind someone who knows nothing about this. Let distros themselves decide whether they should settle or not.

And the list of distros i investigated:

settle:
debian, crux, void
no settle:
archlinux, alpine linux, systemd itself

EDIT: settle has nothing to do with socket or something else. It's a wait() for udev events... U can check udev's status by running it.exit when timeout...

@troglobit
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

(No, I didn't know about the missing support for RTLD_LAZY, good to know!)

I agree with you that the settle call should probably be executed early in the user's /etc/finit.conf instead. Many of the things done early could possibly be moved to runlevel [S] in /etc/finit.conf.

I'll make sure to update the docs instead, was thinking about adding a section about mdev vs udev based systems anyway.

@xhebox
Copy link
Contributor

@xhebox xhebox commented on 8f05b36 Nov 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@troglobit update:

  1. settle is a problem of my own distro, i have no point about why(musl?or the kernel is too new to use the current eudev?). I made this patch to solve it. I'm not sure if this will appear on the other eudev-based distros. This needs to be reviewed, do you have a eudev-based distro to test? Boot to see if there's a udevd[xxx]: No such file or .... in dmesg.
no such file or dir display in dmesg, this fixes it
--- .src/eudev-3.2/src/shared/util.c	2016-04-24 15:51:15.000000000 +0000
+++ eudev-3.2/src/shared/util.c	2016-04-24 15:51:15.000000000 +0000
@@ -995,11 +995,11 @@
         if (parents)
                 mkdir_parents(path, 0755);
 
-        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode > 0 ? mode : 0644);
+        fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, (mode == 0 || mode == MODE_INVALID) ? 0644 : mode);
         if (fd < 0)
                 return -errno;
 
-        if (mode > 0) {
+        if (mode != MODE_INVALID) {
                 r = fchmod(fd, mode);
                 if (r < 0)
                         return -errno;
@@ -1026,7 +1026,7 @@
 }
 
 int touch(const char *path) {
-        return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, 0);
+        return touch_file(path, true, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
 }
 
 bool null_or_empty(struct stat *st) {
  1. eudev's coldplug is not same as systemd.
[xhe@xhe-PC ~]$ cat /mnt/arch/lib/systemd/system/systemd-udev-trigger.service 
....
Description=udev Coldplug all Devices

Trigger is enough for systemd to coldplug all devices. But i found xorg can't work with udev. And finally i got a look at gentoo's script, found that:

https://gitweb.gentoo.org/proj/udev-gentoo-scripts.git/tree/init.d/udev-trigger
start()
{
	if yesno ${rc_dev_root_symlink:-yes}; then
		ebegin "Generating a rule to create a /dev/root symlink"
		dev_root_link
		eend $?
	fi

	get_bootparam "nocoldplug" && rc_coldplug="no"
	if ! yesno ${rc_coldplug:-${RC_COLDPLUG:-yes}}; then
		einfo "Setting /dev permissions and symbolic links"
		udevadm trigger --attr-match=dev --action=add
		udevadm trigger --subsystem-match=net --action=add
		rc=$?
		ewarn "Skipping udev coldplug sequence"
		return $rc
	fi

	ebegin "Populating /dev with existing devices through uevents"
	udevadm trigger --type=subsystems --action=add
	udevadm trigger --type=devices --action=add
	eend $?
}

udevadm trigger --attr-match=dev --action=add;udevadm trigger --subsystem-match=net --action=add yes, this is needed on eudev, either.

@troglobit
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mention in #49, I have no way of testing with eudev at the moment, so you're on your own with this one for the time being. Your patches to eudev do look good to me though.

Please sign in to comment.