-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for the temporary udev before finit exited it #96
Comments
Sorry for the late reply, but I didn't find the time to look into this in detail during the weekend. Only did a quick test on a Debian system, which looked OK. But it didn't have have pulseaudio ... However, the above diff should not have any huge impact, except for If I understand it correctly, udevd not only creates the files in I'll try to investigate more later today. |
@troglobit OK, i removed the patch, trying to give a try, and it magically works now. If it's the case said by you(run is sync), then maybe i should check my laptop hardware. They may break down :(, like poor contact or so. Really sorry for bothering you, i'll take some more time on testing. Hope my reply is not too late :), i'll reopen the issue if i found a more reliable evidence on this issue. |
No problem, at all! :-) This just prompted my doing some more testing on Debian, and as a result I found some other bugs. So all in all just a good thing, really! |
https://unix.stackexchange.com/questions/39370/how-to-reload-udev-rules-without-reboot I think this is what happened, i might have done sth when i removed the patch, so i got the sound by accident. Now i went silence again, i rebooted four times, both alsa,pulse did not work. And all worked after The simplest solution i can come up with is running trigger after service started, does it sound possible? EDIT: due to the complex combinations of different hardware cases, this may not be reproduced properly. But i can prove drivers are ok:
while no cards for pulse:
and no sounds with mpg123 and firefox, except i ran EDIT2: when i hot reboot my laptop, sound may appear without manually triggering it. But when i reboot -p, wait until poweroff, and start again, always no sounds. That's probably why i got sound by change these days. |
Aha, I see so issuing a |
@troglobit not enough, before udevadm exits, that's what finit is doing now. Based on the information i collected, udevd wont add devices automatically if it's not a new pluged-in device. New udevd should always try to And of course, the best solution should be early starting udevd to prevent from plugging new devices(anyway, it's possible) just in the middle of restarting udevd. Maybe consider reordering the bootstrap. Like, remount fs/fstab after signal set up, then manually start udevd service(with cmd and its id) just before starting all other services. Since finit itself could execute normally even without much devices in /dev, we dont need to be so hurry about mdev/udev after all. Btw, systemd is mounting first, udevd second. |
You're right, I must look into this in detail, and possibly even reorder parts of the bootstrap a bit, to fix this. To start with, I really need to find a way to reproduce your issues reliably. I've tried only Debian thus far, with no sound issues. I'll try Alpine later today, or tomorrow, and if that doesn't help I guess I'll have to give https://github.com/xhebox/noname-linux a try :) Thank you so much for investigating this, I hope I can have a fix for you soon! |
@troglobit better alpine, my distro is not so actively maintained now as i am busy with studying. The only detail we do not know is that why hot reboot does not need to retrigger? But it's difficult to figure out that, because we do not even know where the code is. Whatever, i think early start is a good solution. Even you cant reproduce the issue, it can be sold as an improvement, because there's a risk of missing devices plugged when there's no udevd or udev service. udev really should not be restarted once other applications start to run, also should be started before all other applications(except finit itselt). |
@troglobit have you tested it? I am not here to urge you. I just come up with an idea. I think finit could add a new function that could move the later registered udevd service(service in config is registered first) to the top of list. Same as the other two commands(maybe registered as two 'run'). Or simply a flag of service_register() that registered service to the top of list. Then we dont need to reorder or break the service system. Also, it will be cool if multi commands service is supported. Then we dont need two tasks, too. :) EDIT: maybe we could simply leave the udev/mdev into the config file, completely seeing it as an normal service. EDIT2: I have 9 days off, i can look at it much deeper. Hope we could solve it as early as possible. |
@xhebox Hi! Unfortunately I've been incredibly busy with other things the last couple of weeks 😞 Your proposal is interesting. Please look into it if you can, then we can discuss it in more detail. I know we need mdev run early, to trigger FPGA and other firmware load sequences that in turn cause other drivers to be loaded. But the udev mess I think need to be sorted out in some other fashion. Meanwhile I'll try to get back to setting up Alpine with udev to see if I can reproduce the problem. EDIT: By "we" I mean the company that I work for, which sponsors a lot of the work on Finit :) |
Status update: I've had no luck trying to run pulseaudio on Alpine Linux, mostly because it's not included (yet) in the main archives, even on testing/edge. However, I've tested Debian (Buster) extensively and experienced no problems with udev + pulseaudio. From what I can gather, pulseaudio is not started as s system service but rather a per-session user service, usually when starting X, e.g. via gnome-session or when an application like firefox starts up to play sound and is linked with the pulseaudio library. Sorry I cannot be of more help. |
@troglobit It's ok. :) Thanks. I'll handle this. |
@troglobit I am busy too..
It's working if i made another flag there. This hot-patch makes sense. And here's my conclusion.
|
@troglobit Another solution:
Update:
|
Great analysis, having certain prioritized services start before everything else is potentially a great idea to solve issues like this! I'll have a look in detail tomorrow, but |
For [S12345], finit works, but somehow runs RUN&TASK first and second. It printed like this:
Looks like daemon somehow did not start in the runlevel [S]... By the way, my runlevel is two. |
|
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
@troglobit If you say, udevd is started in the [S] level, then the problem is why task is started ahead of the daemon... |
Just pushed a fix for
I'll get right back to this later today! |
@troglobit something like this worked, but it's a quite slow starting. After "Device event...", it took a long time before the next line "trigger". Any idea?
|
@xhebox Yes, exactly like that. Good work! The reason it takes a while for it to start the triggers is possibly because there is a lot to do at boot and the conditions does not start the runtasks until we enter the Finit event loop ... that one could be a bit trickier to solve. I'll give it some thought, maybe we can make an explicit call to run the state machine an extra time before entering the event loop. |
Spent a couple of hours tonight (CET) trying to reproduce the issue you see in my Debian setup.
I will continue debugging for another hour, and continue tomorrow evening. |
We must wait for udevd to be started before we call udevadm. However, udevd doesn't create a PID file, so we must also fake this. There is still a slight risk of a race condition: udevd not having properly started before udevadm tries to connect, but it works OK in Debian. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
All service/task commands are tracked by the state machine, but run commands are a bit special since they must run in sequence. Hence, we must increment their 'once' counter in service_start() instead. This should fix the issue mentioned in #96 "took a long time before the next line" -- because Finit was waiting for udevadm to reach a once count > 0, which we didn't increment. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Yes, I think I've found it! 😃
With 2. in place the boot is really quick on my little Debian system. Makes me wonder if we should consider re-introducing the (Off to get some sleep ...) |
@troglobit I'd say no. While it makes udevd completely and safely loaded, it may takes a long time. This is a problem complained by too many systemd users, and now it's disabled by default in some distros. I think we'd better leave users free, hardcode is not a good idea. If you really want to reintroduce it, i think you can make it a option in finit.conf. EDIT: patch tested |
Agreed. Better leave it as-is. Did the patch work for you too? |
@troglobit working |
@xhebox That's great news! 😃👍 Sorry for taking so long to resolve this. Is there anything else you feel we should do before closing this issue? |
@troglobit It's ok. And no, let me close the issue. |
my sound card did not work after i updated to 3.1-rc2.
In short, it's a bug of 00fe371. Finit exited the temporary udevd after setting up the devices tree, this is fine. But the point is, finit exited udevd before all his work were done. You need to use settle to wait. In detail, his work is not limited to /dev, also /run/udev. There're lots of files to generate, If i am correct, temporary udevd exited before all files were generated.
My hot-fix patch is more easier to understand, just a proof of concept. Since there has been lots of new changes in code base, i am not sure if the code is suitable or not. I'd like to leave the work to you :).
EDIT: actually, it's pulseaudio that did not work
The text was updated successfully, but these errors were encountered: