美文网首页
arch休眠设置

arch休眠设置

作者: beihaott | 来源:发表于2023-03-20 16:20 被阅读0次

https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate_(简体中文)

https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate

https://wiki.archlinux.org/index.php/Power_management

https://wiki.archlinux.org/index.php/HP_Compaq_6510b

三种挂起方式

名称 挂起方式 电源状态

1. suspend 挂起,待机,暂停 (str: suspend to RAM)保存到内存 通电 低功耗

2. hibernate 休眠,冬眠 (std: suspend to disk)保存至硬盘swap 断电 关机

3. HybridSleep 混合睡眠 (strd:suspend to both)保存到内存和硬盘 通电 低功耗

睡眠模式,比如笔记本电脑:若电池还有电,就等同于挂起;若电池电量耗尽,则等同于休眠模式。

========================

ArchLiux的休眠功能需要用户设置后才能使用。

这里介绍使用systemd休眠。

需要swap分区或者swap文件,大小要求大于等于系统内存。

==== 1. 在bootloader 中增加resume内核参数

需要添加resume=/dev/sdxY (sdxY 是swap分区的名字) ,让系统在启动时读取swap分区中的内容。

lsblk

├─sdb6 ... /

└─sdb9 ... [SWAP]

当前使用了grub2作为bootloader,swap的分区是/dev/sda9。

== 1.1 编辑/etc/default/grub文件,在GRUB_CMDLINE_LINUX_DEFAULT中添加resume=/dev/sda9

若原本是: GRUB_CMDLINE_LINUX_DEFAULT=”quiet intel_pstate=enable”

则添加后: GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=enable resume=/dev/sda9"

注:这里的 intel_pstate=enable 只针对intel处理器中SandyBridge(含IvyBridge)及更新的构架的CPU。

当前系统:

原本是: GRUB_CMDLINE_LINUX_DEFAULT="quiet"

添加后: GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=/dev/sda9"

== 1.2 更新 grub 配置:

备份 grub.cfg 这里有手动添加的启动项目,

menuentry 'windows2008r2' {

set root=(hd0,1)

chainloader +1

}

sudo grub-mkconfig -o /boot/grub/grub.cfg

==== 2. 配置 initramfs的resume钩子

== 2.1 添加resume钩子 编辑 /etc/mkinitcpio.conf ,在HOOKS行中添加resume钩子:

若原本是: HOOKS="base udev autodetect modconf block filesystems keyboard fsck"

则添加后: HOOKS="base udev resume autodetect modconf block filesystems keyboard fsck"

注意: 如果使用lvm分区,需要将resume放在lvm后面

lvm分区: HOOKS="base udev autodetect modconf block lvm2 resume filesystems keyboard fsck"

当前系统:

原本是: HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)

添加后: HOOKS=(base udev resume autodetect modconf block filesystems keyboard fsck)

== 2.2 重新生成 initramfs 镜像:mkinitcpio -p linux

sudo mkinitcpio -p linux

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'

-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img

==> Starting build: 5.0.4-arch1-1-ARCH

-> Running build hook: [base]

-> Running build hook: [udev]

-> Running build hook: [resume]

-> Running build hook: [autodetect]

-> Running build hook: [modconf]

-> Running build hook: [block]

-> Running build hook: [filesystems]

-> Running build hook: [keyboard]

-> Running build hook: [fsck]

==> Generating module dependencies

==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img

==> Image generation successful

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'

-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect

==> Starting build: 5.0.4-arch1-1-ARCH

-> Running build hook: [base]

-> Running build hook: [udev]

-> Running build hook: [resume]

-> Running build hook: [modconf]

-> Running build hook: [block]

==> WARNING: Possibly missing firmware for module: wd719x

==> WARNING: Possibly missing firmware for module: aic94xx

-> Running build hook: [filesystems]

-> Running build hook: [keyboard]

-> Running build hook: [fsck]

==> Generating module dependencies

==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img

==> Image generation successful

$

参照:https://wiki.archlinux.org/index.php/Mkinitcpio

==> aic94xx-firmware:适用于AIC94xx驱动程序的Adaptec SAS 44300,48300,58300定序器固件

==> wd719x-firmware:Western Digital WD7193,WD7197和WD7296 SCSI卡的驱动程序

大多数人都没有SAS / SCSI磁盘控制器,因此请忽略这些警告,不要安装这些驱动程序。

这些对任何Arch Linux用户都是有用的,特别是那些没有安装这些固件模块的用户。如果您不使用使用这些固件的硬件,则可以忽略此警告消息。

安装: https://gist.github.com/imrvelj/c65cd5ca7f5505a65e59204f5a3f7a6d

git clone https://aur.archlinux.org/aic94xx-firmware.git

cd aic94xx-firmware

makepkg -sri

git clone https://aur.archlinux.org/wd719x-firmware.git

cd wd719x-firmware

makepkg -sri

再mkinitcpio -p linux一次。

=========================

==== 设置低电量自动休眠, 用于带有内置电池的设备。

修改/etc/UPower/UPower.conf相关配置.示例,在电量低至%5时自动休眠:

PercentageLow=15          #<=15%低电量

PercentageCritical=10      #<=10%警告电量

PercentageAction=5         #<=5%执行动作(即CriticalPowerAction)的电量

CriticalPowerAction=Hibernate       #(在本示例中是电量<=5%)设备会自动休眠。

##CriticalPowerAction的取值有Poweroff、Hibernate和HybidSleep。

===================

==== 3. 设置盖上笔记本盖子或按下电源键休眠

== 3.1 编辑 /etc/systemd/logind.conf

盖上盖子休眠,添加:HandleLidSwitch=hibernate

按下电源键休眠添加:HandlePowerKey=hibernate

== 3.2 执行以下命令使其立即生效:

sudo systemctl restart systemd-logind

===================

https://github.com/levinit/itnotes/blob/master/linux/laptop笔记本相关.md

#NAutoVTs=6

#ReserveVT=6

#KillUserProcesses=no

#KillOnlyUsers=

#KillExcludeUsers=root

#InhibitDelayMaxSec=5

#HandlePowerKey=poweroff #按下电源键

#HandleSuspendKey=suspend #按下挂起键HandleSleepKey

#HandleHibernateKey=hibernate #按下休眠键

#HandleLidSwitch=suspend #合上笔记本盖

#HandleLidSwitchExternalPower=suspend

#HandleLidSwitchDocked=ignore #插上扩展坞或者连接外部显示器情况下合上笔记本盖子

#PowerKeyIgnoreInhibited=no

#SuspendKeyIgnoreInhibited=no

#HibernateKeyIgnoreInhibited=no

#LidSwitchIgnoreInhibited=yes

#HoldoffTimeoutSec=30s

#IdleAction=ignore

#IdleActionSec=30min

#RuntimeDirectorySize=10%

#RemoveIPC=yes

#InhibitorsMax=8192

#SessionsMax=8192

poweroff和halt均是关机(具体实现有区别)

supspend是挂起(暂停),设备通电,内容保存在内存中

hybernate是休眠,设备断电(同关机状态),内容保存在硬盘中

hybridSleep是混合睡眠,设备通电,内容保存在硬盘和内存中

lock是锁屏

kexec是从当前正在运行的内核直接引导到一个新内核(多用于升级了内核的情况下)

ignore是忽略该动作,即不进行任何电源事件响应

相关文章

  • windows设置休眠

    http://jingyan.baidu.com/article/020278118599eb1bcc9ce53e...

  • Macbook 休眠设置

    我的电脑休眠一夜8h左右会消耗大约13%的电量和苹果公司宣称的1%相去甚远。昨天晚上在上网搜索了下,然后我修改了M...

  • 设置电脑休眠

    不允许休眠 查看状态 允许休眠 参考: https://zhuanlan.zhihu.com/p/46887043...

  • 提升Xcode编译速度

    设置线程数 在终端中设置 build setting 仅设置debug相关参数 Build Active Arch...

  • 安装arch

    安装前准备 安装前准备的工具 虚拟机软件VMware arch光盘镜像 开始安装 设置好虚拟机后,开机进入arch...

  • 4412开发板-Android4.4典型功能相关源码修改及定制

    迅为4412开发板-(屏幕翻转)-(Android4.4设置不锁屏、去除休眠、屏幕休眠等) 19.20.1 屏幕翻...

  • surfacebook竟然没有休眠的选项了 肿么办

    本文章不是解决控制面板中电池设置只要把休眠的勾勾打上就出现休眠的问题,是根本没有休眠这个选项可以打勾勾好吗!!如下...

  • pmset -g

    使用电源设置 //120分钟后进入休眠,延长清醒时间 sudo pmset -c sleep120 //显示器休眠...

  • 安装Arch Linux手册

    选择安装方式 CD/USB Arch启动盘安装 使用Arch启动盘比较简单方便,没有额外设置,直接阅读下一步。US...

  • VirtualBOX安装Archlinux过程

    VirtualBox设置 虚拟机名称和类型名称:随意类型:Linux版本:Arch Linux(64-bit) 内...

网友评论

      本文标题:arch休眠设置

      本文链接:https://www.haomeiwen.com/subject/ywaurdtx.html