Ubuntu online direct upgrade

        Ubuntu was installed on VMware a few days ago, and the kernel version at that time supported it (ipguard, encryption software). Later, Ubuntu automatically upgraded the Linux kernel, which resulted in the added software not being supported and encrypted files unable to be accessed. Later, the encryption software vendor updated the software, but it still couldn't keep up with the Linux kernel update speed, and it still couldn't be used.

        I have written about the method of manually upgrading the kernel before, but it is a bit complicated, so with the help of chatgpt's prompts and exploration, I can quickly upgrade the kernel to the old version with direct commands, which is just a matter of a few commands.

  Step 1: Find the kernel

    Find the kernel you want to upgrade, the command is as follows

cegncn@cegncn-virtual-machine:~$ apt search linux-image | grep 6.2.0-31

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

linux-image-6.2.0-31-generic/jammy-updates,jammy-security,now 6.2.0-31.31~22.04.1 amd64 [installed]
linux-image-unsigned-6.2.0-31-generic/jammy-updates,jammy-security 6.2.0-31.31~22.04.1 amd64
cegncn@cegncn-virtual-machine:~$ 

    Directly find the full name of the kernel version: linux-image-6.2.0-31-generic

Step 2: Upgrade the kernel

Since the kernel of my computer was upgraded from 6.2.0-31, it is available locally. You can see it directly without upgrading.

sudo apt install linux-image-6.2.0-31-generic
[sudo] password for cegncn: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
linux-image-6.2.0-31-generic is already the newest version (6.2.0-31.31~22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.

Step 3: Start the kernel

        After the virtual machine starts, you need to enter grub to select the startup kernel. When starting, you need to long press the shift key to enter:

Note, do not select the -recovery version. This is similar to Windows safe mode. After selecting the appropriate version, you can start it directly.

Step 4: Remove useless kernels

cegncn@cegncn-virtual-machine:~$ sudo apt remove linux-image-6.2.0-32-generic
[sudo] password for cegncn: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-headers-generic-hwe-22.04
  thermald
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-generic-hwe-22.04 linux-image-6.2.0-32-generic
  linux-image-generic-hwe-22.04
0 upgraded, 0 newly installed, 3 to remove and 40 not upgraded.
After this operation, 13.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 244718 files and directories currently installed.)
Removing linux-generic-hwe-22.04 (6.2.0.32.32~22.04.9) ...
Removing linux-image-generic-hwe-22.04 (6.2.0.32.32~22.04.9) ...
Removing linux-image-6.2.0-32-generic (6.2.0-32.32~22.04.1) ...
I: /boot/vmlinuz.old is now a symlink to vmlinuz-6.2.0-26-generic
I: /boot/initrd.img.old is now a symlink to initrd.img-6.2.0-26-generic
I: /boot/vmlinuz is now a symlink to vmlinuz-6.2.0-31-generic
I: /boot/initrd.img is now a symlink to initrd.img-6.2.0-31-generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-6.2.0-32-generic
/etc/kernel/postrm.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-6.2.0-31-generic
Found initrd image: /boot/initrd.img-6.2.0-31-generic
Found linux image: /boot/vmlinuz-6.2.0-26-generic
Found initrd image: /boot/initrd.img-6.2.0-26-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
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.
done

As above, Ubuntu kernel upgrade can be easily implemented through commands, which is convenient and fast.

Guess you like

Origin blog.csdn.net/weixin_45119096/article/details/132901801