仅保留基本软件包


16

为了了解有关Ubuntu及其软件包的更多信息,我想删除所有非必需的软件包,以便可以在需要时安装所需的组件,并知道它们的作用。

我正在使用命令dpkg --clear-selectionsapt-get dselect-upgrade为此。我还通过设置再次安装apt libstdc++6 (due to apt) install-info (due to grep)来稍微修改选择(以某种方式dpkg认为它们不是必需的,但是apt-get抱怨)。

可以吗,还是不好?如果可以,我该如何处理dpkg中状态为“ deinstall”的大量软件包?

另外,我在VPS模板上执行此操作,因此无法控制最初安装的软件包。

Answers:


18

使用以下命令,您可以获得按优先级分类的已安装软件包的列表:

dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1

Debian策略手册中给出了优先级的描述。

在我的安装中,获得以下内容(我仅显示必需的重要的标准的软件包):

apt                                     important
aptitude                                important
apt-utils                               important
bsdmainutils                            important
cron                                    important
debconf-i18n                            important
dmidecode                               important
gnupg                                   important
gpgv                                    important
groff-base                              important
info                                    important
install-info                            important
iptables                                important
iputils-ping                            important
isc-dhcp-client                         important
isc-dhcp-common                         important
libapt-inst1.3                          important
libapt-pkg4.11                          important
libboost-iostreams1.46.1                important
libcwidget3                             important
libept1                                 important
libgdbm3                                important
libgdbm3                                important
libgudev-1.0-0                          important
libnewt0.52                             important
libpcre3                                important
libpipeline1                            important
libpopt0                                important
libreadline6                            important
libssl1.0.0                             important
libsysfs2                               important
libusb-0.1-4                            important
libxapian22                             important
logrotate                               important
man-db                                  important
manpages                                important
medibuntu-keyring                       important
nano                                    important
netbase                                 important
net-tools                               important
python                                  important
readline-common                         important
rsyslog                                 important
ubuntu-extras-keyring                   important
ubuntu-keyring                          important
vim-common                              important
vim-tiny                                important
wget                                    important
whiptail                                important
adduser                                 required
base-files                              required
base-passwd                             required
bash                                    required
bsdutils                                required
busybox-initramfs                       required
coreutils                               required
cpio                                    required
dash                                    required
debconf                                 required
debianutils                             required
diffutils                               required
dpkg                                    required
e2fslibs                                required
e2fsprogs                               required
findutils                               required
gcc-4.6-base                            required
gcc-4.6-base                            required
grep                                    required
gzip                                    required
hostname                                required
ifupdown                                required
initscripts                             required
insserv                                 required
iproute                                 required
klibc-utils                             required
libacl1                                 required
libacl1                                 required
libattr1                                required
libattr1                                required
libblkid1                               required
libbz2-1.0                              required
libc6                                   required
libc6                                   required
libc-bin                                required
libcomerr2                              required
libcomerr2                              required
libdb5.1                                required
libdbus-1-3                             required
libdevmapper1.02.1                      required
libdrm2                                 required
libdrm-intel1                           required
libdrm-nouveau1a                        required
libdrm-radeon1                          required
libffi6                                 required
libgcc1                                 required
libgcc1                                 required
libglib2.0-0                            required
libklibc                                required
liblocale-gettext-perl                  required
liblzma2                                required
libmount1                               required
libncurses5                             required
libncursesw5                            required
libnih1                                 required
libnih-dbus1                            required
libpam0g                                required
libpam-modules                          required
libpam-modules-bin                      required
libpam-runtime                          required
libpciaccess0                           required
libpcre3                                required
libplymouth2                            required
libpng12-0                              required
libselinux1                             required
libselinux1                             required
libslang2                               required
libss2                                  required
libssl1.0.0                             required
libstdc++6                              required
libstdc++6                              required
libtext-charwidth-perl                  required
libtext-iconv-perl                      required
libtext-wrapi18n-perl                   required
libtinfo5                               required
libudev0                                required
libuuid1                                required
libuuid1                                required
locales                                 required
login                                   required
lsb-base                                required
lzma                                    required
makedev                                 required
mawk                                    required
module-init-tools                       required
mount                                   required
mountall                                required
multiarch-support                       required
ncurses-base                            required
ncurses-bin                             required
passwd                                  required
perl-base                               required
plymouth                                required
procps                                  required
python2.7-minimal                       required
python-minimal                          required
sed                                     required
sensible-utils                          required
sysvinit-utils                          required
sysv-rc                                 required
tar                                     required
tzdata                                  required
udev                                    required
upstart                                 required
ureadahead                              required
util-linux                              required
xz-utils                                required
zlib1g                                  required
zlib1g                                  required
at                                      standard
bash-completion                         standard
bc                                      standard
bind9-host                              standard
dc                                      standard
dnsutils                                standard
file                                    standard
ftp                                     standard
gettext-base                            standard
less                                    standard
libbind9-60                             standard
libcap2                                 standard
libdb5.1                                standard
libdns69                                standard
libedit2                                standard
libevent-2.0-5                          standard
libgc1c2                                standard
libgcrypt11                             standard
libgcrypt11                             standard
libgnutls26                             standard
libgnutls26                             standard
libgpg-error0                           standard
libgpg-error0                           standard
libgpm2                                 standard
libgssapi-krb5-2                        standard
libgssapi-krb5-2                        standard
libidn11                                standard
libidn11                                standard
libisc62                                standard
libk5crypto3                            standard
libk5crypto3                            standard
libkeyutils1                            standard
libkeyutils1                            standard
libkrb5-3                               standard
libkrb5-3                               standard
libkrb5support0                         standard
libkrb5support0                         standard
libldap-2.4-2                           standard
libldap-2.4-2                           standard
liblockfile1                            standard
liblwres60                              standard
libmagic1                               standard
libpci3                                 standard
libsasl2-2                              standard
libsasl2-2                              standard
libsqlite3-0                            standard
libsqlite3-0                            standard
libtasn1-3                              standard
libtasn1-3                              standard
libxml2                                 standard
lsof                                    standard
m4                                      standard
make                                    standard
mime-support                            standard
mlocate                                 standard
openssh-client                          standard
patch                                   standard
pciutils                                standard
perl                                    standard
perl-modules                            standard
python-apt                              standard
python-central                          standard
telnet                                  standard
time                                    standard
ucf                                     standard
wamerican                               standard
whois                                   standard

