From 9064cc6a1cb29f450504d38328c528b57474d7de Mon Sep 17 00:00:00 2001 From: Vid Smole Date: Fri, 19 Jun 2026 10:22:00 +0200 Subject: [PATCH 1/2] Add a script to disable power saving on wlan0 network interface --- setup_utility.sh | 2 ++ .../3Disable_WiFi_power_saving.sh | 22 +++++++++++++++++++ ..._SSH_config.sh => 4Generate_SSH_config.sh} | 0 ...t_Swap_to_16GB.sh => 5Set_Swap_to_16GB.sh} | 0 ...irectory.sh => 6Cleanup_home_directory.sh} | 0 .../disable-wlan0-power_saving.service | 10 +++++++++ 6 files changed, 34 insertions(+) create mode 100755 subscripts/3PostInstall/3Disable_WiFi_power_saving.sh rename subscripts/3PostInstall/{3Generate_SSH_config.sh => 4Generate_SSH_config.sh} (100%) rename subscripts/3PostInstall/{4Set_Swap_to_16GB.sh => 5Set_Swap_to_16GB.sh} (100%) rename subscripts/3PostInstall/{5Cleanup_home_directory.sh => 6Cleanup_home_directory.sh} (100%) create mode 100644 subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service diff --git a/setup_utility.sh b/setup_utility.sh index 5e6bd3c..ad9e5cd 100755 --- a/setup_utility.sh +++ b/setup_utility.sh @@ -92,6 +92,8 @@ if [ -z "$1" ]; then sudo chmod -R +x "$DIR/subscripts" sudo chmod -R -x "$DIR/subscripts/5Udev_rules/DISREGARD_udev_rules" sudo chmod +x "$DIR/subscripts/5Udev_rules/DISREGARD_udev_rules" + sudo chmod -R -x "$DIR/subscripts/3PostInstall/DISREGARD" + sudo chmod +x "$DIR/subscripts/3PostInstall/DISREGARD" else folder_path="$1" first_run=false diff --git a/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh b/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh new file mode 100755 index 0000000..7bc4806 --- /dev/null +++ b/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check if an interface "wlan0" exists, if it doesn't the computer either doesn't have a WiFi card or "Predictable Network Interface Names" feature is enabled, meaning +# the user hasn't ran the "Fix network interface names" script yet. + +if ! ip link show wlan0 &> /dev/null; then + echo "No wlan0 interface found. You probably forgot to run the 'Fix network interface names' script first." + exit 0 +fi + +echo "Disabling power saving mode on wlan0 interface" + +# Disable power saving mode on wlan0 interface. +sudo iw wlan0 set power_save off + +# The setting does not persist across reboots, so we also create a systemd service to disable it on boot. +sudo cp subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service /etc/systemd/system/disable-wlan0-power_saving.service +sudo systemctl daemon-reload +sudo systemctl enable --now disable-wlan0-power_saving.service + +echo "Power saving mode on wlan0 interface disabled" +exit 0 diff --git a/subscripts/3PostInstall/3Generate_SSH_config.sh b/subscripts/3PostInstall/4Generate_SSH_config.sh similarity index 100% rename from subscripts/3PostInstall/3Generate_SSH_config.sh rename to subscripts/3PostInstall/4Generate_SSH_config.sh diff --git a/subscripts/3PostInstall/4Set_Swap_to_16GB.sh b/subscripts/3PostInstall/5Set_Swap_to_16GB.sh similarity index 100% rename from subscripts/3PostInstall/4Set_Swap_to_16GB.sh rename to subscripts/3PostInstall/5Set_Swap_to_16GB.sh diff --git a/subscripts/3PostInstall/5Cleanup_home_directory.sh b/subscripts/3PostInstall/6Cleanup_home_directory.sh similarity index 100% rename from subscripts/3PostInstall/5Cleanup_home_directory.sh rename to subscripts/3PostInstall/6Cleanup_home_directory.sh diff --git a/subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service b/subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service new file mode 100644 index 0000000..f29ea08 --- /dev/null +++ b/subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service @@ -0,0 +1,10 @@ +[Unit] +Description=Disable powersaving mode for the wlan0 interface +After=network.target + +[Service] +Type=oneshot +ExecStart=/usr/sbin/iw wlan0 set power_save off + +[Install] +WantedBy=multi-user.target \ No newline at end of file From 35fb652f65dbf6f27482773eeb5ada27d96e91ca Mon Sep 17 00:00:00 2001 From: Vid Smole Date: Tue, 23 Jun 2026 12:06:17 +0200 Subject: [PATCH 2/2] Expand setting power mode --- .../3PostInstall/2Disable_hibernation.sh | 5 -- .../3PostInstall/2Disable_power_saving.sh | 60 +++++++++++++++++++ .../3Disable_WiFi_power_saving.sh | 22 ------- ..._SSH_config.sh => 3Generate_SSH_config.sh} | 0 ...t_Swap_to_16GB.sh => 4Set_Swap_to_16GB.sh} | 0 ...irectory.sh => 5Cleanup_home_directory.sh} | 0 6 files changed, 60 insertions(+), 27 deletions(-) delete mode 100755 subscripts/3PostInstall/2Disable_hibernation.sh create mode 100755 subscripts/3PostInstall/2Disable_power_saving.sh delete mode 100755 subscripts/3PostInstall/3Disable_WiFi_power_saving.sh rename subscripts/3PostInstall/{4Generate_SSH_config.sh => 3Generate_SSH_config.sh} (100%) rename subscripts/3PostInstall/{5Set_Swap_to_16GB.sh => 4Set_Swap_to_16GB.sh} (100%) rename subscripts/3PostInstall/{6Cleanup_home_directory.sh => 5Cleanup_home_directory.sh} (100%) diff --git a/subscripts/3PostInstall/2Disable_hibernation.sh b/subscripts/3PostInstall/2Disable_hibernation.sh deleted file mode 100755 index 6131950..0000000 --- a/subscripts/3PostInstall/2Disable_hibernation.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target -echo "Hibernation disabled" -exit 0 diff --git a/subscripts/3PostInstall/2Disable_power_saving.sh b/subscripts/3PostInstall/2Disable_power_saving.sh new file mode 100755 index 0000000..3cad5be --- /dev/null +++ b/subscripts/3PostInstall/2Disable_power_saving.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +function disable_hibernation() { + echo "Disabling hibernation" + sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + echo "Hibernation disabled" +} + +function disable_wlan0_power_saving() { + # Check if an interface "wlan0" exists, if it doesn't the computer either doesn't have a WiFi card or "Predictable Network Interface Names" feature is enabled, meaning + # the user hasn't ran the "Fix network interface names" script yet. + + if ! ip link show wlan0 &> /dev/null; then + echo "No wlan0 interface found. You probably forgot to run the 'Fix network interface names' script first." + else + echo "Disabling power saving mode on wlan0 interface" + + # Disable power saving mode on wlan0 interface. + sudo iw wlan0 set power_save off + + # The setting does not persist across reboots, so we also create a systemd service to disable it on boot. + sudo cp subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service /etc/systemd/system/disable-wlan0-power_saving.service + sudo systemctl daemon-reload + sudo systemctl enable --now disable-wlan0-power_saving.service + + echo "Power saving mode on wlan0 interface disabled" + fi +} + +function set_power_mode() { + + # Most times the power modes available are "performance", "balanced" and "power-saver", + # but sometimes some are missing (for example on Jetsons only power-saver" and "balanced" are available) + # For this reason we check which modes are available and set the highest one available. + if powerprofilesctl list | grep -q "performance"; then + echo "Setting power mode to performance" + sudo powerprofilesctl set performance + elif powerprofilesctl list | grep -q "balanced"; then + echo "Setting power mode to balanced" + sudo powerprofilesctl set balanced + else + echo "Power mode names on this system are unrecognized. Run 'powerprofilesctl list' to check which power modes are available and report this to the install script developer." + fi +} + +function set_jetson_power_mode() { + echo "Setting Jetson power mode to 25W. Reboot is required for the change to take effect." + sudo nvpmodel --mode 3 +} + +disable_hibernation +disable_wlan0_power_saving +set_power_mode + +# This should be last because it will ask for reboot, which will stop the script from running any further. +if grep -q "NVIDIA Jetson" /proc/device-tree/model > /dev/null 2>&1; then + set_jetson_power_mode +fi + +exit 0 diff --git a/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh b/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh deleted file mode 100755 index 7bc4806..0000000 --- a/subscripts/3PostInstall/3Disable_WiFi_power_saving.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Check if an interface "wlan0" exists, if it doesn't the computer either doesn't have a WiFi card or "Predictable Network Interface Names" feature is enabled, meaning -# the user hasn't ran the "Fix network interface names" script yet. - -if ! ip link show wlan0 &> /dev/null; then - echo "No wlan0 interface found. You probably forgot to run the 'Fix network interface names' script first." - exit 0 -fi - -echo "Disabling power saving mode on wlan0 interface" - -# Disable power saving mode on wlan0 interface. -sudo iw wlan0 set power_save off - -# The setting does not persist across reboots, so we also create a systemd service to disable it on boot. -sudo cp subscripts/3PostInstall/DISREGARD/disable-wlan0-power_saving.service /etc/systemd/system/disable-wlan0-power_saving.service -sudo systemctl daemon-reload -sudo systemctl enable --now disable-wlan0-power_saving.service - -echo "Power saving mode on wlan0 interface disabled" -exit 0 diff --git a/subscripts/3PostInstall/4Generate_SSH_config.sh b/subscripts/3PostInstall/3Generate_SSH_config.sh similarity index 100% rename from subscripts/3PostInstall/4Generate_SSH_config.sh rename to subscripts/3PostInstall/3Generate_SSH_config.sh diff --git a/subscripts/3PostInstall/5Set_Swap_to_16GB.sh b/subscripts/3PostInstall/4Set_Swap_to_16GB.sh similarity index 100% rename from subscripts/3PostInstall/5Set_Swap_to_16GB.sh rename to subscripts/3PostInstall/4Set_Swap_to_16GB.sh diff --git a/subscripts/3PostInstall/6Cleanup_home_directory.sh b/subscripts/3PostInstall/5Cleanup_home_directory.sh similarity index 100% rename from subscripts/3PostInstall/6Cleanup_home_directory.sh rename to subscripts/3PostInstall/5Cleanup_home_directory.sh