Skip to content

Simplify networking#6

Merged
spurnvoj merged 10 commits into
ros2from
simplify_networking
Jun 1, 2026
Merged

Simplify networking#6
spurnvoj merged 10 commits into
ros2from
simplify_networking

Conversation

@vidvidex
Copy link
Copy Markdown
Collaborator

Simplifies network configuration by removing the "Disable NetworkManager" step, which is now integrated directly into the netplan configuration step.

The PR also fixes some bugs when configuring IPs and only eth or only wifi interface is available

vidvidex added 2 commits May 29, 2026 14:21
…aces

Before it would always append
    ethernets:
or
    wifis:
to the config file, even if there are such interfaces found, resulting in a syntax error when applying
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR streamlines device network setup by removing the standalone “Disable NetworkManager” step and integrating NetworkManager disablement directly into the netplan configuration flow, while also improving behavior when only Ethernet or only Wi‑Fi interfaces are present.

Changes:

  • Removed the dedicated “Disable NetworkManager” script and folded its responsibilities into the netplan configuration step.
  • Updated the networking configuration script to generate netplan YAML with conditional ethernets:/wifis: sections and to enable systemd-networkd before applying.
  • Updated the “Reenable NetworkManager” script to unmask/enable NetworkManager services and apply a NetworkManager-rendered netplan.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
subscripts/4Network/2Configure_networking.sh Integrates NetworkManager disablement into netplan apply and improves interface-specific netplan generation.
subscripts/4Network/3Reenable_network_manager.sh Adjusts service toggling and applies a NetworkManager netplan renderer.
subscripts/4Network/3Disable_network_manager_(do_on_UAVs).sh Removed to simplify workflow (step now integrated elsewhere).
Comments suppressed due to low confidence (21)

