尝试安装 laptop-mode-tools 时出现未处理的内核版本错误

尝试安装 laptop-mode-tools 时出现未处理的内核版本错误

你好,我在 Oneiric Ocelot 中安装 laptop-mode-tools 后第一次尝试运行时出现此错误:

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

因此我的 laptop-mode-tools 是 1.57-1ubuntu1,并且我在启动板中看到 Ubuntu 团队正在准备包含对内核 3.0 的支持的 1.58-3ubuntu1。

但是,我在 apt-cache showpkg laptop-mode-tools 中找不到 1.58-3ubuntu1(只列出了 1.57),所以我无法升级我的 laptop-mode-tools。

我尝试将内核 PPA 添加到我的存储库缓存和 apt-get update 中,但在 apt-cache showpkg linux-headers 中只显示 3.0.0.12-generic。所以我也无法降级我的内核。

由于我使用的是笔记本电脑,我希望 laptop-mode-tools 能够与 Oneiric 配合使用,你们建议我怎么做?我是一个初学者,所以请回答得轻松一些。我可以使用软件包,但不能使用修补/编译等。

答案1

根据这个建议漏洞我在 laptop-mode-tools 脚本中添加了内核版本。因此,您应该在文件 /usr/sbin/laptop_mode 的第 506 行左右添加“3.0”);;,内容如下:

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

如果你想完全避免使用 laptop-mode-tools,你可以添加以下脚本并将/etc/pm/power.d/其命名为powersave。它的功能与 laptop-mode 类似。你可能需要根据硬件调整脚本。

#!/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

来源

或者虽然我没有用过,但很多人推荐木星小程序以节省电量。你可以从 ppa 安装:

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

来源

相关内容