powernap parses /proc/interrupts incorrectly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
powernap |
Confirmed
|
Undecided
|
Dustin Kirkland |
Bug Description
Running powernap 2.21-0ubuntu-1 on Ubuntu-15.10. Kernel 4.2.0-10
Powernap tries to parse /proc/interrupts to discover IRQs for the keyboard and mouse. However, the format of this file seems to have changed in recent kernels, and this causes the following error and backtrace in /var/log/
Traceback (most recent call last):
File "/usr/sbin/
MONITORS = powernap.
File "/usr/lib/
p = ConsoleMonitor.
File "/usr/lib/
self._time, self._irqs = get_console_
File "/usr/lib/
irqs = get_interrupts()
File "/usr/lib/
interrupts += int(i)
ValueError: invalid literal for int() with base 10: 'IR-IO-APIC'
On another machine, running linux 3.13, lines in /proc/interrupts looks like this:
CPU0 CPU1
0: 251660783 0 IO-APIC-edge timer
8: 1 0 IO-APIC-edge rtc0
9: 3 0 IO-APIC-fasteoi acpi
On 4.2 (and maybe earlier?), there is another column on the right hand side, e.g.
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
0: 16 0 0 0 0 0 0 0 IR-IO-APIC 2-edge timer
1: 2 0 0 0 0 0 0 0 IR-IO-APIC 1-edge i8042
get_interrupts() in /usr/lib/
A simple fix would be:
--- /tmp/ConsoleMon
+++ /usr/lib/
@@ -38,6 +38,7 @@
if source == "i8042" or source == "keyboard" or source == "mouse":
+ items.pop()
for i in items:
f.close()
Of course, this isn't a great fix since it won't work properly on older kernels. Perhaps something like this instead:
--- /tmp/ConsoleMon
+++ /usr/lib/
@@ -39,7 +39,10 @@
for i in items:
- interrupts += int(i)
+ try:
+ interrupts += int(i)
+ except:
+ pass
f.close()
return interrupts
Both seem to work on my system. However, I hardly know any python, so there's probably a much nicer way to fix this.
Changed in powernap: | |
status: | New → Confirmed |
assignee: | nobody → Dustin Kirkland (kirkland) |
I'd guess this bug is affecting a lot more people than are represented here. Powernap is effectively broken in 15.10, it seems.