-
Notifications
You must be signed in to change notification settings - Fork 37
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
run_once: execute /boot/run_once when booting #40
Closed
Closed
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 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,18 @@ | ||
# This unit is heavily inspired by Ned McClain's ideas found in https://github.com/nmcclain/raspberian-firstboot | ||
[Unit] | ||
Description=run_once initialization | ||
After=network.target | ||
Before=rc-local.service | ||
|
||
ConditionFileNotEmpty=/boot/run_once | ||
ConditionFileIsExecutable=/boot/run_once | ||
ConditionPathIsReadWrite=/boot | ||
|
||
[Service] | ||
ExecStart=/boot/run_once | ||
ExecStartPost=/bin/mv /boot/run_once /boot/run_once.${INVOCATION_ID} | ||
Type=oneshot | ||
RemainAfterExit=no | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains 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
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.
per nmcclain/raspberian-firstboot#13 ...
Update
After=network.target
to includeapt-daily.service
andapt-daily-upgrade.service
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.
Seems reasonable
How does this behave on a system without network connectivity?
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.
EDIT: Lol, now I see the comment was more about the unattended upgrade services 😄. I wonder if they have any effect since those services are not "enabled" to be started by systemd at boot, but they are started by their respective systemd timers. As such, AFAIK they cannot be used for boot ordering at all, but I have not tested it.
network.target
is a passive unit, hence it has no meaning unless a network stack/provider gives it one (sorts itselfBefore=network.target
). In case of Raspbian/Debian (Raspberry Pi OS), this is most of all thenetworking.service
from theifupdown
package, which brings up the loopback interface and other manually configuredauto <iface>
interfaces. Theoretically it's as well theifup@<iface>.service
's, which are created forallow-hotplug <iface>
interfaces, but since this unit is ofType=simple
, they don't need to finish but only need to start (hence do not delay the target to be reached, even if e.g. DHCP or wpa_supplicant hangs or fails).dhcpcd
does NOT have any effect on this target, which is strange and somehow a problem since Raspberry Pi OS uses it for network configuration by default 🤔.So if no network is configured, the target is reached once the loopback interface is available. If a network is configured, it depends on the network stack, but the way Raspberry Pi OS is configured, no additional delay happens.
Btw,
network.target
is not intended to indicate that the device is online. For this,network-online.target
is intended. Since it is an active target, it needs to be pulled it:But currently (with the current network stacks) it has not the intended meaning but is reached simply immediately after
network.target
.More info: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/