微信号:linux-cn

介绍:『Linux 中国』信息矩阵旗舰号:每日为 Linux 及开源爱好者推送 Linux 相关技术、运维与研发、开源资讯等方面的精选内容;提供 Linux 命令帮助、技术文章检索等功能.

UKTools:安装最新 Linux 内核的简便方法 | Linux 中国

2018-08-08 11:59 LCTT
Ubuntu 中有许多实用程序可以将 Linux 内核升级到最新的稳定版本。
-- Prakash Subramanian

致谢
编译自 | 
https://www.2daygeek.com/uktools-easy-way-to-install-latest-stable-linux-kernel-on-ubuntu-mint-and-derivatives/
 
 作者 | Prakash Subramanian
 译者 | MjSeven 🌟🌟🌟🌟共计翻译:65 篇 贡献时间:186 天

Ubuntu 中有许多实用程序可以将 Linux 内核升级到最新的稳定版本。我们之前已经写过关于这些实用程序的文章,例如 Linux Kernel Utilities (LKU)、 Ubuntu Kernel Upgrade Utility (UKUU) 和 Ubunsys。

另外还有一些其它实用程序可供使用。我们计划在其它文章中包含这些,例如 ubuntu-mainline-kernel.sh 和从主线内核手动安装的方式。

今天我们还会教你类似的使用工具 —— UKTools。你可以尝试使用这些实用程序中的任何一个来将 Linux 内核升级至最新版本。

最新的内核版本附带了安全漏洞修复和一些改进,因此,最好保持最新的内核版本以获得可靠、安全和更好的硬件性能。

有时候最新的内核版本可能会有一些漏洞,并且会导致系统崩溃,这是你的风险。我建议你不要在生产环境中安装它。

建议阅读:

◈  Linux 内核实用程序(LKU)- 在 Ubuntu/LinuxMint 中编译,安装和更新最新内核的一组 Shell 脚本 [1]
◈  Ukuu - 在基于 Ubuntu 的系统中安装或升级 Linux 内核的简便方法 [2]
◈  6 种检查系统上正在运行的 Linux 内核版本的方法 [3]

什么是 UKTools

UKTools[4] 意思是 Ubuntu 内核工具,它包含两个 shell 脚本 ukupgrade 和 ukpurge

ukupgrade 意思是 “Ubuntu Kernel Upgrade”,它允许用户将 Linux 内核升级到 Ubuntu/Mint 的最新稳定版本以及基于 kernel.ubuntu.com[5] 的衍生版本。

ukpurge 意思是 “Ubuntu Kernel Purge”,它允许用户在机器中删除旧的 Linux 内核镜像或头文件,用于 Ubuntu/Mint 和其衍生版本。它将只保留三个内核版本。

此实用程序没有 GUI,但它看起来非常简单直接,因此,新手可以在没有任何问题的情况下进行升级。

我正在运行 Ubuntu 17.10,目前的内核版本如下:

  
            
  1. $ uname -a

  2. Linux ubuntu 4.13.0-39-generic #44-Ubuntu SMP Thu Apr 5 14:25:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

运行以下命令来获取系统上已安装内核的列表(Ubuntu 及其衍生产品)。目前我持有 7 个内核。

  
            
  1. $ dpkg --list | grep linux-image

  2. ii linux-image-4.13.0-16-generic 4.13.0-16.19 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  3. ii linux-image-4.13.0-17-generic 4.13.0-17.20 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  4. ii linux-image-4.13.0-32-generic 4.13.0-32.35 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  5. ii linux-image-4.13.0-36-generic 4.13.0-36.40 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  6. ii linux-image-4.13.0-37-generic 4.13.0-37.42 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  7. ii linux-image-4.13.0-38-generic 4.13.0-38.43 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  8. ii linux-image-4.13.0-39-generic 4.13.0-39.44 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  9. ii linux-image-extra-4.13.0-16-generic 4.13.0-16.19 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  10. ii linux-image-extra-4.13.0-17-generic 4.13.0-17.20 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  11. ii linux-image-extra-4.13.0-32-generic 4.13.0-32.35 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  12. ii linux-image-extra-4.13.0-36-generic 4.13.0-36.40 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  13. ii linux-image-extra-4.13.0-37-generic 4.13.0-37.42 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  14. ii linux-image-extra-4.13.0-38-generic 4.13.0-38.43 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  15. ii linux-image-extra-4.13.0-39-generic 4.13.0-39.44 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  16. ii linux-image-generic 4.13.0.39.42 amd64 Generic Linux kernel image

