我收到消息说我的 /boot 驱动器内存不足。因此,为了确保我可以继续更新我的机器,我尝试删除不必要的文件。我遵循了以下程序:如何在 /boot 中释放更多空间?,也就是:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
当我测试该命令的第一部分时,我得到了以下合理的结果:
root@Bedrock:/boot# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r |
sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^
]*\).*/\1/;/[0-9]/!d'
linux-headers-4.4.0-28
linux-headers-4.4.0-28-generic
linux-headers-4.4.0-77
linux-headers-4.4.0-77-generic
linux-headers-4.4.0-78
linux-headers-4.4.0-78-generic
linux-headers-4.4.0-79
linux-headers-4.4.0-79-generic
linux-headers-4.4.0-81
linux-headers-4.4.0-81-generic
linux-headers-4.4.0-83
linux-headers-4.4.0-83-generic
linux-headers-4.4.0-89
linux-headers-4.4.0-89-generic
linux-image-4.4.0-28-generic
linux-image-4.4.0-77-generic
linux-image-4.4.0-78-generic
linux-image-4.4.0-79-generic
linux-image-4.4.0-81-generic
linux-image-4.4.0-83-generic
linux-image-extra-4.4.0-28-generic
linux-image-extra-4.4.0-77-generic
linux-image-extra-4.4.0-78-generic
linux-image-extra-4.4.0-79-generic
linux-image-extra-4.4.0-81-generic
linux-image-extra-4.4.0-83-generic
linux-libc-dev:amd64
linux-libc-dev:i386
linux-signed-image-4.4.0-77-generic
linux-signed-image-4.4.0-78-generic
linux-signed-image-4.4.0-79-generic
linux-signed-image-4.4.0-81-generic
linux-signed-image-4.4.0-83-generic
我还可以看到:
root@Bedrock:~$ uname -a
Linux Bedrock 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
所以,我知道我不会删除87
我正在使用的任何文件。虽然我确实想知道为什么我有89
文件标题?不应该是全有或全无的情况 - 要么有文件标题、图像、附加内容和签名图像,89
要么什么都没有?
但是,我真正的问题是,为什么我执行了完整的命令后,最终删除了大多数已安装的软件包。其中一些软件包仍在大量使用 - 例如 g++、libboost、opencv 等。幸运的是,输出使 ne 能够看到我需要重新安装的内容:
root@Bedrock:/boot# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
bbswitch-dkms cdbs cm-super-minimal dh-translations dkms gir1.2-gst-plugins-base-0.10 gir1.2-gstreamer-0.10 gir1.2-gtk-2.0 hdf5-helpers icu-devtools intltool lib32gcc1
lib64ncurses5:i386 lib64tinfo5:i386 libaec-dev libasound2-dev libboost-atomic1.58.0 libboost-chrono1.58.0 libboost-context1.58.0 libboost-coroutine1.58.0
libboost-graph-parallel1.58.0 libboost-graph1.58.0 libboost-locale1.58.0 libboost-log1.58.0 libboost-math1.58.0 libboost-mpi-python1.58.0 libboost-mpi1.58.0
libboost-program-options1.58.0 libboost-random1.58.0 libboost-regex1.58.0 libboost-serialization1.58.0 libboost-signals1.58.0 libboost-test1.58.0 libboost-timer1.58.0
libboost-tools-dev libboost-wave1.58.0 libboost1.58-tools-dev libc-dev-bin libc6-i386 libcairo-script-interpreter2 libdapserver7v5 libdbus-1-dev libdmx-dev libdmx1
libeigen3-dev libepoxy-dev libfs-dev libfs6 libgeos-dev libgfortran-5-dev libgif-dev libgl2ps-dev libgssrpc4 libgvc6-plugins-gtk libharfbuzz-dev libharfbuzz-gobject0
libhdf5-cpp-11 libibverbs-dev libilmbase-dev libjansson4 libjbig-dev libjs-sphinxdoc libjs-underscore libjsoncpp-dev libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libllvm3.6v5
liblzma-dev libmircommon5 libmircookie-dev libmircookie2 libmircore-dev libnetcdf-cxx-legacy-dev libobjc-5-dev libobjc4 libopencv-gpu2.4v5 libopencv-ocl2.4v5
libopencv-stitching2.4v5 libopencv-superres2.4v5 libopencv-ts2.4v5 libopencv-videostab2.4v5 libopencv2.4-java libopencv2.4-jni libopenexr-dev libpciaccess-dev libpcre32-3
libpcrecpp0v5 libpixman-1-dev libqt5concurrent5 libraw1394-dev libraw1394-tools libreadline-dev libreadline6-dev libsndio-dev libssl-doc libtiffxx5 libtinfo-dev
libtinfo-dev:i386 libudev-dev libvtk6-java libwayland-bin libwayland-dev libwebp-dev libwebpdemux1 libxaw7-dev libxcb-shm0-dev libxcomposite-dev libxcursor-dev libxdmf-dev
libxdmf2 libxdot4 libxinerama-dev libxkbcommon-dev libxkbfile-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxtst-dev libxv-dev libxvmc-dev
libxxf86dga-dev linux-image-generic linux-signed-image-generic nettle-dev nvidia-prime nvidia-settings python-attr python-autobahn python-concurrent.futures python-lz4
python-mpi4py python-msgpack python-pam python-pyasn1-modules python-scour python-serial python-service-identity python-snappy python-trollius python-twisted python-twisted-bin
python-twisted-core python-txaio python-vtk6 python-zope.interface python3-brlapi python3-louis python3-speechd qt5-qmake qtbase5-dev-tools screen-resolution-extra tcl-vtk6
thermald x11proto-bigreqs-dev x11proto-composite-dev x11proto-dmx-dev x11proto-dri3-dev x11proto-fonts-dev x11proto-present-dev x11proto-randr-dev x11proto-record-dev
x11proto-render-dev x11proto-resource-dev x11proto-scrnsaver-dev x11proto-video-dev x11proto-xcmisc-dev x11proto-xf86bigfont-dev x11proto-xf86dga-dev x11proto-xf86dri-dev
x11proto-xinerama-dev xbrlapi xserver-xorg-legacy
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
gir1.2-gtk-2.0 libdrm-amdgpu1 libdrm-amdgpu1:i386 libdrm-dev libdrm-intel1 libdrm-intel1:i386 libdrm-nouveau2 libdrm-nouveau2:i386 libdrm-radeon1 libdrm-radeon1:i386 libdrm2
libdrm2:i386 libegl1-mesa libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-dri:i386 libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa libglapi-mesa:i386 libgles2-mesa
libgtk2.0-0 libgtk2.0-bin libllvm4.0 libllvm4.0:i386 libpulse-mainloop-glib0 libpulse0 libpulsedsp libsensors4:i386 libwayland-bin libwayland-client0 libwayland-cursor0
libwayland-dev libwayland-egl1-mesa libwayland-server0 mesa-common-dev pulseaudio pulseaudio-module-bluetooth pulseaudio-module-x11 pulseaudio-utils
Suggested packages:
lm-sensors:i386 pavumeter pavucontrol paman paprefs
The following packages will be REMOVED:
bazel* build-essential* comerr-dev* doxygen* doxygen-dbg* doxygen-gui* doxygen-latex* g++* g++-4.8* g++-4.9* g++-5* gfortran* gfortran-5* gnome-orca* graphviz-dev*
krb5-multidev* lib64ncurses5-dev:i386* libatk-adaptor* libatk-bridge2.0-dev* libatk1.0-dev* libatspi2.0-dev* libblas-dev* libboost-all-dev* libboost-atomic-dev*
libboost-atomic1.58-dev* libboost-chrono-dev* libboost-chrono1.58-dev* libboost-context-dev* libboost-context1.58-dev* libboost-coroutine-dev* libboost-coroutine1.58-dev*
libboost-date-time-dev* libboost-date-time1.58-dev* libboost-dev* libboost-exception-dev* libboost-exception1.58-dev* libboost-filesystem-dev* libboost-filesystem1.58-dev*
libboost-graph-dev* libboost-graph-parallel-dev* libboost-graph-parallel1.58-dev* libboost-graph1.58-dev* libboost-iostreams-dev* libboost-iostreams1.58-dev*
libboost-locale-dev* libboost-locale1.58-dev* libboost-log-dev* libboost-log1.58-dev* libboost-math-dev* libboost-math1.58-dev* libboost-mpi-dev* libboost-mpi-python-dev*
libboost-mpi-python1.58-dev* libboost-mpi1.58-dev* libboost-program-options-dev* libboost-program-options1.58-dev* libboost-python-dev* libboost-python1.58-dev*
libboost-random-dev* libboost-random1.58-dev* libboost-regex-dev* libboost-regex1.58-dev* libboost-serialization-dev* libboost-serialization1.58-dev* libboost-signals-dev*
libboost-signals1.58-dev* libboost-system-dev* libboost-system1.58-dev* libboost-test-dev* libboost-test1.58-dev* libboost-thread-dev* libboost-thread1.58-dev*
libboost-timer-dev* libboost-timer1.58-dev* libboost-wave-dev* libboost-wave1.58-dev* libboost1.58-dev* libbz2-dev* libc6-dev* libc6-dev:i386* libc6-dev-amd64:i386*
libcairo2-dev* libclang1-3.6* libcuda1-367* libcuda1-375* libcv-dev* libcvaux-dev* libdap-dev* libdc1394-22-dev* libegl1-mesa-dev* libexpat1-dev* libfontconfig1-dev*
libfontenc-dev* libfreetype6-dev* libgail-common* libgail18* libgdal-dev* libgdk-pixbuf2.0-dev* libgles2-mesa-dev* libglib2.0-dev* libgraphviz-dev*
libgstreamer-plugins-base0.10-dev* libgstreamer-plugins-base1.0-dev* libgstreamer0.10-dev* libgstreamer1.0-dev* libgtk-3-dev* libgtk2.0-dev* libhdf4-alt-dev* libhdf5-dev*
libhdf5-serial-dev* libhighgui-dev* libhwloc-dev* libicu-dev* libjpeg-dev* libjpeg-turbo8-dev* libjpeg8-dev* liblapack-dev* libmirclient-dev* libmircommon-dev*
libmysqlclient-dev* libncurses5-dev* libncurses5-dev:i386* libncursesw5-dev* libnetcdf-dev* libnuma-dev* libopencv-calib3d-dev* libopencv-contrib-dev* libopencv-core-dev*
libopencv-dev* libopencv-features2d-dev* libopencv-flann-dev* libopencv-gpu-dev* libopencv-highgui-dev* libopencv-imgproc-dev* libopencv-legacy-dev* libopencv-ml-dev*
libopencv-objdetect-dev* libopencv-ocl-dev* libopencv-photo-dev* libopencv-stitching-dev* libopencv-superres-dev* libopencv-ts-dev* libopencv-video-dev*
libopencv-videostab-dev* libopenmpi-dev* libpango1.0-dev* libpcre3-dev* libpng++-dev* libpng12-dev* libpq-dev* libprotobuf-dev* libprotoc-dev* libpulse-dev* libpython-all-dev*
libpython-dev* libpython2.7-dev* libpython3-all-dev* libpython3-dev* libpython3.5-dev* libqt5opengl5-dev* libsdl2-dev* libspatialite-dev* libsqlite3-dev* libssl-dev*
libstdc++-4.8-dev* libstdc++-4.9-dev* libstdc++-5-dev* libtiff5-dev* libtool* libvtk6-dev* libxerces-c-dev* libxfont-dev* libxft-dev* libxml2-dev* linux-generic*
linux-headers-4.4.0-28* linux-headers-4.4.0-28-generic* linux-headers-4.4.0-77* linux-headers-4.4.0-77-generic* linux-headers-4.4.0-78* linux-headers-4.4.0-78-generic*
linux-headers-4.4.0-79* linux-headers-4.4.0-79-generic* linux-headers-4.4.0-81* linux-headers-4.4.0-81-generic* linux-headers-4.4.0-83* linux-headers-4.4.0-83-generic*
linux-headers-4.4.0-89* linux-headers-4.4.0-89-generic* linux-headers-generic* linux-image-4.4.0-28-generic* linux-image-4.4.0-77-generic* linux-image-4.4.0-78-generic*
linux-image-4.4.0-79-generic* linux-image-4.4.0-81-generic* linux-image-4.4.0-83-generic* linux-image-extra-4.4.0-28-generic* linux-image-extra-4.4.0-77-generic*
linux-image-extra-4.4.0-78-generic* linux-image-extra-4.4.0-79-generic* linux-image-extra-4.4.0-81-generic* linux-image-extra-4.4.0-83-generic* linux-libc-dev*
linux-libc-dev:i386* linux-signed-generic* linux-signed-image-4.4.0-77-generic* linux-signed-image-4.4.0-78-generic* linux-signed-image-4.4.0-79-generic*
linux-signed-image-4.4.0-81-generic* linux-signed-image-4.4.0-83-generic* mir-client-platform-mesa-dev* mpi-default-dev* nvidia-367* nvidia-375* nvidia-opencl-icd-367*
nvidia-opencl-icd-375* python-all-dev* python-dev* python2.7-dev* python3-all-dev* python3-dev* python3-pyatspi* python3.5-dev* qtbase5-dev* r-base-core-dbg* r-base-dev*
tcl-dev* tcl8.6-dev* tk-dev* tk8.6-dev* ubuntu-desktop* uuid-dev* xorg-dev* xserver-xorg-dev* zlib1g-dev*
The following NEW packages will be installed:
libllvm4.0 libllvm4.0:i386 libsensors4:i386 libwayland-bin
The following packages will be upgraded:
gir1.2-gtk-2.0 libdrm-amdgpu1 libdrm-amdgpu1:i386 libdrm-dev libdrm-intel1 libdrm-intel1:i386 libdrm-nouveau2 libdrm-nouveau2:i386 libdrm-radeon1 libdrm-radeon1:i386 libdrm2
libdrm2:i386 libegl1-mesa libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-dri:i386 libgl1-mesa-glx libgl1-mesa-glx:i386 libglapi-mesa libglapi-mesa:i386 libgles2-mesa
libgtk2.0-0 libgtk2.0-bin libpulse-mainloop-glib0 libpulse0 libpulsedsp libwayland-client0 libwayland-cursor0 libwayland-dev libwayland-egl1-mesa libwayland-server0
mesa-common-dev pulseaudio pulseaudio-module-bluetooth pulseaudio-module-x11 pulseaudio-utils
37 upgraded, 4 newly installed, 235 to remove and 66 not upgraded.
7 not fully installed or removed.
Need to get 40.3 MB of archives.
After this operation, 2,940 MB disk space will be freed.
也许这会教会我在将命令输入到 apt-get purge 时不要使用 -y 选项,但我仍然不明白这里发生了什么。为什么我没有丢失旧的 linux 文件?