当前位置: 首页 > article >正文

Ubuntu22.04系统切换内核版本

Ubuntu系统切换内核版本

  • 1 更换镜像源
  • 2 查询可更换的内核版本
  • 3 安装合适版本内核
  • 4 切换内核版本
  • 5 验证内核是否更换成功

1 更换镜像源

使用鱼香ROS脚本来更换镜像源

wget http://fishros.com/install -O fishros && . fishros

2 查询可更换的内核版本

sudo apt update
sudo apt search linux-image

3 安装合适版本内核

此处选择linux-image-6.2.0-37-generic

# 内核镜像
sudo apt install linux-image-6.2.0-37-generic
# 内核头文件
sudo apt install linux-headers-6.2.0-37-generic
# 内核模块
sudo apt install linux-modules-6.2.0-37-generic
# 内核额外模块
sudo apt install linux-modules-extra-6.2.0-37-generic

查看是否安装成功

dpkg -l | grep linux-image      

4 切换内核版本

查看内核版本的顺序

gedit /boot/grub/grub.cfg
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
	recordfail
	load_video
	gfxmode $linux_gfx_mode
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
	else
	  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
	fi
	linux	/boot/vmlinuz-6.8.0-51-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro  quiet splash $vt_handoff
	initrd	/boot/initrd.img-6.8.0-51-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
	menuentry 'Ubuntu, with Linux 6.8.0-51-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.8.0-51-generic-advanced-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.8.0-51-generic ...'
		linux	/boot/vmlinuz-6.8.0-51-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro  quiet splash $vt_handoff
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.8.0-51-generic
	}
	menuentry 'Ubuntu, with Linux 6.8.0-51-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.8.0-51-generic-recovery-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.8.0-51-generic ...'
		linux	/boot/vmlinuz-6.8.0-51-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro recovery nomodeset dis_ucode_ldr 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.8.0-51-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-37-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.2.0-37-generic-advanced-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.2.0-37-generic ...'
		linux	/boot/vmlinuz-6.2.0-37-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro  quiet splash $vt_handoff
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.2.0-37-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-37-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.2.0-37-generic-recovery-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.2.0-37-generic ...'
		linux	/boot/vmlinuz-6.2.0-37-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro recovery nomodeset dis_ucode_ldr 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.2.0-37-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-26-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.2.0-26-generic-advanced-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.2.0-26-generic ...'
		linux	/boot/vmlinuz-6.2.0-26-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro  quiet splash $vt_handoff
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.2.0-26-generic
	}
	menuentry 'Ubuntu, with Linux 6.2.0-26-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.2.0-26-generic-recovery-03c538ec-639b-49ff-b89a-ed6c2ddb6a73' {
		recordfail
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		else
		  search --no-floppy --fs-uuid --set=root 03c538ec-639b-49ff-b89a-ed6c2ddb6a73
		fi
		echo	'Loading Linux 6.2.0-26-generic ...'
		linux	/boot/vmlinuz-6.2.0-26-generic root=UUID=03c538ec-639b-49ff-b89a-ed6c2ddb6a73 ro recovery nomodeset dis_ucode_ldr 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.2.0-26-generic
	}
}

可总结如下,所要切换的Ubuntu, with Linux 6.2.0-37-generic"1 > 2"

0   Ubuntu          
1   Ubuntu 高级选项  
	   1>0  Ubuntu, with Linux 6.8.0-51-generic
	   1>1	Ubuntu, with Linux 6.8.0-51-generic (recovery mode)
   	   1>2	Ubuntu, with Linux 6.2.0-37-generic
	   1>3  Ubuntu, with Linux 6.2.0-37-generic (recovery mode)
       1>4	Ubuntu, with Linux 6.2.0-26-generic
   	   1>5	Ubuntu, with Linux 6.2.0-26-generic (recovery moe)

更改grub默认启动项

sudo gedit /etc/default/grub

在这里插入图片描述
更新开启引导文件

sudo update-grub

重启

reboot

5 验证内核是否更换成功

uanme -r

http://www.kler.cn/a/512836.html

相关文章:

  • 51c大模型~合集105
  • Pix2Pix:图像到图像转换的条件生成对抗网络深度解析
  • Windows电脑安装USB Redirector并实现内外网跨网USB共享通信访问
  • C# 以管理员方式启动程序全解析
  • 【Linux】Linux入门(三)权限
  • HTML之拜年/跨年APP(改进版)
  • 【论文投稿】探秘嵌入式硬件设计:从原理到代码实战
  • 计算机视觉模型的未来:视觉语言模型
  • java快速导出word文档
  • 小结:OSPF协议的工作原理
  • Linux探秘坊-------3.开发工具详解(2)
  • Spring Event和MQ的区别和使用场景
  • Java JDK17 API 离线文档下载
  • 【深度学习项目】语义分割-DeepLab网络(DeepLabV3介绍、基于Pytorch实现DeepLabV3网络)
  • ubuntu下,模仿安装vllm,仅记录
  • android如何将字符串\u83b7\u53d6\u6210\u529f转换成中文
  • Mac安装配置使用nginx的一系列问题
  • 一文大白话讲清楚webpack基本使用——3——图像相关loader的配置和使用
  • 摘录人工智能面试笔试题汇总
  • 文档解析:PDF里的复杂表格、少线表格如何还原?
  • 对人型机器人的研究和展望
  • 提升前端性能的JavaScript技巧:让你的网站飞一般的流畅
  • 【C++指南】类和对象(九):内部类
  • 【JAVA】最新jdk23下载安装
  • Java Web开发高级——消息队列与异步处理
  • 整体隔离版全链路压测