如何安装 UKTools

在 Ubuntu 及其衍生产品上,只需运行以下命令来安装 UKTools 即可。

在你的系统上运行以下命令来克隆 UKTools 仓库:

  
            
  1. $ git clone https://github.com/usbkey9/uktools

进入 uktools 目录:

  
            
  1. $ cd uktools

运行 Makefile 以生成必要的文件。此外,这将自动安装最新的可用内核。只需重新启动系统即可使用最新的内核。

  
            
  1. $ sudo make

  2. [sudo] password for daygeek:

  3. Creating the directories if neccessary

  4. Linking profile.d file for reboot message

  5. Linking files to global sbin directory

  6. Ubuntu Kernel Upgrade - by Mustafa Hasturk

  7. ------------------------------------------

  8. This script is based on the work of Mustafa Hasturk and was reworked by

  9. Caio Oliveira and modified and fixed by Christoph Kepler

  10. Current Development and Maintenance by Christoph Kepler

  11. Do you want the Stable Release (if not sure, press y)? (y/n): y

  12. Do you want the Generic kernel? (y/n): y

  13. Do you want to autoremove old kernel? (y/n): y

  14. no crontab for root

  15. Do you want to update the kernel automatically? (y/n): y

  16. Setup complete. Update the kernel right now? (y/n): y

  17. Reading package lists... Done

  18. Building dependency tree

  19. Reading state information... Done

  20. The following packages were automatically installed and are no longer required:

  21. linux-headers-4.13.0-16 linux-headers-4.13.0-16-generic linux-headers-4.13.0-17 linux-headers-4.13.0-17-generic linux-headers-4.13.0-32 linux-headers-4.13.0-32-generic linux-headers-4.13.0-36

  22. linux-headers-4.13.0-36-generic linux-headers-4.13.0-37 linux-headers-4.13.0-37-generic linux-image-4.13.0-16-generic linux-image-4.13.0-17-generic linux-image-4.13.0-32-generic linux-image-4.13.0-36-generic

  23. linux-image-4.13.0-37-generic linux-image-extra-4.13.0-16-generic linux-image-extra-4.13.0-17-generic linux-image-extra-4.13.0-32-generic linux-image-extra-4.13.0-36-generic

  24. linux-image-extra-4.13.0-37-generic

  25. Use 'sudo apt autoremove' to remove them.

  26. The following additional packages will be installed:

  27. lynx-common

  28. The following NEW packages will be installed:

  29. lynx lynx-common

  30. 0 upgraded, 2 newly installed, 0 to remove and 71 not upgraded.

  31. Need to get 1,498 kB of archives.

  32. After this operation, 5,418 kB of additional disk space will be used.

  33. Get:1 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 lynx-common all 2.8.9dev16-1 [873 kB]

  34. Get:2 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 lynx amd64 2.8.9dev16-1 [625 kB]

  35. Fetched 1,498 kB in 12s (120 kB/s)

  36. Selecting previously unselected package lynx-common.

  37. (Reading database ... 441037 files and directories currently installed.)

  38. Preparing to unpack .../lynx-common_2.8.9dev16-1_all.deb ...

  39. Unpacking lynx-common (2.8.9dev16-1) ...

  40. Selecting previously unselected package lynx.

  41. Preparing to unpack .../lynx_2.8.9dev16-1_amd64.deb ...

  42. Unpacking lynx (2.8.9dev16-1) ...

  43. Processing triggers for mime-support (3.60ubuntu1) ...

  44. Processing triggers for doc-base (0.10.7) ...

  45. Processing 1 added doc-base file...

  46. Processing triggers for man-db (2.7.6.1-2) ...

  47. Setting up lynx-common (2.8.9dev16-1) ...

  48. Setting up lynx (2.8.9dev16-1) ...

  49. update-alternatives: using /usr/bin/lynx to provide /usr/bin/www-browser (www-browser) in auto mode

  50. Cleaning old downloads in /tmp

  51. Downloading the kernel's components...

  52. Checksum for linux-headers-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb succeed

  53. Checksum for linux-image-unsigned-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb succeed

  54. Checksum for linux-modules-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb succeed

  55. Downloading the shared kernel header...

  56. Checksum for linux-headers-4.16.7-041607_4.16.7-041607.201805021131_all.deb succeed

  57. Installing Kernel and Headers...

  58. Selecting previously unselected package linux-headers-4.16.7-041607.

  59. (Reading database ... 441141 files and directories currently installed.)

  60. Preparing to unpack .../linux-headers-4.16.7-041607_4.16.7-041607.201805021131_all.deb ...

  61. Unpacking linux-headers-4.16.7-041607 (4.16.7-041607.201805021131) ...

  62. Selecting previously unselected package linux-headers-4.16.7-041607-generic.

  63. Preparing to unpack .../linux-headers-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb ...

  64. Unpacking linux-headers-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  65. Selecting previously unselected package linux-image-unsigned-4.16.7-041607-generic.

  66. Preparing to unpack .../linux-image-unsigned-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb ...

  67. Unpacking linux-image-unsigned-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  68. Selecting previously unselected package linux-modules-4.16.7-041607-generic.

  69. Preparing to unpack .../linux-modules-4.16.7-041607-generic_4.16.7-041607.201805021131_amd64.deb ...

  70. Unpacking linux-modules-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  71. Setting up linux-headers-4.16.7-041607 (4.16.7-041607.201805021131) ...

  72. dpkg: dependency problems prevent configuration of linux-headers-4.16.7-041607-generic:

  73. linux-headers-4.16.7-041607-generic depends on libssl1.1 (>= 1.1.0); however:

  74. Package libssl1.1 is not installed.

  75. Setting up linux-modules-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  76. Setting up linux-image-unsigned-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  77. I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.13.0-39-generic

  78. I: /initrd.img.old is now a symlink to boot/initrd.img-4.13.0-39-generic

  79. I: /vmlinuz is now a symlink to boot/vmlinuz-4.16.7-041607-generic

  80. I: /initrd.img is now a symlink to boot/initrd.img-4.16.7-041607-generic

  81. Processing triggers for linux-image-unsigned-4.16.7-041607-generic (4.16.7-041607.201805021131) ...

  82. /etc/kernel/postinst.d/initramfs-tools:

  83. update-initramfs: Generating /boot/initrd.img-4.16.7-041607-generic

  84. /etc/kernel/postinst.d/zz-update-grub:

  85. Generating grub configuration file ...

  86. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

  87. Found linux image: /boot/vmlinuz-4.16.7-041607-generic

  88. Found initrd image: /boot/initrd.img-4.16.7-041607-generic

  89. Found linux image: /boot/vmlinuz-4.13.0-39-generic

  90. Found initrd image: /boot/initrd.img-4.13.0-39-generic

  91. Found linux image: /boot/vmlinuz-4.13.0-38-generic

  92. Found initrd image: /boot/initrd.img-4.13.0-38-generic

  93. Found linux image: /boot/vmlinuz-4.13.0-37-generic

  94. Found initrd image: /boot/initrd.img-4.13.0-37-generic

  95. Found linux image: /boot/vmlinuz-4.13.0-36-generic

  96. Found initrd image: /boot/initrd.img-4.13.0-36-generic

  97. Found linux image: /boot/vmlinuz-4.13.0-32-generic

  98. Found initrd image: /boot/initrd.img-4.13.0-32-generic

  99. Found linux image: /boot/vmlinuz-4.13.0-17-generic

  100. Found initrd image: /boot/initrd.img-4.13.0-17-generic

  101. Found linux image: /boot/vmlinuz-4.13.0-16-generic

  102. Found initrd image: /boot/initrd.img-4.13.0-16-generic

  103. Found memtest86+ image: /boot/memtest86+.elf

  104. Found memtest86+ image: /boot/memtest86+.bin

  105. done

  106. Thanks for using this script! Hope it helped.

  107. Give it a star: https://github.com/MarauderXtreme/uktools