基本系统被定义为仅含有系统需要重要的软件包。

标记为标准的软件包并不是操作系统所必需的,但是如果您错过它们,则会遇到麻烦。

因此,要删除所有不需要的软件包(optionalextra),可以执行以下命令:

sudo apt-get --simulate purge $(dpkg-query -Wf '${Package;-40}${Priority}\n' | 
    awk '$2 ~ /optional|extra/ { print $1 }')

我添加了--simulate安全性选项,然后查看apt提示。

奇怪的是,它要求也删除了一些必需的程序包:e2fsprogsutil-linuxhostnameupstart,所以需要重新安装这些程序包。我会提前下载软件包(apt-get download <packages>),以避免以后出现网络问题。

另请注意,要使Wifi正常工作,您可能需要一些可选额外的包装,请在上述步骤中将其删除。


3

更新2019-02-26

实际上,在来自不同提供商的大量ubuntu VPS上……我发现原始方法(如下)非常脆弱。在某些系统上,它们将不会重新启动,因为以下方法将删除KVM类型虚拟化上的内核(而openvz则大多数情况下起作用)。我寻找的不是替代每次破解都修补补丁的方法,而是寻找一种替代方法。

一种似乎(到目前为止)更好的方法如下:

# just in case we are retrying and apt is in a bad state
dpkg --configure -a

# DEBIAN_FRONTEND=noninteractive is useful for scripting. 
# prevents getting prompts that will hang our script.

# ubuntu-minimal is a meta package that depends on the packages 
# in ubuntu-minimal install.
# Need aptitude to autoremove everything we don't depend on.
DEBIAN_FRONTEND=noninteractive \
  apt-get --assume-yes install aptitude ubuntu-minimal

# mark all packages as automatically installed except
# ubuntu-minimal, kernel, systemd and openssh.
# For some reason systemd isn't part of ubuntu-minimal.
# Any dependencies of these four packages will be kept.
# All others that aren't dependencies will be removed since
# we have told apt they are automatically installed 
# (ie we don't care about them unless we need them as a dep)
DEBIAN_FRONTEND=noninteractive \
  aptitude --assume-yes markauto \
    '~i!?name(ubuntu-minimal~|linux-generic~|systemd~|openssh-server)'

# purge all removed packages that were not purged.
# removes leftover config/cruft.
DEBIAN_FRONTEND=noninteractive \
  aptitude --assume-yes purge '~c'

到目前为止,这在我对openvz和kvm类型虚拟化的测试中都非常有效。我将其用作第一步“引导”,以最小化映像,然后运行配置管理以所需方式设置VPS。我通常会在此步骤之后和配置管理之前进行重新启动,以确保我们没有破坏任何东西。

我没有进行apt清理或自动清理,因为我的配置管理将安装软件包,因此无论如何我都必须再次运行apt-get update。如果您试图在磁盘空间方面构建最小的映像,那么当然您可以做更多的事情。

如果在最小化后丢失DNS解析,还有一个提示...在Ubuntu 16.04上,安装ubuntu-minimal已安装的resolvconf,由于某种原因之前未安装过。该软件包(安装后)将确保将/etc/resolv.conf设置为动态生成,并且包括将其转换为符号链接。如果您的VPS具有静态网络配置(即,在/ etc / network / interfaces中静态配置的接口/ IP和在/etc/resolv.conf中静态配置的DNS),那么这将破坏您的dns分辨率。也就是说,您将能够ping 8.8.8.8,但不能google.com(未知主机)。我有几个VPS提供商以这种方式配置VPS,而不是通过dhcp提供IP / DNS。要解决此问题,我在上述最小化之前添加了一个检查,如下所示:

if [ ! -L "/etc/resolv.conf" ]; then
  mkdir -p /etc/resolvconf/resolv.conf.d/
  cp /etc/resolv.conf /etc/resolvconf/resolv.conf.d/tail
fi

基本上:如果当前的/etc/resolv.conf不是符号链接,则假定我们具有来自VPS提供程序的静态配置。将文件复制到用于resolvconf的特殊“ tail”文件中。“ tail”文件是一个特殊的文件,resolvconf将附加到它生成的/etc/resolv.conf中。这样可以确保您不会丢失内置在VPS中的静态DNS配置。

原始答案

跟随@enzotib的答案...

奇怪的是,必需/重要/基本包将具有可选/额外的依赖关系。会认为,如果那些是硬性依赖关系(与推荐或建议相反),那么那些依赖关系也将被设置为依赖于它们的软件包的最高优先级。

在Ubuntu 16.04上,尝试@enzotib的方法时,在删除列表中出现了很多重要的软件包(apt,sudo,passwd,adduser)。恶意黑客使用脚本逐个清除了可选/额外软件包列表,以查看哪些可选/额外软件包清除触发了删除必需或重要软件包的操作。

例如:就我而言,清除可选软件包libaudit1将清除许多重要内容。

root@ro01:~# apt-get purge libaudit1
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  anacron bind9-host build-essential cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc
  gcc-5 gcc-5-base initramfs-tools-bin libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libapt-pkg5.0 libasan2
  libatomic1 libbind9-140 libc-dev-bin libc6 libc6-dev libcc1-0 libcilkrts5
  libdns162 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-5-dev
  libgomp1 libisc160 libisccc140 libisccfg140 libisl15 libitm1 liblsan0
  liblwres141 libmpc3 libmpx0 libquadmath0 libstdc++-5-dev libstdc++6 libtsan0
  libubsan0 libudev1 linux-libc-dev logrotate manpages-dev samba-common
Suggested packages:
  default-mta | mail-transport-agent powermgmt-base cpp-doc gcc-5-locales
  debian-keyring g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg
  gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-5-multilib
  libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg
  liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg
  libquadmath0-dbg glibc-doc libstdc++-5-doc mailx
Recommended packages:
  cron | cron-daemon rsyslog | system-log-daemon apt samba-common-bin
