sudo apt update
sudo apt upgrade
sudo apt search linux-image
sudo apt install linux-image-<version>
sudo apt install linux-image-5.15.0-91-generic
sudo apt install linux-headers-5.15.0-91-generic
sudo apt install linux-modules-5.15.0-91-generic
sudo apt install linux-modules-extra-5.15.0-91-generic
sudo update-grub
sudo reboot
uname -r
使用命令dpkg --get-selections |grep linux
查看如下:
使用命令sudo apt autoremove linux-headers-5.4.0-170
删除旧版本内核相关信息
ubuntu@ubuntu:~$ ip a
ubuntu@ubuntu:~$ ping 8.8.8.8
ubuntu@ubuntu:~$ uname -r
ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# sudo apt update
root@ubuntu:/home/ubuntu# sudo apt upgrade
root@ubuntu:/home/ubuntu# sudo apt search linux-image
linux-image-unsigned-5.4.0-29-lowlatency/focal-updates,focal-security 5.4.0-29.33 amd64
Linux kernel image for version 5.4.0 on 64 bit x86 SMP
linux-modules-nvidia-455-5.6.0-1036-oem/focal-updates 5.6.0-1036.39 amd64
Linux kernel nvidia modules for version 5.6.0-1036
....
<version>
替换为选择的实际需要更换的内核版本;<version>
替换为选择的实际内核版本。root@ubuntu:/home/ubuntu# sudo apt install linux-image-5.15.0-91-generic
root@ubuntu:/home/ubuntu# sudo apt install linux-image-5.15.0-91-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
linux-modules-5.15.0-91-generic
Suggested packages:
fdutils linux-doc | linux-hwe-5.15-source-5.15.0 linux-hwe-5.15-tools linux-headers-5.15.0-91-generic
linux-modules-extra-5.15.0-91-generic
The following NEW packages will be installed:
linux-image-5.15.0-91-generic linux-modules-5.15.0-91-generic
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.3 MB of archives.
After this operation, 140 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-modules-5.15.0-91-generic amd64 5.15.0-91.101~20.04.1 [21.0 MB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-5.15.0-91-generic amd64 5.15.0-91.101~20.04.1 [11.4 MB]
Fetched 32.3 MB in 5s (6,752 kB/s)
Selecting previously unselected package linux-modules-5.15.0-91-generic.
(Reading database ... 108845 files and directories currently installed.)
Preparing to unpack .../linux-modules-5.15.0-91-generic_5.15.0-91.101~20.04.1_amd64.deb ...
Unpacking linux-modules-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Selecting previously unselected package linux-image-5.15.0-91-generic.
Preparing to unpack .../linux-image-5.15.0-91-generic_5.15.0-91.101~20.04.1_amd64.deb ...
Unpacking linux-image-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Setting up linux-modules-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Setting up linux-image-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.4.0-171-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-5.4.0-171-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-5.15.0-91-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-91-generic
Processing triggers for linux-image-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-91-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
/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.15.0-91-generic
Found initrd image: /boot/initrd.img-5.15.0-91-generic
Found linux image: /boot/vmlinuz-5.4.0-171-generic
Found initrd image: /boot/initrd.img-5.4.0-171-generic
Found linux image: /boot/vmlinuz-5.4.0-144-generic
Found initrd image: /boot/initrd.img-5.4.0-144-generic
Adding boot menu entry for UEFI Firmware Settings
done
root@ubuntu:/home/ubuntu# sudo apt install linux-image-5.15.0-91-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-5.15.0-91-generic is already the newest version (5.15.0-91.101~20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ubuntu:/home/ubuntu# sudo apt install linux-headers-5.15.0-91-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
linux-hwe-5.15-headers-5.15.0-91
The following NEW packages will be installed:
linux-headers-5.15.0-91-generic linux-hwe-5.15-headers-5.15.0-91
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.8 MB of archives.
After this operation, 105 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-hwe-5.15-headers-5.15.0-91 all 5.15.0-91.101~20.04.1 [12.0 MB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-headers-5.15.0-91-generic amd64 5.15.0-91.101~20.04.1 [2,766 kB]
Fetched 14.8 MB in 5s (2,950 kB/s)
Selecting previously unselected package linux-hwe-5.15-headers-5.15.0-91.
(Reading database ... 110162 files and directories currently installed.)
Preparing to unpack .../linux-hwe-5.15-headers-5.15.0-91_5.15.0-91.101~20.04.1_all.deb ...
Unpacking linux-hwe-5.15-headers-5.15.0-91 (5.15.0-91.101~20.04.1) ...
Selecting previously unselected package linux-headers-5.15.0-91-generic.
Preparing to unpack .../linux-headers-5.15.0-91-generic_5.15.0-91.101~20.04.1_amd64.deb ...
Unpacking linux-headers-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Setting up linux-hwe-5.15-headers-5.15.0-91 (5.15.0-91.101~20.04.1) ...
Setting up linux-headers-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
root@ubuntu:/home/ubuntu# sudo apt install linux-modules-5.15.0-91-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-modules-5.15.0-91-generic is already the newest version (5.15.0-91.101~20.04.1).
linux-modules-5.15.0-91-generic set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ubuntu:/home/ubuntu# sudo apt install linux-modules-extra-5.15.0-91-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
linux-modules-extra-5.15.0-91-generic
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 57.9 MB of archives.
After this operation, 355 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-modules-extra-5.15.0-91-generic amd64 5.15.0-91.101~20.04.1 [57.9 MB]
Fetched 57.9 MB in 60s (958 kB/s)
Selecting previously unselected package linux-modules-extra-5.15.0-91-generic.
(Reading database ... 138423 files and directories currently installed.)
Preparing to unpack .../linux-modules-extra-5.15.0-91-generic_5.15.0-91.101~20.04.1_amd64.deb ...
Unpacking linux-modules-extra-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Setting up linux-modules-extra-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
Processing triggers for linux-image-5.15.0-91-generic (5.15.0-91.101~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-91-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
/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.15.0-91-generic
Found initrd image: /boot/initrd.img-5.15.0-91-generic
Found linux image: /boot/vmlinuz-5.4.0-171-generic
Found initrd image: /boot/initrd.img-5.4.0-171-generic
Found linux image: /boot/vmlinuz-5.4.0-144-generic
Found initrd image: /boot/initrd.img-5.4.0-144-generic
Adding boot menu entry for UEFI Firmware Settings
done
root@ubuntu:/home/ubuntu# sudo 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.15.0-91-generic
Found initrd image: /boot/initrd.img-5.15.0-91-generic
Found linux image: /boot/vmlinuz-5.4.0-171-generic
Found initrd image: /boot/initrd.img-5.4.0-171-generic
Found linux image: /boot/vmlinuz-5.4.0-144-generic
Found initrd image: /boot/initrd.img-5.4.0-144-generic
Adding boot menu entry for UEFI Firmware Settings
done
root@ubuntu:/home/ubuntu# sudo reboot
Connection closing...Socket close.
image、headers、modules、modules-extra
)均需安装,否则会导致切换内核以后,识别不到网卡信息。root@ubuntu:~$ sudo apt install linux-image-5.15.0-91-generic
root@ubuntu:~$ sudo apt install linux-headers-5.15.0-91-generic
root@ubuntu:/home/ubuntu# sudo apt install linux-modules-5.15.0-91-generic
root@ubuntu:/home/ubuntu# sudo apt install linux-modules-extra-5.15.0-91-generic
root@ubuntu:/home/ubuntu# sudo update-grub
root@ubuntu:/home/ubuntu# sudo reboot
ubuntu@ubuntu:~$ uname -r
1| ubuntu@ubuntu:~$ uname -r
2| 5.15.0-91-generic
3| ubuntu@ubuntu:~$
ubuntu@ubuntu:~$ dpkg --get-selections |grep linux
ubuntu@ubuntu:~$ dpkg --get-selections |grep linux
console-setup-linux install
libselinux1:amd64 install
linux-base install
linux-firmware install
linux-generic install
linux-headers-5.15.0-91-generic install
linux-headers-5.4.0-144 install
linux-headers-5.4.0-144-generic install
linux-headers-5.4.0-171 install
linux-headers-5.4.0-171-generic install
linux-headers-generic install
linux-hwe-5.15-headers-5.15.0-91 install
linux-image-5.15.0-91-generic install
linux-image-5.4.0-144-generic install
linux-image-5.4.0-171-generic install
linux-image-generic install
linux-modules-5.15.0-91-generic install
linux-modules-5.4.0-144-generic install
linux-modules-5.4.0-171-generic install
linux-modules-extra-5.15.0-91-generic install
linux-modules-extra-5.4.0-144-generic install
linux-modules-extra-5.4.0-171-generic install
util-linux install
ubuntu@ubuntu:~$ sudo apt autoremove linux-headers-5.4.0-144
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'linux-headers-5.4.0-144' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ubuntu@ubuntu:~$ sudo apt autoremove linux-headers-5.4.0-170
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'linux-headers-5.4.0-144' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ubuntu@ubuntu:~$
ubuntu@ubuntu:~$ sudo reboot
ubuntu@ubuntu:~$ sudo reboot
#重启开机后进入以下界面完成以上全部操作
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-91-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun 18 Feb 2024 06:10:18 AM UTC
System load: 0.68 Temperature: 41.0 C
Usage of /: 21.0% of 56.88GB Processes: 846
Memory usage: 0% Users logged in: 0
Swap usage: 0% IPv4 address for enp4s0: 10.168.3.166
* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.
https://ubuntu.com/engage/secure-kubernetes-at-the-edge
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sun Feb 18 05:34:32 2024
ubuntu@ubuntu:~$
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。