重新启动系统以激活最新的内核。

  
            
  1. $ sudo shutdown -r now

一旦系统重新启动,重新检查内核版本。

  
            
  1. $ uname -a

  2. Linux ubuntu 4.16.7-041607-generic #201805021131 SMP Wed May 2 15:34:55 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

此 make 命令会将下面的文件放到 /usr/local/bin 目录中。

  
            
  1. do-kernel-upgrade

  2. do-kernel-purge

要移除旧内核,运行以下命令:

  
            
  1. $ do-kernel-purge

  2. Ubuntu Kernel Purge - by Caio Oliveira

  3. This script will only keep three versions: the first and the last two, others will be purge

  4. ---Current version:

  5. Linux Kernel 4.16.7-041607 Generic (linux-image-4.16.7-041607-generic)

  6. ---Versions to remove:

  7. 4.13.0-16

  8. 4.13.0-17

  9. 4.13.0-32

  10. 4.13.0-36

  11. 4.13.0-37

  12. ---Do you want to remove the old kernels/headers versions? (Y/n): y

  13. Reading package lists... Done

  14. Building dependency tree

  15. Reading state information... Done

  16. The following packages were automatically installed and are no longer required:

  17. linux-headers-4.13.0-17 linux-headers-4.13.0-17-generic linux-headers-4.13.0-32 linux-headers-4.13.0-32-generic linux-headers-4.13.0-36 linux-headers-4.13.0-36-generic linux-headers-4.13.0-37

  18. linux-headers-4.13.0-37-generic linux-image-4.13.0-17-generic linux-image-4.13.0-32-generic linux-image-4.13.0-36-generic linux-image-4.13.0-37-generic linux-image-extra-4.13.0-17-generic

  19. linux-image-extra-4.13.0-32-generic linux-image-extra-4.13.0-36-generic linux-image-extra-4.13.0-37-generic

  20. Use 'sudo apt autoremove' to remove them.

  21. The following packages will be REMOVED:

  22. linux-headers-4.13.0-16* linux-headers-4.13.0-16-generic* linux-image-4.13.0-16-generic* linux-image-extra-4.13.0-16-generic*

  23. 0 upgraded, 0 newly installed, 4 to remove and 71 not upgraded.

  24. After this operation, 318 MB disk space will be freed.

  25. (Reading database ... 465582 files and directories currently installed.)

  26. Removing linux-headers-4.13.0-16-generic (4.13.0-16.19) ...

  27. Removing linux-headers-4.13.0-16 (4.13.0-16.19) ...

  28. Removing linux-image-extra-4.13.0-16-generic (4.13.0-16.19) ...

  29. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  30. run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  31. update-initramfs: Generating /boot/initrd.img-4.13.0-16-generic

  32. run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  33. run-parts: executing /etc/kernel/postinst.d/update-notifier 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  34. run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  35. Generating grub configuration file ...

  36. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

  37. Found linux image: /boot/vmlinuz-4.16.7-041607-generic

  38. Found initrd image: /boot/initrd.img-4.16.7-041607-generic

  39. Found linux image: /boot/vmlinuz-4.13.0-39-generic

  40. Found initrd image: /boot/initrd.img-4.13.0-39-generic

  41. Found linux image: /boot/vmlinuz-4.13.0-38-generic

  42. Found initrd image: /boot/initrd.img-4.13.0-38-generic

  43. Found linux image: /boot/vmlinuz-4.13.0-37-generic

  44. Found initrd image: /boot/initrd.img-4.13.0-37-generic

  45. Found linux image: /boot/vmlinuz-4.13.0-36-generic

  46. Found initrd image: /boot/initrd.img-4.13.0-36-generic

  47. Found linux image: /boot/vmlinuz-4.13.0-32-generic

  48. Found initrd image: /boot/initrd.img-4.13.0-32-generic

  49. Found linux image: /boot/vmlinuz-4.13.0-17-generic

  50. Found initrd image: /boot/initrd.img-4.13.0-17-generic

  51. Found linux image: /boot/vmlinuz-4.13.0-16-generic

  52. Found initrd image: /boot/initrd.img-4.13.0-16-generic

  53. Found memtest86+ image: /boot/memtest86+.elf

  54. Found memtest86+ image: /boot/memtest86+.bin

  55. done

  56. Removing linux-image-4.13.0-16-generic (4.13.0-16.19) ...

  57. Examining /etc/kernel/postrm.d .

  58. run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  59. update-initramfs: Deleting /boot/initrd.img-4.13.0-16-generic

  60. run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  61. Generating grub configuration file ...

  62. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

  63. Found linux image: /boot/vmlinuz-4.16.7-041607-generic

  64. Found initrd image: /boot/initrd.img-4.16.7-041607-generic

  65. Found linux image: /boot/vmlinuz-4.13.0-39-generic

  66. Found initrd image: /boot/initrd.img-4.13.0-39-generic

  67. Found linux image: /boot/vmlinuz-4.13.0-38-generic

  68. Found initrd image: /boot/initrd.img-4.13.0-38-generic

  69. Found linux image: /boot/vmlinuz-4.13.0-37-generic

  70. Found initrd image: /boot/initrd.img-4.13.0-37-generic

  71. Found linux image: /boot/vmlinuz-4.13.0-36-generic

  72. Found initrd image: /boot/initrd.img-4.13.0-36-generic

  73. Found linux image: /boot/vmlinuz-4.13.0-32-generic

  74. Found initrd image: /boot/initrd.img-4.13.0-32-generic

  75. Found linux image: /boot/vmlinuz-4.13.0-17-generic

  76. Found initrd image: /boot/initrd.img-4.13.0-17-generic

  77. Found memtest86+ image: /boot/memtest86+.elf

  78. Found memtest86+ image: /boot/memtest86+.bin

  79. done

  80. (Reading database ... 430635 files and directories currently installed.)

  81. Purging configuration files for linux-image-extra-4.13.0-16-generic (4.13.0-16.19) ...

  82. Purging configuration files for linux-image-4.13.0-16-generic (4.13.0-16.19) ...

  83. Examining /etc/kernel/postrm.d .

  84. run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  85. run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-16-generic /boot/vmlinuz-4.13.0-16-generic

  86. Reading package lists... Done

  87. Building dependency tree

  88. Reading state information... Done

  89. .

  90. .

  91. .

  92. .

  93. Reading package lists... Done

  94. Building dependency tree

  95. Reading state information... Done

  96. The following packages will be REMOVED:

  97. linux-headers-4.13.0-37* linux-headers-4.13.0-37-generic* linux-image-4.13.0-37-generic* linux-image-extra-4.13.0-37-generic*

  98. 0 upgraded, 0 newly installed, 4 to remove and 71 not upgraded.

  99. After this operation, 321 MB disk space will be freed.

  100. (Reading database ... 325772 files and directories currently installed.)

  101. Removing linux-headers-4.13.0-37-generic (4.13.0-37.42) ...

  102. Removing linux-headers-4.13.0-37 (4.13.0-37.42) ...

  103. Removing linux-image-extra-4.13.0-37-generic (4.13.0-37.42) ...

  104. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  105. run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  106. update-initramfs: Generating /boot/initrd.img-4.13.0-37-generic

  107. run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  108. run-parts: executing /etc/kernel/postinst.d/update-notifier 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  109. run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  110. Generating grub configuration file ...

  111. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

  112. Found linux image: /boot/vmlinuz-4.16.7-041607-generic

  113. Found initrd image: /boot/initrd.img-4.16.7-041607-generic

  114. Found linux image: /boot/vmlinuz-4.13.0-39-generic

  115. Found initrd image: /boot/initrd.img-4.13.0-39-generic

  116. Found linux image: /boot/vmlinuz-4.13.0-38-generic

  117. Found initrd image: /boot/initrd.img-4.13.0-38-generic

  118. Found linux image: /boot/vmlinuz-4.13.0-37-generic

  119. Found initrd image: /boot/initrd.img-4.13.0-37-generic

  120. Found memtest86+ image: /boot/memtest86+.elf

  121. Found memtest86+ image: /boot/memtest86+.bin

  122. done

  123. Removing linux-image-4.13.0-37-generic (4.13.0-37.42) ...

  124. Examining /etc/kernel/postrm.d .

  125. run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  126. update-initramfs: Deleting /boot/initrd.img-4.13.0-37-generic

  127. run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  128. Generating grub configuration file ...

  129. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

  130. Found linux image: /boot/vmlinuz-4.16.7-041607-generic

  131. Found initrd image: /boot/initrd.img-4.16.7-041607-generic

  132. Found linux image: /boot/vmlinuz-4.13.0-39-generic

  133. Found initrd image: /boot/initrd.img-4.13.0-39-generic

  134. Found linux image: /boot/vmlinuz-4.13.0-38-generic

  135. Found initrd image: /boot/initrd.img-4.13.0-38-generic

  136. Found memtest86+ image: /boot/memtest86+.elf

  137. Found memtest86+ image: /boot/memtest86+.bin

  138. done

  139. (Reading database ... 290810 files and directories currently installed.)

  140. Purging configuration files for linux-image-extra-4.13.0-37-generic (4.13.0-37.42) ...

  141. Purging configuration files for linux-image-4.13.0-37-generic (4.13.0-37.42) ...

  142. Examining /etc/kernel/postrm.d .

  143. run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  144. run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-37-generic /boot/vmlinuz-4.13.0-37-generic

  145. Thanks for using this script!!!