The following packages will be REMOVED:
  adduser* apache2* apache2-bin* apache2-utils* apt* apt-utils* aptitude*
  bind9* bsd-mailx* cron* dbus* dmsetup* fetchmail* ifupdown* initramfs-tools*
  initramfs-tools-core* initscripts* libapr1* libaprutil1*
  libaprutil1-dbd-sqlite3* libaprutil1-ldap* libaudit1* libblkid1*
  libcryptsetup4* libfdisk1* libmount1* libpam-modules* libpam-modules-bin*
  libpam-runtime* libpam0g* libsemanage1* libuuid1* libxapian22v5* login*
  mlocate* mount* mountall* openssh-client* openssh-server*
  openssh-sftp-server* passwd* plymouth* postfix* procps* python-samba*
  rpcbind* rsyslog* samba* samba-common-bin* samba-libs* sasl2-bin* screen*
  ssl-cert* sudo* systemd* systemd-sysv* udev* util-linux* uuid-runtime* wget*
The following NEW packages will be installed:
  anacron build-essential cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libasan2 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libgcc-5-dev libisl15 libitm1 liblsan0
  libmpc3 libmpx0 libquadmath0 libstdc++-5-dev libtsan0 libubsan0
  linux-libc-dev manpages-dev
The following packages will be upgraded:
  bind9-host gcc-5-base initramfs-tools-bin libapt-pkg5.0 libbind9-140 libc6
  libdns162 libgomp1 libisc160 libisccc140 libisccfg140 liblwres141 libstdc++6
  libudev1 logrotate samba-common
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt adduser (due to apt) login libaudit1 (due to login)
  libpam0g (due to login) libpam-runtime (due to login)
  libpam-modules (due to login) mount libblkid1 (due to mount)
  libmount1 (due to mount) util-linux libfdisk1 (due to util-linux)
  libuuid1 (due to util-linux)
16 upgraded, 34 newly installed, 60 to remove and 124 not upgraded.
Need to get 41.1 MB of archives.
After this operation, 12.4 MB of additional disk space will be used.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?] Abort.

同样有趣的是,aptitude whyapt-cache rdepends显示出如此不同的结果。

root@ro01:~# dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1 | grep 'libaudit1'
libaudit1                               optional

root@ro01:~# aptitude why libaudit1
i   sudo Depends libaudit1 (>= 1:2.2.1)

root@ro01:~# dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1 | grep 'sudo '
sudo                                    optional

root@ro01:~# aptitude why sudo
i   mountall                   Depends    plymouth
p   plymouth                   Recommends plymouth-theme-ubuntu-text | plymouth-theme
p   mythbuntu-default-settings Provides   plymouth-theme
p   mythbuntu-default-settings Recommends lightdm
p   lightdm                    Recommends xserver-xorg
p   xserver-xorg               Recommends xserver-xorg-video-all | xorg-driver-video
p   nvidia-384                 Provides   xorg-driver-video
p   nvidia-384                 Depends    dkms
p   dkms                       Recommends menu | sudo

apt-cache rdepends 显示更多...

root@ro01:~# apt-cache rdepends libaudit1
libaudit1
Reverse Depends:
  sudo
  systemd
  openssh-server
  libaudit-dev
  xwayland-hwe-16.04
  xserver-xephyr-hwe-16.04
  xmir-hwe-16.04
  sudo-ldap
  xserver-xorg-core-hwe-16.04
  systemd
  sudo
  libvirt0
  dbus-1-dbg
  dbus
  xwayland-hwe-16.04
  xwayland
  xvfb
  xserver-xephyr-hwe-16.04
  xserver-xephyr
  xnest
  xmir-hwe-16.04
  xmir
  xdmx
  sudo-ldap
  python3-audit
  python-audit
  nscd
  linux-oem-tools-4.13.0-1024
  linux-oem-tools-4.13.0-1022
  linux-oem-tools-4.13.0-1021
  linux-oem-tools-4.13.0-1020
  linux-oem-tools-4.13.0-1019
  linux-oem-tools-4.13.0-1017
  linux-oem-tools-4.13.0-1015
  linux-oem-tools-4.13.0-1012
  linux-oem-tools-4.13.0-1010
  linux-oem-tools-4.13.0-1008
  linux-kvm-tools-4.4.0-1004
  linux-gke-tools-4.4.0-1034
  linux-gke-tools-4.4.0-1033
  linux-gke-tools-4.4.0-1032
  linux-gke-tools-4.4.0-1031
  linux-gke-tools-4.4.0-1028
  linux-gke-tools-4.4.0-1027
  linux-gke-tools-4.4.0-1026
  linux-gke-tools-4.4.0-1024
  linux-gke-tools-4.4.0-1022
  linux-gke-tools-4.4.0-1018
  linux-gke-tools-4.4.0-1016
  linux-gke-tools-4.4.0-1014
  linux-gke-tools-4.4.0-1013
  linux-gke-tools-4.4.0-1012
  linux-gke-tools-4.4.0-1010
  linux-gke-tools-4.4.0-1009
  linux-gke-tools-4.4.0-1008
  linux-gke-tools-4.4.0-1006
  linux-gke-tools-4.4.0-1005
  linux-gke-tools-4.4.0-1003
  linux-gcp-tools-4.13.0-1013
  linux-gcp-tools-4.13.0-1012
  linux-gcp-tools-4.13.0-1011
  linux-gcp-tools-4.13.0-1008
  linux-gcp-tools-4.13.0-1007
  linux-gcp-tools-4.13.0-1006
  linux-gcp-tools-4.13.0-1002
  linux-gcp-tools-4.10.0-1009
  linux-gcp-tools-4.10.0-1008
  linux-gcp-tools-4.10.0-1007
  linux-gcp-tools-4.10.0-1006
  linux-gcp-tools-4.10.0-1004
  linux-euclid-tools-4.4.0-9026
  linux-euclid-tools-4.4.0-9025
  linux-euclid-tools-4.4.0-9023
  linux-euclid-tools-4.4.0-9022
  linux-euclid-tools-4.4.0-9021
  linux-euclid-tools-4.4.0-9020
  linux-euclid-tools-4.4.0-9019
  linux-azure-edge-tools-4.15.0-1005
  linux-azure-edge-tools-4.14.0-1003
  linux-azure-edge-tools-4.13.0-1005
  linux-azure-edge-tools-4.13.0-1003
  linux-aws-tools-4.4.0-1012
  linux-aws-tools-4.4.0-1011
  linux-aws-tools-4.4.0-1009
  linux-aws-tools-4.4.0-1007
  linux-aws-tools-4.4.0-1004
  linux-aws-tools-4.4.0-1003
  linux-aws-tools-4.4.0-1001
  gdm3
  xserver-xorg-core-hwe-16.04
  xserver-xorg-core
  util-linux
  systemd
  sudo
  passwd
  openssh-server
  login
  linux-tools-4.4.0-98
  linux-tools-4.4.0-97
  linux-tools-4.4.0-96
  linux-tools-4.4.0-93
  linux-tools-4.4.0-92
  linux-tools-4.4.0-91
  linux-tools-4.4.0-89
  linux-tools-4.4.0-87
  linux-tools-4.4.0-83
  linux-tools-4.4.0-81
  linux-tools-4.4.0-79
  linux-tools-4.4.0-78
  linux-tools-4.4.0-77
  linux-tools-4.4.0-75
  linux-tools-4.4.0-72
  linux-tools-4.4.0-71
  linux-tools-4.4.0-70
  linux-tools-4.4.0-67
  linux-tools-4.4.0-66
  linux-tools-4.4.0-64
  linux-tools-4.4.0-63
  linux-tools-4.4.0-62
  linux-tools-4.4.0-59
  linux-tools-4.4.0-57
  linux-tools-4.4.0-53
  linux-tools-4.4.0-51
  linux-tools-4.4.0-47
  linux-tools-4.4.0-45
  linux-tools-4.4.0-43
  linux-tools-4.4.0-42
  linux-tools-4.4.0-38
  linux-tools-4.4.0-36
  linux-tools-4.4.0-34
  linux-tools-4.4.0-31
  linux-tools-4.4.0-28
  linux-tools-4.4.0-24
  linux-tools-4.4.0-22
  linux-tools-4.4.0-122
  linux-tools-4.4.0-121
  linux-tools-4.4.0-119
  linux-tools-4.4.0-116
  linux-tools-4.4.0-112
  linux-tools-4.4.0-109
  linux-tools-4.4.0-108
  linux-tools-4.4.0-104
  linux-tools-4.4.0-103
  linux-tools-4.4.0-101
  linux-kvm-tools-4.4.0-1021
  linux-kvm-tools-4.4.0-1020
  linux-kvm-tools-4.4.0-1019
  linux-kvm-tools-4.4.0-1017
  linux-kvm-tools-4.4.0-1015
  linux-kvm-tools-4.4.0-1013
  linux-kvm-tools-4.4.0-1012
  linux-kvm-tools-4.4.0-1010
  linux-kvm-tools-4.4.0-1009
  linux-kvm-tools-4.4.0-1008
  linux-kvm-tools-4.4.0-1007
  linux-hwe-tools-4.8.0-58
  linux-hwe-tools-4.8.0-56
  linux-hwe-tools-4.8.0-54
  linux-hwe-tools-4.8.0-53
  linux-hwe-tools-4.8.0-52
  linux-hwe-tools-4.8.0-51
  linux-hwe-tools-4.8.0-49
  linux-hwe-tools-4.8.0-46
  linux-hwe-tools-4.8.0-45
  linux-hwe-tools-4.8.0-44
  linux-hwe-tools-4.8.0-42
  linux-hwe-tools-4.8.0-41
  linux-hwe-tools-4.8.0-39
  linux-hwe-tools-4.8.0-36
  linux-hwe-tools-4.13.0-39
  linux-hwe-tools-4.13.0-38
  linux-hwe-tools-4.13.0-37
  linux-hwe-tools-4.13.0-36
  linux-hwe-tools-4.13.0-32
  linux-hwe-tools-4.13.0-31
  linux-hwe-tools-4.13.0-26
  linux-hwe-tools-4.10.0-42
  linux-hwe-tools-4.10.0-40
  linux-hwe-tools-4.10.0-38
  linux-hwe-tools-4.10.0-37
  linux-hwe-tools-4.10.0-35
  linux-hwe-tools-4.10.0-33
  linux-hwe-tools-4.10.0-32
  linux-hwe-tools-4.10.0-30
  linux-hwe-tools-4.10.0-28
  linux-hwe-tools-4.10.0-27
  linux-hwe-edge-tools-4.8.0-34
  linux-hwe-edge-tools-4.15.0-15
  linux-hwe-edge-tools-4.15.0-13
  linux-hwe-edge-tools-4.13.0-25
  linux-hwe-edge-tools-4.13.0-21
  linux-hwe-edge-tools-4.13.0-19
  linux-hwe-edge-tools-4.13.0-17
  linux-hwe-edge-tools-4.13.0-16
  linux-hwe-edge-tools-4.11.0-14
  linux-hwe-edge-tools-4.11.0-13
  linux-hwe-edge-tools-4.10.0-26
  linux-hwe-edge-tools-4.10.0-24
  linux-hwe-edge-tools-4.10.0-22
  linux-hwe-edge-tools-4.10.0-21
  linux-hwe-edge-tools-4.10.0-20
  linux-hwe-edge-tools-4.10.0-19
  linux-hwe-edge-tools-4.10.0-14
  linux-azure-tools-4.13.0-1014
  linux-azure-tools-4.13.0-1012
  linux-azure-tools-4.13.0-1011
  linux-azure-tools-4.13.0-1009
  linux-azure-tools-4.13.0-1007
  linux-azure-tools-4.13.0-1006
  linux-azure-tools-4.13.0-1005
  linux-azure-tools-4.11.0-1016
  linux-azure-tools-4.11.0-1015
  linux-azure-tools-4.11.0-1014
  linux-azure-tools-4.11.0-1013
  linux-azure-tools-4.11.0-1011
  linux-azure-tools-4.11.0-1009
  linux-aws-tools-4.4.0-1055
  linux-aws-tools-4.4.0-1054
  linux-aws-tools-4.4.0-1052
  linux-aws-tools-4.4.0-1050
  linux-aws-tools-4.4.0-1049
  linux-aws-tools-4.4.0-1048
  linux-aws-tools-4.4.0-1047
  linux-aws-tools-4.4.0-1044
  linux-aws-tools-4.4.0-1043
  linux-aws-tools-4.4.0-1041
  linux-aws-tools-4.4.0-1039
  linux-aws-tools-4.4.0-1038
  linux-aws-tools-4.4.0-1037
  linux-aws-tools-4.4.0-1035
  linux-aws-tools-4.4.0-1032
  linux-aws-tools-4.4.0-1031
  linux-aws-tools-4.4.0-1030
  linux-aws-tools-4.4.0-1028
  linux-aws-tools-4.4.0-1026
  linux-aws-tools-4.4.0-1022
  linux-aws-tools-4.4.0-1020
  linux-aws-tools-4.4.0-1018
  linux-aws-tools-4.4.0-1017
  linux-aws-tools-4.4.0-1016
  linux-aws-tools-4.4.0-1013
  libvirt0
  libpam0g
  libpam-modules-bin
  libpam-modules
  libauparse0
  libauparse0
  libauparse0
  libaudit-common
  libaudit-common
  libaudit-common
  dbus-1-dbg
  dbus
  auditd
  xwayland
  xvfb
  xserver-xephyr
  xnest
  xmir
  xdmx
  ubuntu-core-libs
  sudo-ldap
  python3-audit
  python-audit
  policycoreutils
  nscd
  gdm3
  aide-dynamic
  xserver-xorg-core
  systemd
  sudo
  passwd
  openssh-server
  login
  linux-tools-4.4.0-21
  libvirt0
  libsemanage1
  libpam0g
  libpam-modules-bin
  libpam-modules
  libauparse0
  libauparse0
  libauparse0
  libaudit-dev
  libaudit-common
  dbus
  dbus-1-dbg
  auditd
root@ro01:~#

找到了更多有问题的软件包...

  • libdebconfclient0
  • liblz4-1
  • libsemanage1
  • libsemanage-common
  • libsystemd0
  • libbsd0
  • libexpat1
  • libhcrypto4-heimdal
  • libheimntlm0-heimdal
  • libhx509-5-heimdal

apt-get purge一个一个地运行软件包时,我不再收到有关删除重要软件包并浏览已删除内容列表的警告,我看到不再删除诸如adduser和apt之类的重要内容。但是,当apt-get purge一次运行所有软件包时……警告仍然存在,尽管单独删除软件包时apt仍然不在,但apt和其他内容仍在删除列表中。不知道。

最后,我只是排除了所有库和其他一些软件包,以避免删除我关心的任何内容。

root@ro01:~# apt-get purge $(dpkg-query -Wf \
    '${Package;-40}${Priority}\n' | \
    awk '$2 ~ /optional|extra/ { print $1 }' | \
    grep -vE 'lib|gawk|openssh|insserv|quota|sudo')
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
  apache2* apache2-bin* apache2-data* apache2-doc* apache2-utils* bind9* bind9utils* binutils* bsd-mailx* busybox-initramfs* ca-certificates* cifs-utils* console-data* db-util* db5.3-util* debconf-utils* dh-python*
  dialog* distro-info-data* dmsetup* dselect* ed* expat* fetchmail* finger* fontconfig* fontconfig-config* fonts-dejavu* fonts-dejavu-core* fonts-dejavu-extra* fonts-freefont-ttf* gettext* initramfs-tools*
  initramfs-tools-bin* initramfs-tools-core* iputils-arping* iputils-tracepath* ldap-utils* libfontconfig1* linux-base* lsb-release* lynx* lynx-common* make* makedev* memtester* mktemp* module-init-tools* mountall*
  mtools* odbcinst* odbcinst1debian2* openssl* openssl-blacklist* plymouth* postfix* procinfo* psmisc* psutils* pwgen* python-crypto* python-dnspython* python-ldb* python-samba* python-talloc* python-tdb* python3*
  python3-minimal* python3.5* python3.5-minimal* rsync* samba* samba-common* samba-common-bin* samba-libs* sasl2-bin* sharutils* snmp* ssl-cert* syslinux* tcpdump* tcsh* tdb-tools* tofrodos* ttf-dejavu* ttf-dejavu-core*
  ttf-dejavu-extra* ttf-freefont* unixodbc* unzip* update-inetd* uuid-runtime* vim* vim-runtime* wide-dhcpv6-client* xinetd*
0 upgraded, 0 newly installed, 96 to remove and 0 not upgraded.
After this operation, 195 MB disk space will be freed.
Do you want to continue? [Y/n] Y
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.