며칠 전 VMware에 Ubuntu가 설치되었는데 당시 커널 버전에서 지원(ipguard, 암호화 소프트웨어)했는데 나중에 Ubuntu가 자동으로 Linux 커널을 업그레이드하여 추가된 소프트웨어가 지원되지 않고 암호화된 파일을 사용할 수 없게 되었습니다. 액세스했습니다. 나중에 암호화 소프트웨어 공급업체에서 소프트웨어를 업데이트했지만 여전히 Linux 커널 업데이트 속도를 따라잡지 못해 여전히 사용할 수 없었습니다.
이전에 커널을 수동으로 업그레이드하는 방법에 대해 글을 쓴 적이 있지만 조금 복잡하기 때문에 chatgpt의 프롬프트와 탐색의 도움을 받아 직접 명령으로 커널을 이전 버전으로 빠르게 업그레이드할 수 있습니다. 몇 가지 명령.
1단계: 커널 찾기
업그레이드하려는 커널을 찾으십시오. 명령은 다음과 같습니다
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:~$
커널 버전의 전체 이름을 직접 찾으십시오: linux-image-6.2.0-31-generic
2단계: 커널 업그레이드
내 컴퓨터의 커널이 6.2.0-31에서 업그레이드 되었기 때문에 로컬에서 사용이 가능하며, 업그레이드 없이 바로 보실 수 있습니다.
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.
3단계: 커널 시작
가상 머신이 시작된 후 grub을 입력하여 시작 커널을 선택해야 하며 시작할 때 Shift 키를 길게 눌러 다음을 입력해야 합니다.
-recovery 버전을 선택하지 마십시오. 이는 Windows 안전 모드와 유사합니다. 적절한 버전을 선택한 후 바로 시작할 수 있습니다.
4단계: 쓸모없는 커널 제거
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
위와 같이 Ubuntu 커널 업그레이드는 명령을 통해 쉽게 구현할 수 있어 편리하고 빠릅니다.