升降级Ubuntu的linux内核
因工作需要,在电脑上装多个版本的linux内核。环境ubuntu 20.04。
-
访问:http://kernel.ubuntu.com/~kernel-ppa/mainline
-
选择自己需要的指定版本
这里会列出很多很多版本,建议直接搜索需要安装的版本号。
-
点进去后,见以下界面。
因uname -m显示系统cpu架构是x86_64,故而应下载amd64.deb后缀的文件。
需要下载:
amd64/linux-headers-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb
amd64/linux-headers-5.10.1-051001_5.10.1-051001.202012142031_all.deb
amd64/linux-image-unsigned-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb
amd64/linux-modules-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb
- 下载后,放到一个新文件夹里,保证里面除了这四个deb以外没有别的deb文件。
- 在这个文件夹打开终端,dpkg安装
test@test-Vostro-3268:~/下载/5.10.1$ sudo dpkg -i ***.deb
[sudo] password for test:
Selecting previously unselected package linux-headers-5.10.1-051001-generic.
dpkg: warning: files list file for package 'libctf0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'cups-ipp-utils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'fonts-noto-cjk-extra' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgme0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libnet-ssleay-perl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'fonts-smc' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libreoffice-style-elementary' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pkg-resources' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libjpeg8:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libjpeg8:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'gnome-calculator' missing; assuming package has no files currently installed
... ... ... ...
dpkg: warning: files list file for package 'libwayland-client0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libwayland-client0:i386' missing; assuming package has no files currently installed
(Reading database ... 61376 files and directories currently installed.)
Preparing to unpack linux-headers-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb ...
Unpacking linux-headers-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
Selecting previously unselected package linux-headers-5.10.1-051001.
Preparing to unpack linux-headers-5.10.1-051001_5.10.1-051001.202012142031_all.deb ...
Unpacking linux-headers-5.10.1-051001 (5.10.1-051001.202012142031) ...
Selecting previously unselected package linux-image-unsigned-5.10.1-051001-generic.
Preparing to unpack linux-image-unsigned-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb ...
Unpacking linux-image-unsigned-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
Selecting previously unselected package linux-modules-5.10.1-051001-generic.
Preparing to unpack linux-modules-5.10.1-051001-generic_5.10.1-051001.202012142031_amd64.deb ...
Unpacking linux-modules-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
Setting up linux-headers-5.10.1-051001 (5.10.1-051001.202012142031) ...
Setting up linux-modules-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
Setting up linux-headers-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
Setting up linux-image-unsigned-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-4.20.11-042011-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-4.20.11-042011-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.10.1-051001-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.10.1-051001-generic
Processing triggers for linux-image-unsigned-5.10.1-051001-generic (5.10.1-051001.202012142031) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.10.1-051001-generic
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125b-2.fw for module r8169
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.10.1-051001-generic
Found initrd image: /boot/initrd.img-5.10.1-051001-generic
Found linux image: /boot/vmlinuz-5.4.63-050463-generic
Found initrd image: /boot/initrd.img-5.4.63-050463-generic
Found linux image: /boot/vmlinuz-5.4.63
Found initrd image: /boot/initrd.img-5.4.63
Found linux image: /boot/vmlinuz-5.4.0-55-generic
Found initrd image: /boot/initrd.img-5.4.0-55-generic
Found linux image: /boot/vmlinuz-5.4.0-54-generic
Found initrd image: /boot/initrd.img-5.4.0-54-generic
Found linux image: /boot/vmlinuz-5.4.0-53-generic
Found initrd image: /boot/initrd.img-5.4.0-53-generic
Found linux image: /boot/vmlinuz-5.4.0-52-generic
Found initrd image: /boot/initrd.img-5.4.0-52-generic
Found linux image: /boot/vmlinuz-5.4.0-51-generic
Found initrd image: /boot/initrd.img-5.4.0-51-generic
Found linux image: /boot/vmlinuz-4.20.11-042011-generic
Found initrd image: /boot/initrd.img-4.20.11-042011-generic
Found linux image: /boot/vmlinuz-4.20.1-042001-generic
Found initrd image: /boot/initrd.img-4.20.1-042001-generic
Adding boot menu entry for UEFI Firmware Settings
done
- 查看是否处于已安装状态
dpkg -l | grep linux-
会显示出一堆相关的已安装软件名,其中能找到以下,则安装成功。
7. 重启后,在advanced options for ubuntu中可以选择想要的linux版本
重启开机后在终端中:
uname -r检查是否成功切换到对应版本。
test@test-Vostro-3268:~$ uname -r
5.10.1-051001-generic