如何阻止Linux升级内核(以Ubuntu为例)

阿里说

这个咱们的Linux系统是我们优化的,支持从底层虚拟化哒,你要是内核给我乱升级,会不稳定哒

那怎么也不给Ubuntu的示范过程呢(摊手)为什么人家内核升级你也不跟进呢

系统内核就那几个linux开头的几个包,所以只要阻止那几个包升级就可以了

apt-mark showauto
apt-mark showmanual

在上两条命令得到的列表中找到所有linux开头的包
然后

apt-mark hold linux-firmware linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic linux-headers-3.13.0-65 linux-headers-3.13.0-65-generic linux-headers-3.13.0-86 linux-headers-3.13.0-86-generic linux-image-3.13.0-32-generic linux-image-3.13.0-65-generic linux-image-3.13.0-86-generic linux-image-extra-3.13.0-65-generic linux-image-extra-3.13.0-86-generic linux-libc-dev linux-generic linux-headers-generic linux-image-generic linux-image-generic-lts-trusty

后面跟的一票linux开头的包存在个体差异请务必自行列表查找
没有apt-mark hold之前
使用apt-get dist-upgrade有

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-3.13.0-97 linux-headers-3.13.0-97-generic
  linux-image-3.13.0-97-generic linux-image-extra-3.13.0-97-generic
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apt apt-transport-https apt-utils
  base-files bash-completion bind9-host dnsutils dosfstools dpkg dpkg-dev
  gir1.2-gdkpixbuf-2.0 gnupg gpgv grub-common grub-pc grub-pc-bin grub2-common
  initramfs-tools initramfs-tools-bin isc-dhcp-client isc-dhcp-common
  klibc-utils language-pack-en language-pack-en-base language-pack-gnome-en
  language-pack-gnome-en-base libapache2-mod-php5 libapt-inst1.5
  libapt-pkg4.12 libavahi-common-data libbind9-90 libc-bin libc-dev-bin libc6
  libc6-dev libcurl3 libcurl3-gnutls libdns100 libdpkg-perl libgcrypt11
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgdk-pixbuf2.0-dev
  libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b libidn11
  libisc95 libisccc90 libisccfg90 libklibc liblwres90 libmysqlclient-dev
  libmysqlclient18 libnspr4 libnss3 libnss3-nssdb libpq-dev libpq5
  libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib
  libssl-dev libssl-doc libssl1.0.0 libtasn1-6 libupnp6 libupnp6-dev libxml2
  linux-generic linux-headers-3.13.0-86 linux-headers-3.13.0-86-generic
  linux-headers-generic linux-image-3.13.0-86-generic
  linux-image-extra-3.13.0-86-generic linux-image-generic
  linux-image-generic-lts-trusty linux-libc-dev lsb-base lsb-release
  multiarch-support mysql-client mysql-client-5.5 mysql-client-core-5.5
  mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 nscd
  openssh-client openssh-server openssh-sftp-server openssl php5 php5-cli
  php5-common php5-curl php5-gd php5-mysql php5-readline
  python3-update-manager python3.4 python3.4-dev python3.4-minimal tzdata
  tzdata-java update-manager-core wget
113 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 191 MB of archives.
After this operation, 272 MB of additional disk space will be used.
Do you want to continue? [Y/n]

用完之后就会

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic linux-headers-3.13.0-86 linux-headers-3.13.0-86-generic
  linux-headers-generic linux-image-3.13.0-86-generic
  linux-image-extra-3.13.0-86-generic linux-image-generic
  linux-image-generic-lts-trusty linux-libc-dev
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apt apt-transport-https apt-utils
  base-files bash-completion bind9-host dnsutils dosfstools dpkg dpkg-dev
  gir1.2-gdkpixbuf-2.0 gnupg gpgv grub-common grub-pc grub-pc-bin grub2-common
  initramfs-tools initramfs-tools-bin isc-dhcp-client isc-dhcp-common
  klibc-utils language-pack-en language-pack-en-base language-pack-gnome-en
  language-pack-gnome-en-base libapache2-mod-php5 libapt-inst1.5
  libapt-pkg4.12 libavahi-common-data libbind9-90 libc-bin libc-dev-bin libc6
  libc6-dev libcurl3 libcurl3-gnutls libdns100 libdpkg-perl libgcrypt11
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgdk-pixbuf2.0-dev
  libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b libidn11
  libisc95 libisccc90 libisccfg90 libklibc liblwres90 libmysqlclient-dev
  libmysqlclient18 libnspr4 libnss3 libnss3-nssdb libpq-dev libpq5
  libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib
  libssl-dev libssl-doc libssl1.0.0 libtasn1-6 libupnp6 libupnp6-dev libxml2
  lsb-base lsb-release multiarch-support mysql-client mysql-client-5.5
  mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5
  mysql-server-core-5.5 nscd openssh-client openssh-server openssh-sftp-server
  openssl php5 php5-cli php5-common php5-curl php5-gd php5-mysql php5-readline
  python3-update-manager python3.4 python3.4-dev python3.4-minimal tzdata
  tzdata-java update-manager-core wget
104 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Need to get 67.4 MB of archives.
After this operation, 290 kB of additional disk space will be used.
Do you want to continue? [Y/n] 

arc_u_06e84236fc18b4a2233b110a0b73280ed6ed33cf_20140704134053

当然啦想要撤销“The following packages have been kept back”所列的这些包,简单的apt-mark unhold就行了。

留下评论