How to Disable All Power Management in Ubuntu Server (Headless Netbook Setup)


2 views

When running a headless Ubuntu server on low-power hardware like Asus eeePC netbooks, power management features designed for laptops can interfere with continuous operation. Here's what we need to address:

  • ACPI sleep states (suspend/hibernate)
  • CPU frequency scaling
  • Disk spindown (can be kept enabled if desired)
  • Network interface power saving
  • USB autosuspend

First, let's prevent the system from entering any sleep modes. Edit the logind configuration:

sudo nano /etc/systemd/logind.conf

Add or modify these lines:

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
IdleAction=ignore

Then restart the service:

sudo systemctl restart systemd-logind

To prevent WiFi disconnections, we need to disable power saving for the network interface. First identify your interface:

ip link show

Then create a persistent configuration (replace wlan0 with your interface):

sudo nano /etc/network/if-up.d/disable_powersave

Add this content:

#!/bin/sh
iwconfig wlan0 power off

Make it executable:

sudo chmod +x /etc/network/if-up.d/disable_powersave

For continuous USB modem operation, disable autosuspend globally or for specific devices. Create a new GRUB configuration:

sudo nano /etc/default/grub

Add this to GRUB_CMDLINE_LINUX_DEFAULT:

usbcore.autosuspend=-1

Update GRUB and reboot:

sudo update-grub
sudo reboot

While not strictly necessary for connectivity, you might want to prevent CPU throttling for consistent performance:

sudo apt install cpufrequtils
sudo nano /etc/default/cpufrequtils

Add this line:

GOVERNOR="performance"

Then start the service:

sudo systemctl enable cpufrequtils
sudo systemctl start cpufrequtils

After implementing these changes, verify everything is working as intended:

# Check sleep states
cat /sys/power/mem_sleep

# Check WiFi power management
iwconfig wlan0 | grep "Power Management"

# Check USB autosuspend
cat /sys/module/usbcore/parameters/autosuspend

# Check CPU governor
cpufreq-info

When administering a headless Ubuntu server on an Asus EeePC netbook (especially version 10.04), we need to ensure persistent uptime while maintaining critical subsystems:

  • Wi-Fi connectivity must never drop
  • USB subsystem should stay powered (for hardware modem operation)
  • Disk spindown is acceptable but other power states must be disabled

First, check current power management settings:

# View current sleep state capabilities
cat /sys/power/state

# Check active power scheme
upower -d

# Verify WiFi power management status
iwconfig wlan0 | grep -i "power"

Edit the GRUB configuration to prevent sleep/hibernate:

sudo nano /etc/default/grub
# Modify this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep"

# Then update GRUB:
sudo update-grub

Create a custom systemd unit to override power settings:

sudo nano /etc/systemd/system/power-lock.service
[Unit]
Description=Prevent Power Management
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c "echo 0 > /sys/module/snd_hda_intel/parameters/power_save"
ExecStart=/bin/bash -c "iw dev wlan0 set power_save off"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then enable with:

sudo systemctl enable --now power-lock.service

For continuous USB power (critical for modems):

sudo nano /etc/udev/rules.d/50-usb-power.rules
# Add these lines:
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="on"
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="on"

Reload udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

After implementing changes, verify all settings:

# Check active power states
cat /proc/acpi/wakeup

# Monitor suspend attempts
journalctl -f | grep -i "suspend\|hibernate"

# Real-time power status
powerstat -d 5

Create a cron job as secondary protection:

sudo crontab -e
# Add this line:
*/15 * * * * /sbin/iwconfig wlan0 power off && echo "on" > /sys/bus/usb/devices/usb1/power/control