OpenVZ 容器中的 Ubuntu 14.04:apt 尝试升级内核

OpenVZ 容器中的 Ubuntu 14.04:apt 尝试升级内核

如何阻止 Ubuntu 尝试升级内核?

我的主机的底层 OpenVZ 架构提供了这个内核:

$ uname -r
2.6.32-042stab116.2

我的理解是,这超出了我的控制范围。然而,每次我这样做的时候:

$ sudo aptitude update && sudo aptitude safe-upgrade

我看到 Ubuntu 尝试升级(但失败了)。我现在有几个软件包处于部分安装状态:

$ dpkg -l |grep linux

ii  libselinux1:i386                     2.2.2-1ubuntu0.1                     i386         SELinux runtime shared libraries
ii  linux-firmware                       1.127.22                             all          Firmware for Linux kernel drivers
iU  linux-generic                        3.13.0.101.109                       i386         Complete Generic Linux kernel and headers
ii  linux-headers-3.13.0-100             3.13.0-100.147                       all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-100-generic     3.13.0-100.147                       i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-3.13.0-101             3.13.0-101.148                       all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-101-generic     3.13.0-101.148                       i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-3.13.0-91              3.13.0-91.138                        all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-91-generic      3.13.0-91.138                        i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-3.13.0-92              3.13.0-92.139                        all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-92-generic      3.13.0-92.139                        i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-3.13.0-93              3.13.0-93.140                        all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-93-generic      3.13.0-93.140                        i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-3.13.0-96              3.13.0-96.143                        all          Header files related to Linux kernel version 3.13.0
ii  linux-headers-3.13.0-96-generic      3.13.0-96.143                        i386         Linux kernel headers for version 3.13.0 on 32 bit x86 SMP
ii  linux-headers-generic                3.13.0.101.109                       i386         Generic Linux kernel headers
iF  linux-image-3.13.0-100-generic       3.13.0-100.147                       i386         Linux kernel image for version 3.13.0 on 32 bit x86 SMP
iF  linux-image-3.13.0-101-generic       3.13.0-101.148                       i386         Linux kernel image for version 3.13.0 on 32 bit x86 SMP
iF  linux-image-3.13.0-92-generic        3.13.0-92.139                        i386         Linux kernel image for version 3.13.0 on 32 bit x86 SMP
iF  linux-image-3.13.0-93-generic        3.13.0-93.140                        i386         Linux kernel image for version 3.13.0 on 32 bit x86 SMP
iF  linux-image-3.13.0-96-generic        3.13.0-96.143                        i386         Linux kernel image for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-extra-3.13.0-100-generic 3.13.0-100.147                       i386         Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-extra-3.13.0-101-generic 3.13.0-101.148                       i386         Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-extra-3.13.0-92-generic  3.13.0-92.139                        i386         Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-extra-3.13.0-93-generic  3.13.0-93.140                        i386         Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-extra-3.13.0-96-generic  3.13.0-96.143                        i386         Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
iU  linux-image-generic                  3.13.0.101.109                       i386         Generic Linux kernel image
ii  linux-libc-dev:i386                  3.13.0-101.148                       i386         Linux Kernel Headers for development
ii  syslinux                             3:4.05+dfsg-6+deb8u1                 i386         collection of boot loaders
ii  syslinux-common                      3:4.05+dfsg-6+deb8u1                 all          collection of boot loaders (common files)
ii  util-linux                           2.20.1-5.1ubuntu20.7                 i386         Miscellaneous system utilities

为了完整起见,我正在运行一个非常相似的 OpenVZ 容器(同一个托管),它不是显示同样的问题:

$ uname -r
2.6.32-042stab116.2

$ dpkg -l |grep linux
ii  libselinux1:i386                  2.2.2-1ubuntu0.1                     i386         SELinux runtime shared libraries
ii  libv4l-0:i386                     1.0.1-1                              i386         Collection of video4linux support libraries
ii  libv4lconvert0:i386               1.0.1-1                              i386         Video4linux frame format conversion library
ii  linux-libc-dev:i386               3.13.0-101.148                       i386         Linux Kernel Headers for development
ii  syslinux                          3:4.05+dfsg-6+deb8u1                 i386         collection of boot loaders
ii  syslinux-common                   3:4.05+dfsg-6+deb8u1                 all          collection of boot loaders (common files)
ii  util-linux                        2.20.1-5.1ubuntu20.7                 i386         Miscellaneous system utilities

如您所见,dpkg两台机器上都没有列出实际的内核,但只有前者引入了这些较新的、不需要的内核。后者的升级工作一直很顺利。

更新

为了删除半安装的软件包,看到这个问题

答案1

  • fkraiem 的回答已经解释了为什么无法从客户容器更新正在运行的内核。

  • 为了防止内核更新,你必须卸载它的

    sudo apt-get purge linux-generic linux-image-generic linux-headers-generic
    

答案2

您安装了一些内核映像包(以 开头的包linux-image),并且与所有其他包一样,当存储库中有新版本可用时,包管理器会升级它们。

但是,对于您而言,内核由主机提供,已安装的内核包完全被忽略。在这种情况下,卸载它们是很自然的;包管理器可能会抱怨您没有安装内核包,因为这通常是不受欢迎的,但对于您而言,这完全没问题。

或者,保持它们的安装和升级不会造成任何损害(除了占用磁盘空间),因为它们无论如何都不会被使用。

相关内容