-
Notifications
You must be signed in to change notification settings - Fork 57
udev: run both as onboot and as service; drop hardcoded modprobe #270
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
base: main
Are you sure you want to change the base?
Conversation
- udev onboot is required so all devices are setup before the rest runs - hackish 'one-shot.sh' starts udev, waits until its done, then kills it - udev service is required so changes to devices (eg partition changes) take actual effect at runtime - systemd's udev should correctly modprobe all devices, thus remove the hardcoded modprobe call for cdc_ncm Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
There is a probably much better way of doing the onboot -- here for reference and someone smarter than me to fix further. |
#!/usr/bin/bash | ||
|
||
# Here we start the systemd-udev daemon, sleep a bit, run udevadm settle, and then stop the daemon, all using bash. | ||
# This is a one-shot script that is run by LinuxKit when the system boots up. | ||
|
||
echo "$(date) Starting systemd-udev in the background..." | ||
/lib/systemd/systemd-udevd "${@}" & | ||
declare udev_pid=$! | ||
echo "$(date) systemd-udev started with PID: ${udev_pid}" | ||
|
||
echo "$(date) Sleeping for 2 seconds so systemd-udev does its job..." | ||
sleep 2 | ||
|
||
echo "$(date) Running udevadm trigger..." | ||
udevadm trigger --action=add | ||
|
||
echo "$(date) Running udevadm settle..." | ||
udevadm settle | ||
|
||
echo "$(date) Status of /dev/disk/by-id:" | ||
ls -la /dev/disk/by-id/* || true | ||
|
||
echo "$(date) Stopping systemd-udev with PID: ${udev_pid}" | ||
kill -SIGTERM "${udev_pid}" | ||
|
||
echo "$(date) Waiting for systemd-udev to stop..." | ||
wait | ||
|
||
echo "$(date) systemd-udev stopped with PID: ${udev_pid}" | ||
echo "$(date) One-shot script completed." | ||
|
||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rpardini , how does this differ from the existing udev onboot container? I think they both do the same thing, no?
- name: udev # as a service; so system reacts to changes in devices | ||
image: "${HOOK_CONTAINER_UDEV_IMAGE}" | ||
command: [ "/lib/systemd/systemd-udevd", "--debug" ] | ||
capabilities: [ all ] | ||
binds: [ /dev:/dev, /sys:/sys, /lib/modules:/lib/modules ] | ||
rootfsPropagation: shared | ||
devices: [ { path: all, type: b }, { path: all, type: c } ] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get away with just adding this.
udev: run both as onboot and as service; drop hardcoded modprobe
take actual effect at runtime
hardcoded modprobe call for cdc_ncm
Signed-off-by: Ricardo Pardini ricardo@pardini.net