subscripts/4Network/2Configure_networking.sh:149

  • if [ $1 = "f4f" ] will error with "unary operator expected" when the script is run without a first argument (common when invoked from a menu). Quote $1 (or use [[ ... ]]) in these comparisons so empty args are handled safely.
    subscripts/4Network/2Configure_networking.sh:157
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the gateway prompt selection robust.
    subscripts/4Network/2Configure_networking.sh:167
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the SSID default selection robust.
    subscripts/4Network/2Configure_networking.sh:92
  • rm $FILENAME will print an error when the temp file doesn't exist (first run) and can also behave unexpectedly if $FILENAME ever contains whitespace. Prefer rm -f -- "$FILENAME" to make this idempotent and safe.
    subscripts/4Network/3Reenable_network_manager.sh:14
  • Masking and disabling systemd-resolved when re-enabling NetworkManager can break DNS resolution on Ubuntu (NetworkManager commonly integrates with systemd-resolved). It's safer to only disable/mask systemd-networkd, and ensure systemd-resolved is unmasked/enabled.
    subscripts/4Network/2Configure_networking.sh:149
  • if [ $1 = "f4f" ] will error with "unary operator expected" when the script is run without a first argument (common when invoked from a menu). Quote $1 (or use [[ ... ]]) in these comparisons so empty args are handled safely.
    subscripts/4Network/2Configure_networking.sh:157
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the gateway prompt selection robust.
    subscripts/4Network/2Configure_networking.sh:167
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the SSID default selection robust.
    subscripts/4Network/2Configure_networking.sh:92
  • rm $FILENAME will print an error when the temp file doesn't exist (first run) and can also behave unexpectedly if $FILENAME ever contains whitespace. Prefer rm -f -- "$FILENAME" to make this idempotent and safe.
    subscripts/4Network/3Reenable_network_manager.sh:14
  • Masking and disabling systemd-resolved when re-enabling NetworkManager can break DNS resolution on Ubuntu (NetworkManager commonly integrates with systemd-resolved). It's safer to only disable/mask systemd-networkd, and ensure systemd-resolved is unmasked/enabled.
    subscripts/4Network/2Configure_networking.sh:149
  • if [ $1 = "f4f" ] will error with "unary operator expected" when the script is run without a first argument (common when invoked from a menu). Quote $1 (or use [[ ... ]]) in these comparisons so empty args are handled safely.
    subscripts/4Network/2Configure_networking.sh:157
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the gateway prompt selection robust.
    subscripts/4Network/2Configure_networking.sh:167
  • Same issue as above: unquoted $1 in a [ test can error when $1 is empty. Quote $1 (or use [[ ... ]]) to keep the SSID default selection robust.
    subscripts/4Network/2Configure_networking.sh:92
  • rm $FILENAME will print an error when the temp file doesn't exist (first run) and can also behave unexpectedly if $FILENAME ever contains whitespace. Prefer rm -f -- "$FILENAME" to make this idempotent and safe.
    subscripts/4Network/3Reenable_network_manager.sh:14
  • Masking and disabling systemd-resolved when re-enabling NetworkManager can break DNS resolution on Ubuntu (NetworkManager commonly integrates with systemd-resolved). It's safer to only disable/mask systemd-networkd, and ensure systemd-resolved is unmasked/enabled.
    subscripts/4Network/2Configure_networking.sh:86
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.
    subscripts/4Network/3Reenable_network_manager.sh:16
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.
    subscripts/4Network/2Configure_networking.sh:86
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.
    subscripts/4Network/3Reenable_network_manager.sh:16
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.
    subscripts/4Network/2Configure_networking.sh:86
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.
    subscripts/4Network/3Reenable_network_manager.sh:16
  • sudo rm /etc/netplan/* will error when the directory is empty and can also delete non-YAML files if present. Prefer removing only *.yaml with -f and silencing the empty-dir case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vidvidex
Copy link
Copy Markdown
Collaborator Author

vidvidex commented Jun 1, 2026

Implemented some of the copilot suggestions and tested. Should work ok and can be merged

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

subscripts/4Network/3Reenable_network_manager.sh:26

  • The temporary netplan file is written using unquoted $FILENAME and copied without quoting. Quoting the path and redirects avoids word-splitting/globbing and is safer if the location ever changes.

Comment thread subscripts/4Network/2Configure_networking.sh Outdated
Comment thread subscripts/4Network/2Configure_networking.sh Outdated
Comment thread subscripts/4Network/2Configure_networking.sh Outdated
vidvidex and others added 3 commits June 1, 2026 11:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@spurnvoj spurnvoj self-requested a review June 1, 2026 18:37
@spurnvoj spurnvoj merged commit cbbbf39 into ros2 Jun 1, 2026
@spurnvoj spurnvoj deleted the simplify_networking branch June 1, 2026 18:38
vidvidex added a commit that referenced this pull request Jun 2, 2026
* Fix netplan config script to work when there is no eth or wlan interfaces

Before it would always append
    ethernets:
or
    wifis:
to the config file, even if there are such interfaces found, resulting in a syntax error when applying

* Disable network manager immediately when configuring networking

* Install netplan if not installed yet

* Copilot fixes

* Migrate to newer default gateway syntax

gateway4 is deprecated

* Reformat

* Add default gateway prompt for eth

* Ensure netplan config file has correct permissions

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Ask for DNS server on eth

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
spurnvoj pushed a commit that referenced this pull request Jun 2, 2026
* Reformat

* Check if git is already installed before installing

* feat: Simplify networking (#6)

* Fix netplan config script to work when there is no eth or wlan interfaces

Before it would always append
    ethernets:
or
    wifis:
to the config file, even if there are such interfaces found, resulting in a syntax error when applying

* Disable network manager immediately when configuring networking

* Install netplan if not installed yet

* Copilot fixes

* Migrate to newer default gateway syntax

gateway4 is deprecated

* Reformat

* Add default gateway prompt for eth

* Ensure netplan config file has correct permissions

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Ask for DNS server on eth

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* feat: Add script to clean home directory (#10)

As written in the wiki. The script only deletes empty directories (to prevent accidentally deleting important files)

* Use just one main entry script

* Do not run apt update if it was already ran recently

* Cleanup README.md

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants