如何升级 Linux 内核 4.0.2?

如何升级 Linux 内核 4.0.2?

我按照从源代码更新内核 4.0.2 的步骤进行操作 如何安装/升级 Linux 内核最后出现这个错误。

    root@surfer:/home/algosig# sudo dpkg -i linux-headers-4.0.2*.deb linux-image-4.0.2*.deb
    (Reading database ... 621608 files and directories currently installed.)
    Preparing to unpack linux-headers-4.0.2-040002_4.0.2-040002.201505081529_all.deb ...
    Unpacking linux-headers-4.0.2-040002 (4.0.2-040002.201505081529) over (4.0.2-040002.201505081529) ...
    Preparing to unpack linux-headers-4.0.2-040002-generic_4.0.2-040002.201505081529_i386.deb ...
    Unpacking linux-headers-4.0.2-040002-generic (4.0.2-040002.201505081529) over (4.0.2-040002.201505081529) ...
    Selecting previously unselected package linux-image-4.0.2-040002-generic.
    Preparing to unpack linux-image-4.0.2-040002-generic_4.0.2-040002.201505081529_i386.deb ...
    Done.
    Unpacking linux-image-4.0.2-040002-generic (4.0.2-040002.201505081529) ...
    dpkg-deb (subprocess): cannot copy archive member from 'linux-image-4.0.2-040002-generic_4.0.2-040002.201505081529_i386.deb' to decompressor pipe: unexpected end of file or stream
    dpkg-deb (subprocess): decompressing archive member: internal bzip2 read error: 'UNEXPECTED_EOF'
    dpkg-deb: error: subprocess <decompress> returned error exit status 2
    dpkg: error processing archive linux-image-4.0.2-040002-generic_4.0.2-040002.201505081529_i386.deb (--install):
     cannot copy extracted data for './boot/vmlinuz-4.0.2-040002-generic' to '/boot/vmlinuz-4.0.2-040002-generic.dpkg-new': unexpected end of file or stream
    Examining /etc/kernel/postrm.d .
    run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.0.2-040002-generic /boot/vmlinuz-4.0.2-040002-generic
    run-parts: executing /etc/kernel/postrm.d/zz-extlinux 4.0.2-040002-generic /boot/vmlinuz-4.0.2-040002-generic
    P: Checking for EXTLINUX directory... found.
    P: Writing config for /boot/vmlinuz-3.13.0-52-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-51-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-48-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-46-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-45-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-44-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-43-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-40-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-39-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-37-generic...
    P: Writing config for /boot/vmlinuz-3.13.0-35-generic...
    P: Installing debian theme... done.
    run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.0.2-040002-generic /boot/vmlinuz-4.0.2-040002-generic
    Setting up linux-headers-4.0.2-040002 (4.0.2-040002.201505081529) ...
    Setting up linux-headers-4.0.2-040002-generic (4.0.2-040002.201505081529) ...
    Examining /etc/kernel/header_postinst.d.
    run-parts: executing /etc/kernel/header_postinst.d/dkms 4.0.2-040002-generic /boot/vmlinuz-4.0.2-040002-generic
    ERROR (dkms apport): kernel package linux-headers-4.0.2-040002-generic is not supported
    Error! Bad return status for module build on kernel: 4.0.2-040002-generic (i686)
    Consult /var/lib/dkms/virtualbox/4.3.10/build/make.log for more information.
    Errors were encountered while processing:
     linux-image-4.0.2-040002-generic_4.0.2-040002.201505081529_i386.deb

这是日志文件:

DKMS make.log for virtualbox-4.3.10 for kernel 4.0.2-040002-generic (i686)
Sun May 10 18:54:43 NPT 2015
make: Entering directory `/usr/src/linux-headers-4.0.2-040002-generic'
  LD      /var/lib/dkms/virtualbox/4.3.10/build/built-in.o
  LD      /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/built-in.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/linux/SUPDrv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/SUPDrv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/SUPDrvSem.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/SUPDrvTracer.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/alloc-r0drv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/initterm-r0drv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/memobj-r0drv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/mpnotification-r0drv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/powernotification-r0drv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/assert-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/initterm-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/memuserkernel-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/mp-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/mpnotification-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/process-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/semevent-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/semeventmulti-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/semfastmutex-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/semmutex-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/spinlock-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/thread-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/thread2-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/threadctxhooks-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/time-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/timer-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/generic/semspinmutex-r0drv-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/alloc/alloc.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/checksum/crc32.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/checksum/ipv4.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/checksum/ipv6.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/err/RTErrConvertFromErrno.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/err/RTErrConvertToErrno.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/log.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/logellipsis.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/logrel.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/logrelellipsis.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/logcom.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/log/logformat.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg1Weak.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2Add.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2AddWeak.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2AddWeakV.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2Weak.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/RTAssertMsg2WeakV.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/assert.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/handletable.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/handletablectx.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/misc/thread.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/RTStrCopy.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/RTStrCopyEx.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/RTStrCopyP.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/RTStrNCmp.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/RTStrNLen.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/stringalloc.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/strformat.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/strformatrt.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/strformattype.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/strprintf.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/string/strtonum.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/table/avlpv.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/common/time/time.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/r0drv/linux/RTLogWriteDebugger-r0drv-linux.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTAssertShouldPanic-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTLogWriteStdErr-stub-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTLogWriteStdOut-stub-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTLogWriteUser-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTMpGetArraySize-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTMpGetCoreCount-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTSemEventWait-2-ex-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTSemEventWaitNoResume-2-ex-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTSemEventMultiWait-2-ex-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTSemEventMultiWaitNoResume-2-ex-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/RTTimerCreate-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/errvars-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/mppresent-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/generic/uuid-generic.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/VBox/log-vbox.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/math/gcc/divdi3.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/math/gcc/moddi3.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/math/gcc/qdivrem.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/math/gcc/udivdi3.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/math/gcc/umoddi3.o
  LD [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxdrv/vboxdrv.o
  LD      /var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/built-in.o
  CC [M]  /var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.o
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c: In function ‘vboxNetAdpOsCreate’:
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c:186:48: error: macro "alloc_netdev" requires 4 arguments, but only 3 given
                            vboxNetAdpNetDevInit);
                                                ^
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: error: ‘alloc_netdev’ undeclared (first use in this function)
     pNetDev = alloc_netdev(sizeof(VBOXNETADPPRIV),
               ^
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: note: each undeclared identifier is reported only once for each function it appears in
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c: At top level:
/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.c:159:13: warning: ‘vboxNetAdpNetDevInit’ defined but not used [-Wunused-function]
 static void vboxNetAdpNetDevInit(struct net_device *pNetDev)
             ^
make[2]: *** [/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp/linux/VBoxNetAdp-linux.o] Error 1
make[1]: *** [/var/lib/dkms/virtualbox/4.3.10/build/vboxnetadp] Error 2
make: *** [_module_/var/lib/dkms/virtualbox/4.3.10/build] Error 2
make: Leaving directory `/usr/src/linux-headers-4.0.2-040002-generic'

有人可以说明一下升级 Linux 内核的步骤吗?

答案1

有一个非常有用的脚本叫做内核更新。它是葡萄牙语的,但非常简单。首先,打开终端(Ctrl+Alt+T)并安装 Lynx(文本浏览器):

sudo apt-get install lynx

然后运行此命令下载脚本:

wget https://www.dropbox.com/s/fwkeja3cijdbk7l/kernel-update

使用 chmod 更改其权限:

chmod +x kernel-update

现在,你可以随时使用以下命令更新内核并运行此脚本

sudo ./kernel-update

它是巴西葡萄牙语,但是...

1)单击A以验证/安装新内核

2)点击B删除旧内核

3)单击Q退出。

好吧,不要忘记在终端中运行:

sudo update-initramfs -u

更新 Linux 映像和

sudo update-grub 

这样 GRUB 就会识别新的内核。

希望能帮助到你!

编辑:我从这里获得这个教程网站。

相关内容