我有一个关于 do-release-upgrade 的问题。我的系统安装了以下组件(还有一些其他组件,但这些与问题无关,该服务器的目的是作为我的 Bacula 备份系统的 MySQL 服务器):
- Bacula 客户端
由于它是一台服务器,我特意没有安装 bacula-traymonitor,否则会导致安装与 X11 相关的一系列软件包。在我看来,X11 对服务器环境没有用处,尽管我确实知道某些 X11 库对于一些守护进程(如 opensshd)是必需的,而这些守护进程依赖于 X11 库,这就是为什么其中一些 X11 库可能最终出现在我的安装中。
我刚刚发出了 do-release-upgrade -d(由于某种原因,没有 -d 选项,它仍然没有显示任何版本升级,即使它是在 7 月 24 日之后),我注意到以下情况:bacula-traymonitor 将与整个 X11 内容一起安装,我特别不想在我的服务器上安装这些内容。该软件包不是 bacula 客户端正常运行所必需的,因此它不应该在升级雷达上显示为要安装的软件包。我会将其归类为漏洞。
除了显而易见的方法之外,还有什么方法可以指示 do-release-upgrade 不要安装所有多余的东西,例如 bacula-traymonitor?显而易见的方法是“让 do-release-upgrade 完成其工作,然后删除软件包”,这无疑会在我的系统上留下残留物,例如未使用的 X11 库,在我删除 bacula-traymonitor 后不会自动删除。我还有其他几个系统希望升级到 14.04.1 LTS,并且几乎所有系统都安装了 bacula-client,因此这意味着很多不必要的工作。
详情如下:
Remove (was auto installed) libperl5.14 libsnmp15 xz-lzma
Install: aptitude-common bacula-traymonitor cpp-4.8 crda dh-python
fontconfig fontconfig-config fonts-dejavu-core g++-4.8 gawk gcc-4.8
gcc-4.8-base gcc-4.9-base hicolor-icon-theme init-system-helpers
iproute2 iw kmod libaio1 libapparmor1 libapt-inst1.5
libarchive-extract-perl libasan0 libasprintf0c2 libatk1.0-0
libatk1.0-data libatm1 libatomic1 libaudit-common libaudit1
libavahi-client3 libavahi-common-data libavahi-common3 libbind9-90
libboost-iostreams1.54.0 libcairo2 libcap2-bin libcgmanager0
libck-connector0 libcloog-isl4 libcups2 libdatrie1 libdb5.3 libdbi1
libdebconfclient0 libdns100 libestr0 libfakeroot
libfile-fcntllock-perl libfontconfig1 libgcc-4.8-dev libgck-1-0
libgcr-3-common libgcr-base-3-1 libgdk-pixbuf2.0-0
libgdk-pixbuf2.0-common libgnutls-openssl27 libgraphite2-3
libgssglue1 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common
libharfbuzz0b libisc95 libisccc90 libisccfg90 libisl10 libitm1
libjasper1 libjbig0 libjpeg-turbo8 libjpeg8 libjson-c2 libjson0
libkmod2 libldb1 liblog-message-simple-perl liblwres90
libmodule-pluggable-perl libmpc3 libmpdec2 libntdb1 libnuma1
libpam-cap libpam-systemd libpango-1.0-0 libpangocairo-1.0-0
libpangoft2-1.0-0 libperl5.18 libpixman-1-0 libpod-latex-perl
libpolkit-agent-1-0 libpolkit-backend-1-0 libprocps3
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
libpython3-stdlib libpython3.4-minimal libpython3.4-stdlib
libsasl2-modules-db libsemanage-common libsemanage1 libsepol1
libsigsegv2 libsmbclient libsnmp30 libssh2-1 libstdc++-4.8-dev
libsystemd-daemon0 libsystemd-login0 libtasn1-6 libterm-ui-perl
libtevent0 libtext-soundex-perl libthai-data libthai0 libtiff5
libtirpc1 libtsan0 libudev1 libustr-1.0-1 libxcb-render0
libxcb-shm0 libxcomposite1 libxcursor1 libxdamage1 libxfixes3
libxi6 libxinerama1 libxrandr2 libxrender1 libxtables10
linux-generic linux-headers-generic
linux-image-extra-3.13.0-32-generic linux-image-generic
nagios-plugins-common ncurses-term openssh-sftp-server policykit-1
python-configobj python-ldb python-ntdb python-requests
python-samba python-secretstorage python-six python-talloc
python-tdb python-urllib3 python3 python3-apport python3-apt
python3-commandnotfound python3-dbus python3-distupgrade
python3-gdbm python3-gi python3-minimal python3-problem-report
python3-update-manager python3.4 python3.4-minimal rpcbind run-one
samba-libs shared-mime-info systemd-services systemd-shim
ubuntu-release-upgrader-core wireless-regdb
Upgrade: accountsservice acpid adduser apport apport-symptoms apt
apt-transport-https apt-utils apt-xapian-index aptitude arj at
bacula-client bacula-common bacula-console bacula-doc bacula-fd
base-files base-passwd bash bash-completion bc bind9-host binutils
bsdmainutils bsdutils build-essential busybox-initramfs
busybox-static byobu bzip2 ca-certificates command-not-found
command-not-found-data console-setup coreutils cpio cpp cpp-4.6
cron curl dash dbus debconf debconf-i18n debianutils diffutils dkms
dmidecode dmsetup dnsutils dosfstools dpkg dpkg-dev dstat e2fslibs
e2fsprogs ed eject fakeroot file findutils
fonts-ubuntu-font-family-console ftp fuse g++ g++-4.6 gcc gcc-4.6
gcc-4.6-base geoip-database gettext-base gir1.2-glib-2.0 gnupg gpgv
grep groff-base grub-common grub-pc grub-pc-bin grub2-common gzip
hdparm hostname htop ifupdown info initramfs-tools
initramfs-tools-bin initscripts insserv install-info
installation-report iotop iproute iptables iputils-ping
iputils-tracepath irqbalance isc-dhcp-client isc-dhcp-common
iso-codes joe kbd keyboard-configuration klibc-utils krb5-locales
ksh landscape-common language-pack-en language-pack-en-base
language-selector-common less libaccountsservice0 libacl1
libalgorithm-diff-perl libalgorithm-diff-xs-perl libapt-pkg4.12
libasn1-8-heimdal libattr1 libblkid1 libbsd0 libbz2-1.0 libc-bin
libc-dev-bin libc6 libc6-dev libcap-ng0 libcap2 libclass-isa-perl
libcomerr2 libcurl3 libcurl3-gnutls libcwidget3 libdb5.1
libdbd-mysql-perl libdbi-perl libdbus-1-3 libdbus-glib-1-2
libdevmapper-event1.02.1 libdevmapper1.02.1 libdpkg-perl
libdrm-intel1 libdrm-radeon1 libdrm2 libedit2 libelf1 libept1.4.12
libevent-2.0-5 libexpat1 libffi6 libfreetype6 libfribidi0 libfuse2
libgc1c2 libgcc1 libgcrypt11 libgdbm3 libgeoip1
libgirepository-1.0-1 libglib2.0-0 libgmp10 libgnutls26 libgomp1
libgpg-error0 libgpm2 libgssapi-krb5-2 libgssapi3-heimdal
libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
libhtml-template-perl libhx509-5-heimdal libidn11 libio-string-perl
libiw30 libjs-jquery libk5crypto3 libkeyutils1 libklibc
libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2
liblocale-gettext-perl liblockfile-bin liblockfile1 liblzma5
liblzo2-2 libmagic1 libmount1 libmpfr4 libmysqlclient18 libncurses5
libncurses5-dev libncursesw5 libnewt0.52 libnfnetlink0 libnih-dbus1
libnih1 libnl-3-200 libnl-genl-3-200 libopts25 libp11-kit0
libpam-modules libpam-modules-bin libpam-runtime libpam0g
libparted0debian1 libpcap0.8 libpci3 libpciaccess0 libpcre3
libpcsclite1 libpipeline1 libplymouth2 libpng12-0
libpolkit-gobject-1-0 libpopt0 libpq5 libpython2.7 libquadmath0
libradius1 libreadline5 libreadline6 libroken18-heimdal librtmp0
libsasl2-2 libsasl2-modules libselinux1 libsensors4
libsigc++-2.0-0c2a libslang2 libsnmp-base libsqlite3-0 libss2
libssl1.0.0 libstdc++6 libstdc++6-4.6-dev libsub-name-perl
libtalloc2 libtdb1 libterm-readkey-perl libtext-charwidth-perl
libtext-iconv-perl libtimedate-perl libtinfo-dev libtinfo5
libusb-0.1-4 libusb-1.0-0 libuuid1 libwbclient0 libwind0-heimdal
libwrap0 libx11-6 libx11-data libxapian22 libxau6 libxcb1 libxdmcp6
libxext6 libxml2 libxmuu1 linux-firmware linux-generic-lts-raring
linux-generic-lts-trusty linux-headers-3.13.0-32
linux-headers-3.13.0-32-generic linux-headers-generic-lts-raring
linux-headers-generic-lts-trusty linux-image-3.13.0-32-generic
linux-image-generic-lts-raring linux-image-generic-lts-trusty
linux-libc-dev locales lockfile-progs login logrotate lsb-base
lsb-release lshw lsof ltrace lvm2 m4 make makedev man-db manpages
manpages-dev mawk mc mc-data mdadm memtest86+ mime-support mlocate
module-init-tools mount mountall mtr-tiny multiarch-support
mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server
mysql-server-5.5 mysql-server-core-5.5 mysqltuner
nagios-nrpe-server nagios-plugins nagios-plugins-basic
nagios-plugins-standard nano ncurses-base ncurses-bin ncurses-doc
net-tools netbase netcat-openbsd ntp ntp-doc ntpdate openssh-client
openssh-server openssl os-prober parted passwd patch pciutils perl
perl-base perl-modules plymouth plymouth-theme-ubuntu-text
popularity-contest powermgmt-base ppp pppconfig procmail procps
psmisc python python-apport python-apt python-apt-common
python-chardet python-crypto python-dbus python-dbus-dev
python-debian python-gdbm python-gi python-httplib2 python-keyring
python-launchpadlib python-lazr.restfulclient python-lazr.uri
python-minimal python-newt python-oauth python-openssl python-pam
python-pkg-resources python-problem-report python-serial
python-simplejson python-twisted-bin python-twisted-core
python-wadllib python-xapian python-zope.interface python2.7
python2.7-minimal readline-common resolvconf rsync rsyslog
samba-common samba-common-bin screen sed sendmail sendmail-base
sendmail-bin sendmail-cf sendmail-doc sensible-mda sensible-utils
sgml-base smbclient snmp ssh-import-id strace sudo sysstat sysv-rc
sysvinit-utils tar tasksel tasksel-data tcpd tcpdump telnet time
tmux tzdata ubuntu-keyring ubuntu-minimal ubuntu-standard ucf udev
ufw unzip update-manager-core update-notifier-common upstart
ureadahead usbutils util-linux uuid-runtime vim vim-common
vim-runtime vim-tiny w3m watershed wget whiptail whois
wireless-tools wpasupplicant xauth xfsprogs xkb-data xml-core
xz-utils zlib1g
答案1
问题是do-release-upgrade
和apt-get dist-upgrade
都安装带有依赖项的软件包以及推荐的软件包。因此,您需要仅安装依赖项。
对于 apt-get dist-upgrade:
这个dist-upgrade
过程很简单。默认情况下,apt-get 也会安装推荐的软件包(-s 仅模拟更改):
$ sudo apt-get -s install bacula-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
bacula-common bacula-console bacula-fd bacula-traymonitor
Suggested packages:
bacula-doc kde gnome-desktop-environment
The following NEW packages will be installed:
bacula-client bacula-common bacula-console bacula-fd bacula-traymonitor
而该选项--no-install-recommends
不安装推荐的软件包:
$ sudo apt-get -s --no-install-recommends install bacula-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
bacula-common bacula-console bacula-fd
Suggested packages:
bacula-doc
Recommended packages:
bacula-traymonitor
The following NEW packages will be installed:
bacula-client bacula-common bacula-console bacula-fd
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
因此如果您正在使用apt-get dist-upgrade
,添加该--no-install-recommends
选项就足够了。
对于 do-release-upgrade:
对于do-release-upgrade
,做同样的事情有点棘手。但你仍然可以做到:你需要使用服务器模式,结合编辑文件/etc/apt/apt.conf
。
$ man do-release-upgrade
-m MODE, --mode=MODE
Run in a special upgrade mode. Currently "desktop" for regular upgrades of a desktop system and "server" for server systems are supported.
虽然这个手册页不是很有帮助,但使用-m server
应该会导致不是安装推荐的软件包。相应的逻辑可以在第 677 行找到/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeQuirks.py
。
def ensure_recommends_are_installed_on_desktops(self):
""" ensure that on a desktop install recommends are installed
(LP: #759262)
"""
import apt
if not self.controller.serverMode:
if not apt.apt_pkg.config.find_b("Apt::Install-Recommends"):
msg = "Apt::Install-Recommends was disabled,"
msg += " enabling it just for the upgrade"
logging.warn(msg)
apt.apt_pkg.config.set("Apt::Install-Recommends", "1")
因此,您需要做的就是禁用推荐的软件包。您可以通过添加或编辑/etc/apt/apt.conf
包含以下内容的文件来执行此操作
// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";
然后运行apt-get update
以确保无误。