Ubuntu24.04日常使用过程的问题记录
2025/12/17
无操作卡死,无法唤醒
问题描述:
在使用Ubuntu24.04 内核版本 6.14.0-37 时,笔记本电脑无操作一段时间后卡死在停留界面无反应,或者黑屏但是没有关机,远程连接ssh中断,无法唤醒,只能强制关机重启。
在网上查了一下有说内核AMD显卡等驱动的问题导致,也有说ACPI电源管理睡眠无法唤醒问题,依法设置后依旧没有得到解决。决定降低内核版本试试。
切换内核版本
查看当前使用的内核版本
uname -r使用如下命令可以查看系统可用的内核:
sudo dpkg --get-selections | grep linux-检查是否有你需要的内核版本,注意同版本号的四个模块
- 内核镜像 linux-image-<版本号>-generic
- 内核头文件 linux-headers-<版本号>-generic
- 内核模块 linux-modules-<版本号>-generic
- 内核额外模块 linux-modules-extra-<版本号>-generic 少了这个模块,切换之后就会没有网卡驱动等
查询可更换的内核版本
sudo apt search linux-image安装合适版本内核
# 内核镜像 sudo apt install linux-image-6.11.0-26-generic # 内核头文件 sudo apt install linux-headers-6.11.0-26-generic # 内核模块 sudo apt install linux-modules-6.11.0-26-generic # 内核额外模块 sudo apt install linux-modules-extra-6.11.0-26-generic查询是否安装成功
sudo dpkg --get-selections | grep linux-显示如下
linux-headers-6.11.0-26-generic install linux-hwe-6.11-headers-6.11.0-26 install linux-image-6.11.0-26-generic install linux-modules-6.11.0-26-generic install linux-modules-extra-6.11.0-26-generic install一个简单的确定内核顺序的方法:
更新grub:
sudo update-grub输出如下信息:
Sourcing file `/etc/default/grub' Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.14.0-37-generic Found initrd image: /boot/initrd.img-6.14.0-37-generic Found linux image: /boot/vmlinuz-6.11.0-26-generic Found initrd image: /boot/initrd.img-6.11.0-26-generic Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. Adding boot menu entry for UEFI Firmware Settings ... done或者通过grub.cfg查看
cat /boot/grub/grub.cfg | grep "menuentry 'Ubuntu, with Linux"接着看你选定的内核版本是第几个,从0开始标号。
总结大致排列如下:
0 Ubuntu, with Linux 6.14.0-37-generic 1 Ubuntu, with Linux 6.14.0-37-generic (recovery mode) 2 Ubuntu, with Linux 6.14.0-36-generic 3 Ubuntu, with Linux 6.14.0-36-generic (recovery mode) 4 Ubuntu, with Linux 6.11.0-26-generic 5 Ubuntu, with Linux 6.11.0-26-generic (recovery moe)不要选(recovery mode)那一行。所以我要换的内核位置是4。
更改grub默认启动项
sudo vim /etc/default/grub将GRUB_DEFAULT=0修改为GRUB_DEFAULT=“1>4”
更新引导文件
sudo update-grub重启
reboot查看内核版本
uname -r注意:如果选错进入到Recovery Mode中,可以去root下去更改/etc/default/grub文件。
或者用启动盘启动进入试用Ubuntu的图形界面,然后再去修改原磁盘路径下的/etc/default/grub文件。启动之后依旧是Recovery Mode界面,因为还没更新系统的grub,此时点击grub更新后再关机重启即可。