我想进行更新,但似乎我的磁盘已满。我尝试过:
sudo apt-get install -f
但它给了我以下输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
checkbox-ng fonts-inconsolata gir1.2-gconf-2.0 ko.tex-extra-hlfont
latex-sanskrit libarchive-extract-perl libboost-date-time1.54.0
libboost-system1.54.0 libcmis-0.4-4 libcolamd2.8.0 libept1.4.12 libglamor0
libglew1.10 libglewmx1.10 libgnome-desktop-3-7 libgphoto2-port10 libilmbase6
libimobiledevice4 libintl-perl libisl10 libllvm3.4 liblog-message-perl
liblog-message-simple-perl libmagick++5 libmagickcore5 libmagickcore5-extra
libmagickwand5 libmbim-glib0 libmodule-pluggable-perl libmodule-runtime-perl
libntdb1 libopenexr6 liborcus-0.6-0 libparams-classify-perl libpocketsphinx1
libpod-latex-perl libpoppler44 libprocps3 libprotobuf8 libprotoc8
libqmi-glib0 libqpdf13 libqt5qml-graphicaleffects libqt5sensors5
libqt5webkit5-qmlwebkitplugin libraw9 librhythmbox-core8 libsphinxbase1
libspice-server1 libsystemd-journal0 libsystemd-login0 libterm-ui-perl
libtext-soundex-perl libthumbnailer0 libunityvoice1 libupstart1 libxdelta2
libxtables10 linux-headers-3.13.0-29 linux-headers-3.13.0-29-generic
linux-headers-3.13.0-62 linux-headers-3.13.0-62-generic
linux-headers-3.13.0-95 linux-headers-3.13.0-95-generic
linux-headers-4.4.0-36 linux-headers-4.4.0-36-generic linux-headers-4.4.0-37
linux-headers-4.4.0-37-generic linux-headers-4.4.0-38
linux-headers-4.4.0-38-generic linux-headers-4.4.0-39
linux-headers-4.4.0-39-generic linux-headers-4.4.0-40
linux-headers-4.4.0-40-generic linux-headers-4.4.0-41
linux-headers-4.4.0-41-generic linux-headers-4.4.0-44
linux-headers-4.4.0-44-generic linux-headers-4.4.0-46
linux-headers-4.4.0-46-generic linux-headers-4.4.0-49
linux-headers-4.4.0-49-generic linux-headers-4.4.0-51
linux-headers-4.4.0-51-generic linux-headers-4.4.0-52
linux-headers-4.4.0-52-generic linux-headers-4.4.0-53
linux-image-3.11.0-19-generic linux-image-4.4.0-36-generic
linux-image-4.4.0-37-generic linux-image-4.4.0-38-generic
linux-image-4.4.0-39-generic linux-image-4.4.0-40-generic
linux-image-4.4.0-41-generic linux-image-4.4.0-44-generic
linux-image-4.4.0-46-generic linux-image-4.4.0-49-generic
linux-image-4.4.0-51-generic linux-image-4.4.0-52-generic
linux-image-extra-3.11.0-19-generic linux-image-extra-4.4.0-36-generic
linux-image-extra-4.4.0-37-generic linux-image-extra-4.4.0-38-generic
linux-image-extra-4.4.0-39-generic linux-image-extra-4.4.0-40-generic
linux-image-extra-4.4.0-41-generic linux-image-extra-4.4.0-44-generic
linux-image-extra-4.4.0-46-generic linux-image-extra-4.4.0-49-generic
linux-image-extra-4.4.0-51-generic linux-image-extra-4.4.0-52-generic m-tx
musixtex perlmagick pmx python-commandnotfound python-gdbm python-imaging-tk
python-ntdb python3-checkbox qml-module-qtquick-dialogs
qml-module-qtquick-localstorage qml-module-qtquick-privatewidgets
qml-module-ubuntu-ui-extras-browser qtdeclarative5-dialogs-plugin
qtdeclarative5-localstorage-plugin qtdeclarative5-privatewidgets-plugin
qtdeclarative5-qtfeedback-plugin
qtdeclarative5-ubuntu-ui-extras-browser-plugin
qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets
qtdeclarative5-window-plugin sphinx-voxforge-hmm-en sphinx-voxforge-lm-en
swath ubuntu-core-launcher unity-scope-audacious unity-scope-clementine
unity-scope-gmusicbrowser unity-scope-gourmet unity-scope-guayadeque
unity-scope-musique unity-voice-service xdelta
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic
The following NEW packages will be installed:
linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic
0 upgraded, 2 newly installed, 0 to remove and 63 not upgraded.
2 not fully installed or removed.
Need to get 10,7 MB of archives.
After this operation, 77,8 MB of additional disk space will be used.
Do you want to continue? [O/n] o
Get:1 http://fr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-57 all 4.4.0-57.78 [9 949 kB]
Get:2 http://fr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-57-generic amd64 4.4.0-57.78 [779 kB]
Fetched 10,7 MB in 17s (610 kB/s)
(Reading database ... 1254217 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-57_4.4.0-57.78_all.deb ...
Unpacking linux-headers-4.4.0-57 (4.4.0-57.78) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers 4.4.0-57_4.4.0-57.78_all.deb (--unpack):
unable to create '/usr/src/linux-headers-4.4.0-57/include/linux/capability.h.dpkg-new' (while processing './usr/src/linux-headers-4.4.0-57/include/linux/capability.h'): No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../linux-headers-4.4.0-57-generic_4.4.0-57.78_amd64.deb ...
Unpacking linux-headers-4.4.0-57-generic (4.4.0-57.78) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-57-generic_4.4.0-57.78_amd64.deb (--unpack):
error creating directory './usr/src/linux-headers-4.4.0-57-generic/include/config/cross/memory': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/linux-headers-4.4.0-57_4.4.0-57.78_all.deb
/var/cache/apt/archives/linux-headers-4.4.0-57-generic_4.4.0-57.78_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
df
给出以下输出:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 1941224 0 1941224 0% /dev
tmpfs 392292 6416 385876 2% /run
/dev/sda5 20027728 17160304 1827020 91% /
tmpfs 1961444 2952 1958492 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 1961444 0 1961444 0% /sys/fs/cgroup
/dev/sda6 139057128 45511572 86458812 35% /home
cgmfs 100 0 100 0% /run/cgmanager/fs
tmpfs 392292 108 392184 1% /run/user/1001
sudo fdisk -l
给出这个:
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
(edit: 15 more ram devices with the same size)
Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe0a42c14
Device Boot Start End Sectors Size Id Type
/dev/sda1 63 80324 80262 39,2M de Dell Utility
/dev/sda2 * 81920 1622015 1540096 752M 7 HPFS/NTFS/exFAT
/dev/sda3 1622016 160710655 159088640 75,9G 7 HPFS/NTFS/exFAT
/dev/sda4 160712702 488394751 327682050 156,3G 5 Extended
/dev/sda5 160712704 201673641 40960938 19,5G 83 Linux
/dev/sda6 201674752 484489205 282814454 134,9G 83 Linux
/dev/sda7 484489216 488394751 3905536 1,9G 82 Linux swap / Solaris
ls /usr/src
输出:
bcmwl-6.30.223.248+bdcom linux-headers-3.13.0-66-generic linux-headers-3.13.0-86-generic linux-headers-3.8.0-35 linux-headers-4.4.0-44-generic
linux-headers-3.13.0-29 linux-headers-3.13.0-67 linux-headers-3.13.0-87 linux-headers-4.4.0-36 linux-headers-4.4.0-46
linux-headers-3.13.0-29-generic linux-headers-3.13.0-67-generic linux-headers-3.13.0-87-generic linux-headers-4.4.0-36-generic linux-headers-4.4.0-46-generic
linux-headers-3.13.0-46 linux-headers-3.13.0-74 linux-headers-3.13.0-88 linux-headers-4.4.0-37 linux-headers-4.4.0-49
linux-headers-3.13.0-46-generic linux-headers-3.13.0-74-generic linux-headers-3.13.0-88-generic linux-headers-4.4.0-37-generic linux-headers-4.4.0-49-generic
linux-headers-3.13.0-62 linux-headers-3.13.0-78 linux-headers-3.13.0-93 linux-headers-4.4.0-38 linux-headers-4.4.0-51
linux-headers-3.13.0-62-generic linux-headers-3.13.0-78-generic linux-headers-3.13.0-93-generic linux-headers-4.4.0-38-generic linux-headers-4.4.0-51-generic
linux-headers-3.13.0-63 linux-headers-3.13.0-80 linux-headers-3.13.0-94 linux-headers-4.4.0-39 linux-headers-4.4.0-52
linux-headers-3.13.0-63-generic linux-headers-3.13.0-80-generic linux-headers-3.13.0-94-generic linux-headers-4.4.0-39-generic linux-headers-4.4.0-52-generic
linux-headers-3.13.0-64 linux-headers-3.13.0-82 linux-headers-3.13.0-95 linux-headers-4.4.0-40 linux-headers-4.4.0-53
linux-headers-3.13.0-64-generic linux-headers-3.13.0-82-generic linux-headers-3.13.0-95-generic linux-headers-4.4.0-40-generic
linux-headers-3.13.0-65 linux-headers-3.13.0-85 linux-headers-3.8.0-19 linux-headers-4.4.0-41
linux-headers-3.13.0-65-generic linux-headers-3.13.0-85-generic linux-headers-3.8.0-32 linux-headers-4.4.0-41-generic
linux-headers-3.13.0-66 linux-headers-3.13.0-86 linux-headers-3.8.0-34 linux-headers-4.4.0-44
编辑:正如下面的评论和问题所建议的,输出如下df -i
:
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 485306 582 484724 1% /dev
tmpfs 490361 854 489507 1% /run
/dev/sda5 1281120 1278500 2620 100% /
tmpfs 490361 17 490344 1% /dev/shm
tmpfs 490361 6 490355 1% /run/lock
tmpfs 490361 18 490343 1% /sys/fs/cgroup
/dev/sda6 8839168 81878 8757290 1% /home
cgmfs 490361 14 490347 1% /run/cgmanager/fs
tmpfs 490361 45 490316 1% /run/user/1001
答案1
你有一个很多安装的内核占用了大量空间(每个内核 300 MiB)。您还安装了大量其他作为依赖项安装的软件包,但由于各种原因,这些软件包不再需要。
您可以使用以下命令安全地清除所有这些:
sudo apt autoremove
因此,正如您在评论中解释的那样,执行此操作后,您会收到以下错误:
The following packages have unmet dependencies:
linux-headers-generic : Depends: linux-headers-4.4.0-57-generic but it is not installed
E: Unmet dependencies. Try using -f.
您处境艰难!在清理软件包之前,APT 想要修复当前软件包,也就是安装缺失的软件包。但是没有空间可以安装!
在这种情况下,需要做的是通过其他方式释放磁盘空间。也许你可以删除旧文件和临时文件。但由于上面的命令很有帮助地列出了许多软件包,不再需要,我们可以使用命令手动删除其中一些dpkg
。
dpkg
请注意,不经过深思熟虑地使用可能会很危险。
和占用linux-image
了linux-image-extra
很多空间,所以我们从列表中选取一些不再需要并使用以下命令删除它们dpkg
:
sudo dpkg --remove linux-image-extra-4.4.0-36-generic
sudo dpkg --remove linux-image-4.4.0-36-generic
sudo dpkg --remove linux-image-extra-4.4.0-37-generic
sudo dpkg --remove linux-image-4.4.0-37-generic
sudo dpkg --remove linux-image-extra-4.4.0-38-generic
sudo dpkg --remove linux-image-4.4.0-38-generic
编辑:事实证明,这并没有解决问题。在聊天中讨论后,并按照其他人的建议,您运行df -i
并发现您的分区“只能”存储 120 万个文件,并且所有插槽都已使用。
这些linux-headers
包裹不像那么大linux-image
,但它们包含一个很多文件。让我们从列表中选取一些不再需要并使用以下命令删除它们dpkg
:
sudo dpkg --remove linux-headers-4.4.0-36 linux-headers-4.4.0-36-generic
sudo dpkg --remove linux-headers-4.4.0-37 linux-headers-4.4.0-37-generic
sudo dpkg --remove linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
现在磁盘空间和 inode 已经释放,可以安装缺少的软件包:
sudo apt install linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic
现在 APT 很高兴所有软件包依赖项都已安装,并且机器上的一切正常,我们可以告诉它自动删除所有不再需要的软件包:
sudo apt autoremove
答案2
您需要以某种方式释放一些空间。
不幸的是,使用 apt 时,你会遇到一个问题,在“apt-get -f install”成功之前,你无法使用大多数 apt 功能,而“apt-get -f install”只有在释放一些磁盘空间后才会成功。因此,尽管这里的其他几个答案都说尝试使用 apt 删除软件包是行不通的。
首先尝试“apt-get clean”。这将清理下载的软件包文件,并可能释放足够的空间以使 apt-get -f install 成功。
如果这还不够的话,我建议用 dpkg 删除一些旧内核,例如
dpkg -r --force-depends linux-image-3.11.0-19-generic
一旦成功运行“apt-get -f install”,您就可以按照其他人的建议运行“apt-get autoremove”,然后再继续升级。
答案3
我建议你安装 bleachbit。它将帮助你恢复大量空间。
答案4
正如其他人提到的,您应该稍微清理一下 - 尤其是删除旧内核。
但从更一般性的角度来说(除了我关于使用太多 inode 的小评论之外),我想补充以下内容:
在 Linux/Unix 文件系统(如 ext3 和 ext4)上,分区总容量的一定比例被保留用于根-用户。这确保(几乎)始终有空间存放重要的系统文件和日志,以及在(当!)时有一点操作空间根需要进行一次春季大扫除。 默认情况下,每个文件系统的 5% 都会被保留。 (这是一为什么df
-command 总是显示比你想象的更少的可用空间應該具有...)
对于当今 500GB 或 1TB 以上的大磁盘,5% 实际上有点多。而且这也取决于文件系统……如果您有单独的分区/(根),/家,/usr,/var和/tmp; 不是全部其中需要 5% 才能用于 root 权限。建议/- 这可能是一个好主意/var有可能/tmp也是 - 但对于/家和/usr,您可能需要的就少很多(可能只有 1% 或没有)。
您可以使用该命令dumpe2fs /dev/sd.. | grep "Reserved block count"
查看保留了多少个“块”(千字节? - 视情况而定)。
创建文件系统时,可以使用选项指定保留块的百分比-m
。仅 1% 时,使用:mkfs.ext4 -v -m1 /dev/sd..
不要只是“尝试”这个命令,它具有破坏性并且会格式化您的分区!
您可以使用tune2fs
带有-m
选项的选项来更改现有文件系统的保留百分比:tune2fs -m1 /dev/sd..
。
而不是-m
,-r
-选项指定实际的保留块数量按数量反而。
您可以通过这种方式获得相当多的额外空间......