使用以下命令重新检查已安装内核的列表。它将只保留三个旧的内核。

  
            
  1. $ dpkg --list | grep linux-image

  2. ii linux-image-4.13.0-38-generic 4.13.0-38.43 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  3. ii linux-image-4.13.0-39-generic 4.13.0-39.44 amd64 Linux kernel image for version 4.13.0 on 64 bit x86 SMP

  4. ii linux-image-extra-4.13.0-38-generic 4.13.0-38.43 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  5. ii linux-image-extra-4.13.0-39-generic 4.13.0-39.44 amd64 Linux kernel extra modules for version 4.13.0 on 64 bit x86 SMP

  6. ii linux-image-generic 4.13.0.39.42 amd64 Generic Linux kernel image

  7. ii linux-image-unsigned-4.16.7-041607-generic 4.16.7-041607.201805021131 amd64 Linux kernel image for version 4.16.7 on 64 bit x86 SMP

下次你可以调用 do-kernel-upgrade 实用程序来安装新的内核。如果有任何新内核可用,那么它将安装。如果没有,它将报告当前没有可用的内核更新。

  
            
  1. $ do-kernel-upgrade

  2. Kernel up to date. Finishing

再次运行 do-kernel-purge 命令以确认。如果发现超过三个内核,那么它将移除。如果不是,它将报告没有删除消息。

  
            
  1. $ do-kernel-purge

  2. Ubuntu Kernel Purge - by Caio Oliveira

  3. This script will only keep three versions: the first and the last two, others will be purge

  4. ---Current version:

  5. Linux Kernel 4.16.7-041607 Generic (linux-image-4.16.7-041607-generic)

  6. Nothing to remove!

  7. Thanks for using this script!!!


via: https://www.2daygeek.com/uktools-easy-way-to-install-latest-stable-linux-kernel-on-ubuntu-mint-and-derivatives/

作者:Prakash Subramanian[7] 选题:lujun9972 译者:MjSeven 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出


 
Linux中国 更多文章 测试 Node.js,2018 | Linux 中国 三款 Linux 下的 Git 图形客户端 | Linux&nbsp Textricator:让数据提取变得简单 | Linux 中国 Linux 下 cut 命令的 4 个基础实用的示例 | 为什么 Arch Linux 如此“难弄”又有何优劣? | Linux&nbs
猜您喜欢 利器: 用Siege做Web服务器压测 比特币和区块链(0):骗局还是改变命运的科技 猿们,这样去面试,HR妹子会爱上你的! 每日安全动态推送(04-28) hadoop,hbase,hive,zookeeper整合可行性分析及版本确定【续篇】