启动到 100%,apt [anything] 失败,无法使用 dpkg 删除旧软件包

启动到 100%,apt [anything] 失败,无法使用 dpkg 删除旧软件包

我有点困惑,还是个初学者。我的 dev/sda1 似乎在升级过程中容量已达到上限。

sudo apt-get autoremove 

给我吗:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-67-generic : Depends: linux-image-4.4.0-67-generic but it is not installed
 linux-image-extra-4.4.0-77-generic : Depends: linux-image-4.4.0-77-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-77-generic but it is not installed
E: Unmet dependencies. Try using -f.

所以我尝试

sudo apt-get -f install

给我:

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:
  linux-headers-4.4.0-59 linux-headers-4.4.0-59-generic linux-headers-4.4.0-62
  linux-headers-4.4.0-62-generic linux-headers-4.4.0-67
  linux-headers-4.4.0-67-generic linux-image-4.4.0-59-generic
  linux-image-4.4.0-62-generic linux-image-4.4.0-67-generic
  linux-image-4.4.0-77-generic linux-image-extra-4.4.0-59-generic
  linux-image-extra-4.4.0-62-generic linux-image-extra-4.4.0-67-generic
  linux-image-extra-4.4.0-77-generic linux-image-generic thermald
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-67-generic linux-image-4.4.0-77-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-67-generic linux-image-4.4.0-77-generic
0 upgraded, 2 newly installed, 0 to remove and 117 not upgraded.
12 not fully installed or removed.
Need to get 0 B/40.9 MB of archives.
After this operation, 96.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 298724 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-67-generic_4.4.0-67.88_i386.deb ...
Done.
Unpacking linux-image-4.4.0-67-generic (4.4.0-67.88) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-67-generic_4.4.0-67.88_i386.deb (--unpack):
 cannot copy extracted data for './boot/abi-4.4.0-67-generic' to '/boot/abi-4.4.0-67-generic.dpkg-new': failed to write (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)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic
Preparing to unpack .../linux-image-4.4.0-77-generic_4.4.0-77.98_i386.deb ...
Done.
Unpacking linux-image-4.4.0-77-generic (4.4.0-77.98) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-77-generic_4.4.0-77.98_i386.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-77-generic' to '/boot/vmlinuz-4.4.0-77-generic.dpkg-new': failed to write (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)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-77-generic /boot/vmlinuz-4.4.0-77-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-67-generic_4.4.0-67.88_i386.deb
 /var/cache/apt/archives/linux-image-4.4.0-77-generic_4.4.0-77.98_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我读了很多书,觉得应该删除旧的核心,所以我就这么做了

dpkg -l linux-image*

输出为:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
un  linux-image    <none>       <none>       (no description available)
un  linux-image-3. <none>       <none>       (no description available)
rc  linux-image-3. 3.13.0-100.1 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-101.1 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-103.1 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-105.1 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-106.1 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-32.57 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-43.72 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-44.73 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-46.79 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-48.80 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-49.83 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-51.84 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-52.86 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-53.89 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-54.91 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-55.94 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-57.95 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-58.97 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-59.98 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-61.10 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-62.10 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-63.10 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-65.10 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-66.10 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-67.11 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-68.11 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-71.11 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-73.11 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-74.11 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-76.12 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-77.12 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-79.12 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-83.12 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-85.12 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-86.13 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-91.13 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-93.14 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-95.14 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-96.14 i386         Linux kernel image for version 3.
rc  linux-image-3. 3.13.0-98.14 i386         Linux kernel image for version 3.
rc  linux-image-4. 4.4.0-57.78  i386         Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-59.80  i386         Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-62.83  i386         Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-63.84  i386         Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-64.85  i386         Linux kernel image for version 4.
ii  linux-image-4. 4.4.0-66.87  i386         Linux kernel image for version 4.
in  linux-image-4. <none>       i386         (no description available)
in  linux-image-4. <none>       i386         (no description available)
rc  linux-image-ex 3.13.0-100.1 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-101.1 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-103.1 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-105.1 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-106.1 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-32.57 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-43.72 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-44.73 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-46.79 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-48.80 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-49.83 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-51.84 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-52.86 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-53.89 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-54.91 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-55.94 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-57.95 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-58.97 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-59.98 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-61.10 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-62.10 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-63.10 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-65.10 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-66.10 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-67.11 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-68.11 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-71.11 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-73.11 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-74.11 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-76.12 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-77.12 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-79.12 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-83.12 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-85.12 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-86.13 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-91.13 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-93.14 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-95.14 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-96.14 i386         Linux kernel extra modules for ve
rc  linux-image-ex 3.13.0-98.14 i386         Linux kernel extra modules for ve
rc  linux-image-ex 4.4.0-57.78  i386         Linux kernel extra modules for ve
ii  linux-image-ex 4.4.0-59.80  i386         Linux kernel extra modules for ve
ii  linux-image-ex 4.4.0-62.83  i386         Linux kernel extra modules for ve
ii  linux-image-ex 4.4.0-63.84  i386         Linux kernel extra modules for ve
ii  linux-image-ex 4.4.0-64.85  i386         Linux kernel extra modules for ve
iF  linux-image-ex 4.4.0-66.87  i386         Linux kernel extra modules for ve
iU  linux-image-ex 4.4.0-67.88  i386         Linux kernel extra modules for ve
iU  linux-image-ex 4.4.0-77.98  i386         Linux kernel extra modules for ve
iU  linux-image-ge 4.4.0.77.83  i386         Generic Linux kernel image

从这里,我不知道如何删除旧核心。

sudo dpkg --purge linux-image-3.13.0-32.57

给我

dpkg: warning: ignoring request to remove linux-image-3.13.0-32.57 which isn't installed

更新

uname -r

节目

4.4.0-63-generic

不确定在启动时要删除什么(根据@waltinator 的建议)。我似乎在当前核心之上的版本比下面的版本多

ls -la
total 224209
drwxr-xr-x  4 root root     3072 May 14 07:41 .
drwxr-xr-x 22 root root     4096 Mar  8 05:26 ..
-rw-r--r--  1 root root  1240224 Jan  6 12:55 abi-4.4.0-59-generic
-rw-r--r--  1 root root  1240224 Jan 18 08:08 abi-4.4.0-62-generic
-rw-r--r--  1 root root  1241618 Feb  1 14:19 abi-4.4.0-63-generic
-rw-r--r--  1 root root  1241618 Feb 20 05:13 abi-4.4.0-64-generic
-rw-r--r--  1 root root  1241618 Mar  3 09:07 abi-4.4.0-66-generic
-rw-r--r--  1 root root   193442 Jan  6 12:55 config-4.4.0-59-generic
-rw-r--r--  1 root root   193442 Jan 18 08:08 config-4.4.0-62-generic
-rw-r--r--  1 root root   193642 Feb  1 14:19 config-4.4.0-63-generic
-rw-r--r--  1 root root   193642 Feb 20 05:13 config-4.4.0-64-generic
-rw-r--r--  1 root root   193642 Mar  3 09:07 config-4.4.0-66-generic
drwxr-xr-x  5 root root     1024 Mar  8 05:27 grub
-rw-r--r--  1 root root 34262775 Feb  9 04:29 initrd.img-4.4.0-59-generic
-rw-r--r--  1 root root 34265371 Feb  9 04:28 initrd.img-4.4.0-62-generic
-rw-r--r--  1 root root 34257074 Feb 21 12:00 initrd.img-4.4.0-63-generic
-rw-r--r--  1 root root 34258093 Feb 22 16:20 initrd.img-4.4.0-64-generic
-rw-r--r--  1 root root 34256077 Mar  8 05:27 initrd.img-4.4.0-66-generic
drwx------  2 root root    12288 Dec 28  2014 lost+found
-rw-r--r--  1 root root   182704 Jan 28  2016 memtest86+.bin
-rw-r--r--  1 root root   184380 Jan 28  2016 memtest86+.elf
-rw-r--r--  1 root root   184840 Jan 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root  3094845 Jan  6 12:55 System.map-4.4.0-59-generic
-rw-------  1 root root  3094811 Jan 18 08:08 System.map-4.4.0-62-generic
-rw-------  1 root root  3101576 Feb  1 14:19 System.map-4.4.0-63-generic
-rw-------  1 root root  3101576 Feb 20 05:13 System.map-4.4.0-64-generic
-rw-------  1 root root  3101576 Mar  3 09:07 System.map-4.4.0-66-generic
-rw-------  1 root root  6812704 Jan  6 12:55 vmlinuz-4.4.0-59-generic
-rw-------  1 root root  6812928 Jan 18 08:08 vmlinuz-4.4.0-62-generic
-rw-------  1 root root  6828960 Feb  1 14:19 vmlinuz-4.4.0-63-generic
-rw-------  1 root root  6828960 Feb 20 05:13 vmlinuz-4.4.0-64-generic
-rw-------  1 root root  6828960 Mar  3 09:07 vmlinuz-4.4.0-66-generic

答案1

尝试这个:

打开终端,

Ctrl++AltT

运行:

exec sudo -i
CONFOLD=$(dpkg -l | grep '^rc' | awk '{print $2}')
KERNELCUR=$(uname -r | sed 's/-*[a-z]//g' | sed 's/-386//g')
PKGLINUX="linux-(image|headers|ubuntu-modules|restricted-modules)"
METAPKGLINUX="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
KERNELSOLD=$(dpkg -l | awk '{print $2}' | grep -E "$PKGLINUX" | grep -vE "$METAPKGLINUX" | grep -v "$KERNELCUR")
apt-get purge "$CONFOLD"
apt-get purge "$KERNELSOLD"
apt-get autoremove
apt-get clean
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null

答案2

dpkg 的选项--purge与 dpkg 命令不同purge--purge修改指定命令的操作(在本例中为无)。

重新获得一些空间/boot- 删除唯一最旧的单个大文件(用于uname -r查找当前内核的版本,并且不要删除任何以该版本作为文件名一部分的文件),然后恢复dpkg

/usr/bin/purge-old-kernels脚本(包的一部分byobu)为您处理详细信息。

相关内容