Ubuntu – Unhandled kernel version error when trying to install laptop-mode-tools

11.10

Hi I'm getting this error after installing laptop-mode-tools in Oneiric Ocelot when its trying to run for the first time:

Unhandled kernel version: 3.0 ('uname -r' = 3.0.0-12-generic)

So my laptop-mode-tools is 1.57-1ubuntu1, and I saw in the launchpad that Ubuntu team is preparing 1.58-3ubuntu1 that contains support for kernel 3.0.

However, I don't find 1.58-3ubuntu1 in apt-cache showpkg laptop-mode-tools (only 1.57 is listed) so I can't upgrade my laptop-mode-tools.

I tried adding kernel PPA into my repository cache and apt-get update, and in apt-cache showpkg linux-headers only 3.0.0.12-generic is showing up. So I can't downgrade my kernel either.

I want laptop-mode-tools to work with Oneiric since I'm on laptop, what do you guys suggest me to do ? I'm an absolute beginner so please be easy on your answer. I can work with packages, but not with patching/compiling, etc.

Best Answer

  • As per the suggestion in this bug I added kernel version in laptop-mode-tools script. So you should add "3.0");; to the file /usr/sbin/laptop_mode about line 506 so it reads as follows:

    case "$KLEVEL" in
     "2.4" ) ;;
     "2.6" ) ;;
     "3.0" ) ;;
     *)
      log "ERR" "Unhandled kernel version: $KLEVEL ('uname -r' = '$(uname -r)')" >&2
      exit 1
      ;;
    

    If you want to avoid laptop-mode-tools completely you may add the following script in /etc/pm/power.d/ and name it powersave. It does something similar to laptop-mode. You may need to tweak the script according to you hardware.

    #!/bin/sh
    # A script to enable laptop power saving features for #! & Debian GNU+linux.
    # http://crunchbanglinux.org/forums/topic/11954
    
    # List of modules to unload, space seperated. Edit depending on your hardware and preferences.
    modlist="uvcvideo"
    # Bus list for runtime pm. Probably shouldn't touch this.
    buslist="pci spi i2c"
    
    case "$1" in
        true)
        # Enable some power saving settings while on battery
           # Enable laptop mode
            echo 5 > /proc/sys/vm/laptop_mode
           # Less VM disk activity. Suggested by powertop
            echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
           # Intel power saving
            echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
            echo 1 > /sys/module/snd_hda_intel/parameters/power_save
           # Set backlight brightness to 50%
            echo 3 > /sys/class/backlight/acpi_video0/brightness
           # USB powersaving
            for i in /sys/bus/usb/devices/*/power/autosuspend; do
                echo 1 > $i
            done
           # SATA power saving
            for i in /sys/class/scsi_host/host*/link_power_management_policy; do
                echo min_power > $i
            done
           # Disable hardware modules to save power
            for mod in $modlist; do
                grep $mod /proc/modules >/dev/null || continue
                modprobe -r $mod 2>/dev/null
            done
           # Enable runtime power management. Suggested by powertop.
            for bus in $buslist; do
                for i in /sys/bus/$bus/devices/*/power/control; do
                    echo auto > $i
                done
            done
        ;;
        false)
           #Return settings to default on AC power
            echo 0 > /proc/sys/vm/laptop_mode
            echo 500 > /proc/sys/vm/dirty_writeback_centisecs
            echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
            echo 0 > /sys/module/snd_hda_intel/parameters/power_save
            echo 12 > /sys/class/backlight/acpi_video0/brightness
            for i in /sys/bus/usb/devices/*/power/autosuspend; do
                echo 2 > $i
            done
            for i in /sys/class/scsi_host/host*/link_power_management_policy
                do echo max_performance > $i
            done
            for mod in $modlist; do
                if ! lsmod | grep $mod; then
                    modprobe $mod 2>/dev/null
                fi
            done
            for bus in $buslist; do
                for i in /sys/bus/$bus/devices/*/power/control; do
                    echo on > $i
                done
            done
        ;;
    esac
    
    exit 0
    

    Source

    OR although I havenot used it, many have recommended jupiter applet for power saving. You can install it from ppa:

    sudo add-apt-repository ppa:webupd8team/jupiter
    sudo apt-get update
    sudo apt-get install jupiter
    

    Source