Debian 9更新到最新的Linux内核

开发者 操作系统1 18,0576字数 683阅读模式

喜欢折腾的同学,会豪气如何升级 Debian Stretch 的内核到新版。遗憾的是现在能搜到的升级 Debian Linux 内核的文章多数是使用Ubuntu的deb安装包,其实这样装上去是有问题,常见的问题是,总会提示需要 apt --fix-broken install

Debian 9更新到最新的Linux内核

这里简单记录一下,如何使用Debian官方源更新到最新的内核;以及如何是用 Kernel.org 的deb源,更新内核到最新的 5.x 版本。

修改更新源

name@debian.cn:~$ echo -e "deb http://http.debian.net/debian stretch-backports main\ndeb-src http://http.debian.net/debian stretch-backports main" | sudo tee /etc/apt/sources.list.d/sources.list

deb http://http.debian.net/debian stretch-backports main
deb-src http://http.debian.net/debian stretch-backports main

更新package

name@debian.cn:~$ sudo apt-get update && sudo apt-get dist-upgrade

安装新版内核镜像

name@debian.cn:~$ sudo apt-cache search linux-image
linux-headers-4.9.0-8-amd64 - Header files for Linux 4.9.0-8-amd64
linux-headers-4.9.0-8-rt-amd64 - Header files for Linux 4.9.0-8-rt-amd64
linux-image-4.9.0-8-amd64 - Linux 4.9 for 64-bit PCs
linux-image-4.9.0-8-amd64-dbg - Debug symbols for linux-image-4.9.0-8-amd64
linux-image-4.9.0-8-rt-amd64 - Linux 4.9 for 64-bit PCs, PREEMPT_RT
linux-image-4.9.0-8-rt-amd64-dbg - Debug symbols for linux-image-4.9.0-8-rt-amd64
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-amd64-dbg - Debugging symbols for Linux amd64 configuration (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
linux-image-rt-amd64-dbg - Debugging symbols for Linux rt-amd64 configuration (meta-package)
linux-headers-4.19.0-0.bpo.2-amd64 - Header files for Linux 4.19.0-0.bpo.2-amd64
linux-headers-4.19.0-0.bpo.2-cloud-amd64 - Header files for Linux 4.19.0-0.bpo.2-cloud-amd64
linux-headers-4.19.0-0.bpo.2-rt-amd64 - Header files for Linux 4.19.0-0.bpo.2-rt-amd64
linux-image-4.19.0-0.bpo.2-amd64-dbg - Debug symbols for linux-image-4.19.0-0.bpo.2-amd64
linux-image-4.19.0-0.bpo.2-amd64-unsigned - Linux 4.19 for 64-bit PCs
linux-image-4.19.0-0.bpo.2-cloud-amd64-dbg - Debug symbols for linux-image-4.19.0-0.bpo.2-cloud-amd64
linux-image-4.19.0-0.bpo.2-cloud-amd64-unsigned - Linux 4.19 for x86-64 cloud
linux-image-4.19.0-0.bpo.2-rt-amd64-dbg - Debug symbols for linux-image-4.19.0-0.bpo.2-rt-amd64
linux-image-4.19.0-0.bpo.2-rt-amd64-unsigned - Linux 4.19 for 64-bit PCs, PREEMPT_RT
...
...
...
name@debian.cn:~$ sudo apt-get install linux-headers-4.19.0-0.bpo.2-amd64 -y

重启使新内核生效

name@debian.cn:~$ sudo reboot
name@debian.cn:~$ sudo apt-get autoremove

到此,我们已成功通过官方安装源,升级内核至最新的 4.19.0 的版本了。另一种方式,是通过 kernel.org 官方提供的安装包,更新到最新的内核。

更新 Kernel.org 提供的内核

在 mirrors.kernel.org 上直接下载deb包,比如当前最新版本为 5.0.0:

name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-image-5.0.0-trunk-all_-amd64_5.0.6-trunk-all__amd64.deb
name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-kbuild-5.0.5.0.6-trunk-all__amd64.deb
name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-5.0.0-trunk-all_-common_5.0.6-trunk-all__all.deb
name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-5.0.0-trunk-all_-amd64_5.0.6-trunk-all__amd64.deb
name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-5.0.0-trunk-all_-all-amd64_5.0.6-trunk-all__amd64.deb
name@debian.cn:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-5.0.0-trunk-all_-all_5.0.6-trunk-all__amd64.deb
name@debian.cn:~$ sudo dpkg -i linux-*.deb

注意文件名可能有差异,在下载时需要注意。最后一步安装后,重启一次,就可以用 dpkg -l | grep linux 看到新安装的 5.0.2 的内核了。

文章末尾固定信息

继续阅读
 
joseph
  • 本文由 joseph 发表于 2019年3月25日
  • 除非特殊声明,本站文章许可协议为"署名-非商用-相同方式共享 4.0",转载请保留原链、作者等信息。
广告也精彩
    • 毫不费力呦
      毫不费力呦 0

      这个教程太好了,找了其他教程都没成功,但是这个就成功了

    匿名

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    拖动滑块以完成验证