0

I've been unable to get Powernap to work in Ubuntu 18.04. I've stopped and started it several times with systemctl stop powernap and systemctl start powernap Following is the output of systemctl status powernap:

powernap.service - PowerNap
   Loaded: loaded (/lib/systemd/system/powernap.service; disabled; vendor preset: enabled)
   Active: active (exited) since Sun 2019-02-03 08:30:54 CST; 53min ago
  Process: 2318 ExecStart=/usr/sbin/powernapd (code=exited, status=0/SUCCESS)
  Process: 2313 ExecStartPre=/usr/share/powernap/powernap-ethtool (code=exited, status=0/SUCCESS)
 Main PID: 2319 (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/powernap.service
           └─2320 /usr/bin/python /usr/sbin/powernapd

I don't know what is causing the active(exited) status. I think that should be active(running).

The powernap daemon appears to be running as per the following:

root@Dennis:~# ps  -e|grep powernapd
 2320 ?        00:00:00 powernapd

Here is the powernap.err log. There is an error. Can someone tell me what it means?

Traceback (most recent call last):
  File "/usr/sbin/powernapd", line 342, in <module>
    MONITORS = powernap.get_monitors()
  File "/usr/lib/python2.7/dist-packages/powernap/powernap.py", line 183, in get_monitors
    p = ConsoleMonitor.ConsoleMonitor(config)
  File "/usr/lib/python2.7/dist-packages/powernap/monitors/ConsoleMonitor.py", line 53, in __init__
    self._time, self._irqs = get_console_activity()
  File "/usr/lib/python2.7/dist-packages/powernap/monitors/ConsoleMonitor.py", line 28, in get_console_activity
    irqs = get_interrupts()
  File "/usr/lib/python2.7/dist-packages/powernap/monitors/ConsoleMonitor.py", line 42, in get_interrupts
    interrupts += int(i)
ValueError: invalid literal for int() with base 10: 'IO-APIC'

Here is my powernap.services file. I've altered it to change "network" to "networking" and add the line "RemainAfterExit=yes" as per a previous bug report. Without this powernap fails to start.

[Unit]
Description=PowerNap
Requires=networking.service
After=networking.service

[Service]
Type=forking
ExecStartPre=/usr/share/powernap/powernap-ethtool
ExecStart=/usr/sbin/powernapd
ExecStop=-/usr/sbin/powerwake-now
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

I've tried a variety of settings in the config file with no luck. At present I have it set to suspend after 60 seconds looking only at [LoadMonitor] = 2. Here's the (long) file:

[powernap]
# This is the configuration file for PowerNap.
# See powernap(1) for more information.

# This file is Python syntax, and will be sourced by the powernap daemon
# on start. To enact changes to this configuration, restart the daemon.
# Example:
#   sudo service powernap restart

# The ACTION_METHOD variable determines what action to take.
# The possible actions are:
# 0 - powersave
# 1 - suspend
# 2 - hibernate
# 3 - poweroff
# 4 - best-effort
# The default mode of operation is powersave. This method will use the
# "pm-powersave" command and will execute hooks locate in "/etc/pm/power.d" and
# "/usr/lib/pm-utils/power.d".
# The best-effort method, witll first, it will try a user-defined script
# at "/etc/powernap/action", or suspend, hibernate, poweroff.
ACTION_METHOD = 1

# Number of seconds that all monitors must have no activity or must be absent.
# The default is an absence period of 30 seconds.
# Example:
#   ABSENT_SECONDS = 30
ABSENT_SECONDS = 60

# Grace period, after (ABSENT_SECONDS - GRACE_SECONDS) have elapsed with all of
# the Monitors with absent activity, the system will send a Wall message for an
# administrator to warn that the system will perform the "/usr/sbin/powernap"
# action in GRACE_SECONDS.
# The default grace period is 6 seconds.
# Example:
#   GRACE_SECONDS = 6
GRACE_SECONDS = 6

# The powernap daemon will wake every INTERVAL_SECONDS and check for activity
# to all of the monitors.  Lower values of INTERVAL_SECONDS will provide
# more detailed process monitoring but will consume more system resources.
# Higher values of INTERVAL_SECONDS will consume less system resources, but
# might miss activity that execute for less than INTERVAL_SECONDS.
# The minimum runtime of any monitor should not be less than INTERVAL_SECONDS.
# The default interval is 1 second.
# Example:
#   INTERVAL_SECONDS = 1
INTERVAL_SECONDS = 1

# The powernap daemon will issue a warning message to the console whenever it
# has entered into GRACE period. This warning message will warn the user that
# it is about to perform an ACTION.
# This warning message is done using the "wall" command, notifying all the
# users connected to a console.
# The default is set to 'yes' to WARN the user. It can be disabled by setting
# the option to 'n' or 'no', or can simply be commented.
# Example
#   WARN = y
#   WARN = n
WARN = y

# The powernap daemon logs errors to /var/log/powernap.err, and some basic
# information to /var/log/powernap.log.  To change the verbosity of this
# logging, set DEBUG to 0, 1, 2, or 3:
# The default debug level is 0.
#    DEBUG = 1
#    DEBUG = 2
DEBUG = 2

# The powernap daemon can watch for changes in the configuration file in
# /etc/powernap directory without having to restart it.
# The default value is n.
#    WATCH_CONFIG = y
#    WATCH_CONFIG = n
WATCH_CONFIG = n

# Kernel Modules that are to be disabled when running PowerNap on Powersave
# mode
#KERN_MODULES = btusb sco tfcomm bnep

# Network Services that are to be disabled when running PowerNap on
# PowerSave mode
#SERVICES = postgresql-8.4 apache2 ntp network-manager

############################################################################
####                        STAGE2 ACTION                               ####
############################################################################
#[powernap-stage2]
# Number of seconds that all monitors must have no activity or must be absent
# while running in PowerSave mode to perform the STAGE2_ACTION_METHOD.
# The default value is to be disabled by default. If you wish to enable the
# Second Stage Action method, set the STAGE2_ABSENT_SECONDS and ensure that
# STAGE2_ACTION_METHOD is set correctly.
# Example:
#   STAGE2_ABSENT_SECONDS = 500
#STAGE2_ABSENT_SECONDS = 0

# The STAGE2_ACTION_METHOD variable determines what action should be taken
# after a period on inactivity while under PowerSave Mode (See ACTION_METHOD
# above).
# The possible actions are:
# 1 - suspend
# 2 - hibernate
# 3 - poweroff
# 4 - best-effort
# The default mode of operation is best-effort. This method will try to
# user-defined script  at "/etc/powernap/action", or suspend, hibernate,
# or poweroff the machine.
#STAGE2_ACTION_METHOD = 4

############################################################################
####                          MONITORS                                  ####
############################################################################

# The [WoLMonitor] section lists all ports on which the WoL Monitor will be
# listening for WoL Packets for any of the network interfaces.
# Once a WoL Packet is received, the WoLMonitor will compare the data received
# with all the network interfaces (eth's) to determine wether it is destined
# for any of the network interfaces.
# The default is to monitor ports 7 and 9 for WoL data packets. It can also be
# set to any other port on which the machine is receiving WoL packets
# Example:
#  wol1052 = 1052
[WoLMonitor]
#wol7 = n
#wol9 = n

# The [ConsoleMonitor] section enables or disables  monitoring of activity
# in the Console (tty), also tracking activity from any locally connected
# mouse and keyboard (PS2 Only).
# The default is enabled, set to 'y'. It can be disabled by setting it to 'n'.
# Examples:
#  console = y
#  console = n
[ConsoleMonitor]
ptmx = n

# The [ProcessMonitor] section lists all the processes to Monitor by using
# regular expressions.
# Each item listed will be compared against the output of "ps -eo args".
# The default is to monitor /sbin/init, which should always be running.
# Examples:
#  mplayer = "mplayer "
#  sshd = "sshd: .*\[priv\]$"
#  kvm = "kvm "
[ProcessMonitor]
#init = "^/sbin/init"

# The [LoadMonitor] section defines the load threshold.  When the system load
# according to /proc/loadavg is above this value, then system will be deemed
# 'active' and will not powernap.  If the system is already powernapping, then
# the system will awake out of the powernap mode if the load raises above the
# threshold.
# If the threshold is set to "n" (which is default), threshold is automatically
# calculated to be the number of online processors, as determined by:
#   getconf _NPROCESSORS_ONLN
# Example:
#   threshold = 1.5
#   threshold = 9999
#   threshold = 0
#   threshold = n
[LoadMonitor]
threshold = 2

# The [TCPMonitor] section lists all the TCP ports on which to watch for
# established connections using netstat(8). It supports both, single TCP
# as well as port ranges.
# There is no default TCP Monitor.
# Examples:
#  ssh = 22
#  http = 80
#  https = 443
#  other = 64500-65000
[TCPMonitor]
#ssh = 22

# The [UDPMonitor] section lists all the UDP ports on which to listen
# for data.
# Each item listed will BIND a UDP port and listen to any data. Keep
# in mind that this port will be bined and no other application will
# be able to use this port.
# There is no default UDP Monitor.
# Examples:
#  udp-1 = 1025
#  udp-2 = 2048
[UDPMonitor]
#udp-1025 = 1025

# The [IOMonitor] section lists all the processes to Monitor for IO
# activity. A regular expressions is used to find the processes PIDs, which
# are later used to monitor IO.
# There is no default IO Monitor.
# Examples:
#  kvm-io = "kvm"
#  mysqld-io = "mysql"
[IOMonitor]
#kvm-io = "kvm"
#mysqld-io = "mysql"

# The [InputMonitor] section lists the USB Input devices for which to track
# events. Currently, only two types of devices are supported, mouse and keyboard.
# Both InputMonitor's are enabled by default. In the case there are no USB
# devices connected, PowerNap will ignore these settings.
# To disable, set them to "n" or "no", or simply comment them.
# Examples:
#  keyboard = n
#  keyboard = y
[InputMonitor]
keyboard = n
mouse = n

# The [DiskMonitor] section lists the disk devices for which to track
# standby/sleep status.  If any of the devices are active/idle the
# system will be deemed 'active' and will not powernap. Generally useful
# for monitoring data drives (e.g. NAS), but will not typically work to
# monitor the root drive. Note also that this plugin only reacts to the
# state of the drive and does not modify the behavior of the drive
# directly. Therefore it only makes sense to monitor a drive that has
# already been configured to standby or sleep.
# To disable checking specific drives, set them to "n" or "no",
# or simply comment them.
# Examples:
#  sda = y
#  sdb = n
[DiskMonitor]
#sda = y

1 Answer 1

0

Seems there are some bugs in Powernap, but you can try the fix suggested here: https://ubuntuforums.org/showthread.php?t=2304588

Another option seems to be to disable the ConsoleMonitor (e.g. if it's a headless server) as suggested here: https://bugs.launchpad.net/powernap/+bug/1497782

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .