V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
alvin666
V2EX  ›  问与答

Linux 小白求助内核相关智障问题

  •  
  •   alvin666 · 2019-03-22 20:39:02 +08:00 · 1901 次点击
    这是一个创建于 1860 天前的主题,其中的信息可能已经有所发展或是发生改变。

    以我的 Debian9 最新版为例

    Linux debian-tr 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/ Linux

    需要用到 4.19 内核中的一个驱动支持,但是 apt 仓库里有 4.19 ,所以我 apt install linux-image-4.19.0-0.bpo.2-amd64 安装了 4.19 的内核,重启

    Linux debian-tr 4.19.0-0.bpo.2-amd64 #1 SMP Debian 4.19.16-1~bpo9+1 (2019-02-07) x86_64 GNU/Linux

    但是 linux-headers 还是 4.9 版本,尝试安装的时候提示

    linux-headers-4.19.0-0.bpo.2-rt-amd64 : Depends: linux-compiler-gcc-6-x86 (>= 4.14.17-1~) but 4.9.144-3.1 is to be installed

    然而

    linux-compiler-gcc-6-x86 is already the newest version (4.9.144-3.1).

    所以我现在是 4.9 的内核头,4.19 的内核

    
    root@:~# dpkg --list|grep linux-image
    ii  linux-image-4.19.0-0.bpo.2-amd64      4.19.16-1~bpo9+1                            amd64        Linux 4.19 for 64-bit PCs (signed)
    ii  linux-image-4.9.0-6-amd64             4.9.88-1+deb9u1                             amd64        Linux 4.9 for 64-bit PCs
    ii  linux-image-4.9.0-8-amd64             4.9.144-3.1                                 amd64        Linux 4.9 for 64-bit PCs
    ii  linux-image-amd64                     4.9+80+deb9u6                               amd64        Linux for 64-bit PCs (meta-package)
    root@:~# dpkg --list|grep linux-headers
    ii  linux-headers-4.9.0-6-amd64           4.9.88-1+deb9u1                             amd64        Header files for Linux 4.9.0-6-amd64
    ii  linux-headers-4.9.0-6-common          4.9.88-1+deb9u1                             all          Common header files for Linux 4.9.0-6
    ii  linux-headers-4.9.0-8-amd64           4.9.144-3.1                                 amd64        Header files for Linux 4.9.0-8-amd64
    ii  linux-headers-4.9.0-8-common          4.9.144-3.1                                 all          Common header files for Linux 4.9.0-8
    ii  linux-headers-amd64                   4.9+80+deb9u6                               amd64        Header files for Linux amd64 configuration (meta-package)
    

    apt 还让我 autoremove 掉 4.9 的内核

    The following packages were automatically installed and are no longer required:
      linux-headers-4.9.0-6-amd64 linux-headers-4.9.0-6-common
    Use 'apt autoremove' to remove them.
    
    

    我的操作对吗?该不该删除 4.9 的内核头?现在这样算不算正常?如果不是,我该怎么 fix ?

    8 条回复    2019-03-23 09:52:38 +08:00
    Rasphino
        1
    Rasphino  
       2019-03-22 20:59:09 +08:00 via Android   ❤️ 1
    从 backport 源装 linux-compiler-gcc-6-x86 呗…不过你这样折腾,我觉得还不如直接上 buster 呢
    alvin666
        2
    alvin666  
    OP
       2019-03-22 21:02:43 +08:00 via Android
    @Rasphino 那不装会有问题吗(我现在是没遇见)
    buster 我查了下是下一个 Debian,这个机器跑了些服务,主要是稳定就好,我是为了驱动,才想着升级内核的
    billlee
        3
    billlee  
       2019-03-22 21:30:47 +08:00   ❤️ 1
    @alvin666 #2 不知道你是要内核自带的驱动还是要另外编译内核模块,如果要编译内核模块,linux-header 必须和 linux-image 的版本相同
    alvin666
        4
    alvin666  
    OP
       2019-03-22 21:43:20 +08:00 via Android
    @billlee 需要内核自带的,是一个新出的网卡
    那所以说我如果不用 backport 装 linuxheader,正常使用也没问题?我看编译软件啥的也没问题
    billlee
        5
    billlee  
       2019-03-22 22:16:01 +08:00   ❤️ 1
    @alvin666 #4 没有问题,kernel headers 一般就在编译内核模块或者 libc 的时候需要。编译其它软件只需要 libc 的 headers
    Rasphino
        6
    Rasphino  
       2019-03-22 23:19:12 +08:00 via Android   ❤️ 1
    header 最常用来编译内核 dkms 模块…如果你不用 dkms 的话,不装问题也不大
    x1596357
        7
    x1596357  
       2019-03-23 09:29:22 +08:00 via iPhone   ❤️ 1
    apt 你要指定从 backports 装才搜索到你对应 4.19 的包
    alvin666
        8
    alvin666  
    OP
       2019-03-23 09:52:38 +08:00 via Android
    @x1596357 但是我感觉很迷的是官方仓库里面有 4.19 的内核,没有 4.19 的头...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1121 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:56 · PVG 06:56 · LAX 15:56 · JFK 18:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.