-
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
Open
rpardini
wants to merge
1
commit into
tinkerbell:main
Choose a base branch
from
rpardini:udev-onboot-and-service
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,22 +37,13 @@ onboot: | |
- name: sysfs | ||
image: linuxkit/sysfs:v1.0.0 | ||
|
||
- name: modprobe | ||
image: linuxkit/modprobe:v1.0.0 | ||
command: [ "modprobe", "cdc_ncm" ] # for usb ethernet dongles | ||
|
||
- name: udev | ||
- name: udev-once | ||
image: "${HOOK_CONTAINER_UDEV_IMAGE}" | ||
capabilities: | ||
- all | ||
binds: | ||
- /dev:/dev | ||
- /sys:/sys | ||
- /lib/modules:/lib/modules | ||
command: [ "/usr/bin/bash", "/one-shot.sh" ] | ||
capabilities: [ all ] | ||
binds: [ /dev:/dev, /sys:/sys, /lib/modules:/lib/modules ] | ||
rootfsPropagation: shared | ||
devices: | ||
- path: all | ||
type: b | ||
devices: [ { path: all, type: b }, { path: all, type: c } ] | ||
|
||
- name: dhcpcd-once | ||
image: linuxkit/dhcpcd:v1.0.0 | ||
|
@@ -77,6 +68,14 @@ services: | |
- name: ntpd | ||
image: linuxkit/openntpd:v1.0.0 | ||
|
||
- 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 } ] | ||
|
||
Comment on lines
+71
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can get away with just adding this, no? |
||
- name: getty | ||
image: linuxkit/getty:v1.0.0 | ||
capabilities: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?