Skip to content

Start PhotonVision after network.target is reached#114

Merged
crschardt merged 1 commit intoPhotonVision:mainfrom
crschardt:start-after-network.target
Dec 18, 2025
Merged

Start PhotonVision after network.target is reached#114
crschardt merged 1 commit intoPhotonVision:mainfrom
crschardt:start-after-network.target

Conversation

@crschardt
Copy link
Contributor

@crschardt crschardt commented Dec 17, 2025

PV tries to access networking information fairly early in the startup process and, when NetworkManager isn't ready, PV cannot get the information it needs about the network hardware.

This PR configures the photonvision service to start after NetworkManager is running. The change is only made when PV is configured to manage networking.

This should reduce the need for PhotonVision/photonvision#2240, but it's safer to have both.

@crschardt crschardt merged commit 46e20d5 into PhotonVision:main Dec 18, 2025
16 checks passed
@crschardt crschardt deleted the start-after-network.target branch December 18, 2025 04:15
crschardt added a commit to PhotonVision/photonvision that referenced this pull request Dec 20, 2025
## Description

On the RubikPi3, PhotonVision starts before NetworkManager has fully
initialized. This causes it to fail to identify the network interfaces
available on the board, which leads to problems with configuring and
controling networking from the UI. The failure can be detected by the
call to `nmcli` returning an [exit status of
8](https://networkmanager.dev/docs/api/latest/nmcli.html#exit_status),
which means "NetworkManager is not running."

This PR retries the call to nmcli every 0.5 seconds until the exit
status does not equal 8, or a maximum of 10 attempts have been made. The
retry only occurs the first time `getAllInterfaces()` is called.
Subsequent calls to this method will only make one attempt to avoid
locking up the program if networking isn't responding as expected.

In my testing on the RubikPi3, the code has to retry for less than 2
seconds in order to get a valid response from NetworkManager.

The need for this is greatly reduced by
PhotonVision/photon-image-modifier#114, but this
code adds an additional layer of robustness against slow network
startup.

Closes #2212

## Meta

Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2025.3.2
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added

---------

Co-authored-by: samfreund <samf.236@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants