清理启动分区的问题

清理启动分区的问题

我尝试将 Ubuntu 18.4 升级到 18.10。最后,它告诉我无法继续,因为我的磁盘空间不足/boot,因此它只进行了部分更新。我重新启动系统,然后出现了 18.10,但告诉我这只是部分升级,因为磁盘空间不足/boot

我尝试释放磁盘空间并出现此错误:

apt autoremove
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

尝试了很多方法,但都无济于事,例如,尝试终止该进程,但每次我终止它时,进程号都会不断变化并重新出现。

df -hT
Filesystem                  Type      Size  Used Avail Use% Mounted on
udev                        devtmpfs   16G     0   16G   0% /dev
tmpfs                       tmpfs     3.2G  3.5M  3.2G   1% /run
/dev/mapper/ubuntu--vg-root ext4      886G  646G  195G  77% /
tmpfs                       tmpfs      16G   28M   16G   1% /dev/shm
tmpfs                       tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs                       tmpfs      16G     0   16G   0% /sys/fs/cgroup
/dev/sda1                   ext2      236M  220M  4.2M  99% /boot
tmpfs                       tmpfs     3.2G   16K  3.2G   1% /run/user/124
tmpfs                       tmpfs     3.2G   36K  3.2G   1% /run/user/1000


dpkg -l linux-*
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
+++-=============================================-===========================-===========================-===============================================================================================
ii  linux-base                                    4.5ubuntu1                  all                         Linux image base package
un  linux-doc-3.11.0                              <none>                      <none>                      (no description available)
un  linux-doc-3.13.0                              <none>                      <none>                      (no description available)
un  linux-doc-4.15.0                              <none>                      <none>                      (no description available)
un  linux-doc-4.4.0                               <none>                      <none>                      (no description available)
ii  linux-firmware                                1.175                       all                         Firmware for Linux kernel drivers
un  linux-firmware-snapdragon                     <none>                      <none>                      (no description available)
ii  linux-generic                                 4.15.0.39.41                amd64                       Complete Generic Linux kernel and headers
un  linux-headers                                 <none>                      <none>                      (no description available)
un  linux-headers-3.0                             <none>                      <none>                      (no description available)
un  linux-headers-3.11.0-19-generic               <none>                      <none>                      (no description available)
un  linux-headers-3.11.0-20-generic               <none>                      <none>                      (no description available)
un  linux-headers-3.11.0-22-generic               <none>                      <none>                      (no description available)
un  linux-headers-3.13.0-93-generic               <none>                      <none>                      (no description available)
ii  linux-headers-4.15.0-39                       4.15.0-39.42                all                         Header files related to Linux kernel version 4.15.0
ii  linux-headers-4.15.0-39-generic               4.15.0-39.42                amd64                       Linux kernel headers for version 4.15.0 on 64 bit x86 SMP
un  linux-headers-4.4.0-34-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-38-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-42-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-47-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-51-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-62-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-63-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-64-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-66-generic                <none>                      <none>                      (no description available)
un  linux-headers-4.4.0-71-generic                <none>                      <none>                      (no description available)
un  linux-headers-686-pae                         <none>                      <none>                      (no description available)
un  linux-headers-amd64                           <none>                      <none>                      (no description available)
ii  linux-headers-generic                         4.15.0.39.41                amd64                       Generic Linux kernel headers
un  linux-image                                   <none>                      <none>                      (no description available)
un  linux-image-3.0                               <none>                      <none>                      (no description available)
rc  linux-image-3.11.0-19-generic                 3.11.0-19.33                amd64                       Linux kernel image for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-3.11.0-20-generic                 3.11.0-20.35                amd64                       Linux kernel image for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-3.11.0-22-generic                 3.11.0-22.38                amd64                       Linux kernel image for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-3.13.0-93-generic                 3.13.0-93.140               amd64                       Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-4.15.0-39-generic                 4.15.0-39.42                amd64                       Signed kernel image generic
rc  linux-image-4.4.0-34-generic                  4.4.0-34.53                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-38-generic                  4.4.0-38.57                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-42-generic                  4.4.0-42.62                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-47-generic                  4.4.0-47.68                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-51-generic                  4.4.0-51.72                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-62-generic                  4.4.0-62.83                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-63-generic                  4.4.0-63.84                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-64-generic                  4.4.0-64.85                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-66-generic                  4.4.0-66.87                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-71-generic                  4.4.0-71.92                 amd64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
un  linux-image-4.4.0-79-generic                  <none>                      <none>                      (no description available)
un  linux-image-4.4.0-91-generic                  <none>                      <none>                      (no description available)
rc  linux-image-extra-3.11.0-19-generic           3.11.0-19.33                amd64                       Linux kernel extra modules for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-extra-3.11.0-20-generic           3.11.0-20.35                amd64                       Linux kernel extra modules for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-extra-3.11.0-22-generic           3.11.0-22.38                amd64                       Linux kernel extra modules for version 3.11.0 on 64 bit x86 SMP
rc  linux-image-extra-3.13.0-93-generic           3.13.0-93.140               amd64                       Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-34-generic            4.4.0-34.53                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-38-generic            4.4.0-38.57                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-42-generic            4.4.0-42.62                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-47-generic            4.4.0-47.68                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-51-generic            4.4.0-51.72                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-62-generic            4.4.0-62.83                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-63-generic            4.4.0-63.84                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-64-generic            4.4.0-64.85                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-66-generic            4.4.0-66.87                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-71-generic            4.4.0-71.92                 amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-79-generic            4.4.0-79.100                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-91-generic            4.4.0-91.114                amd64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                           4.15.0.39.41                amd64                       Generic Linux kernel image
un  linux-image-unsigned-4.15.0-39-generic        <none>                      <none>                      (no description available)
un  linux-initramfs-tool                          <none>                      <none>                      (no description available)
un  linux-kernel-log-daemon                       <none>                      <none>                      (no description available)
ii  linux-modules-4.15.0-39-generic               4.15.0-39.42                amd64                       Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP
ii  linux-modules-extra-4.15.0-39-generic         4.15.0-39.42                amd64                       Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP
un  linux-restricted-common                       <none>                      <none>                      (no description available)
ii  linux-sound-base                              1.0.25+dfsg-0ubuntu5        all                         base package for ALSA and OSS sound systems
un  linux-source-3.11.0                           <none>                      <none>                      (no description available)
un  linux-source-3.13.0                           <none>                      <none>                      (no description available)
un  linux-source-4.15.0                           <none>                      <none>                      (no description available)
un  linux-source-4.4.0                            <none>                      <none>                      (no description available)
un  linux-tools                                   <none>                      <none>                      (no description available)

即使我尝试手动删除,它也不起作用:

apt-get purge linux-image-3.11.0-19-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-3.11.0-19-generic*
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.131ubuntu15) ...
update-initramfs: deferring update (trigger activated)
dpkg: warning: files list file for package 'sphinx-voxforge-hmm-en' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-gmusicbrowser' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'sgml-data' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'sphinx-voxforge-lm-en' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libapt-pkg4.12:amd64' missing; assuming package has no files currently installed
(Reading database ... 220464 files and directories currently installed.)
Purging configuration files for linux-image-3.11.0-19-generic (3.11.0-19.33) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-19-generic /boot/vmlinuz-3.11.0-19-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-19-generic /boot/vmlinuz-3.11.0-19-generic
Processing triggers for initramfs-tools (0.131ubuntu15) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-39-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.15.0-39-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我执行 :dpkg -l linux-* 并看到我试图删除的内容仍然存在。如果我尝试 ,结果也是一样rm -rf

我该怎么办??

答案1

在启动分区中腾出空间。

  1. 删除不需要的包sudo apt autoremove

  2. 删除不需要的内核,除了最新的两个 sudo apt purge $(dpkg -l|egrep 'linux-image-[0-9]|linux-headers-[0-9]'|awk '{print $3,$2}'|grep -v `uname -r|cut -f1,2 -d"-"`|sort -nr|tail -n +4|awk '{ print $2}')

  3. sudo apt autoremove再次。

答案2

  • 首先搜索问题是如何/什么/何时开始的

例如:

如果问题在安装时出现/生成 --> grub

然后,进行更新 -->

 sudo update-grub 

完成后:

运行--> sudo apt-get autoremove sudo apt-get autoclear

希望这会有所帮助!

相关内容