升级到 Ubuntu 16.04 后无法安装软件包

升级到 Ubuntu 16.04 后无法安装软件包

我的 Ubuntu 服务器运行在具有 512mb RAM 的 VPS 上。我将其从 14.04 升级到 16.04。我正在尝试安装 phpmyadmin,但出现了一些错误:

~$ sudo apt-get install phpmyadmin
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-72-generic : Depends: linux-image-4.4.0-72-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-4.4.0-72-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

sudo apt-get autoremove:

$ 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-72-generic : Depends: linux-image-4.4.0-72-generic but it is not installed
linux-image-generic : Depends: linux-image-4.4.0-72-generic but it is not    installed
E: Unmet dependencies. Try using -f.

sudo purge-old-kernels:

 $ sudo purge-old-kernels
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-3.13.0-110-generic : Depends: linux-image-3.13.0-110-generic but it is not going to be installed
linux-image-extra-4.4.0-64-generic : Depends: linux-image-4.4.0-64-generic  but it is not going to be installed
linux-image-extra-4.4.0-66-generic : Depends: linux-image-4.4.0-66-generic but it is not going to be installed
linux-image-extra-4.4.0-72-generic : Depends: linux-image-4.4.0-72-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-4.4.0-72-generic but it is not going to be installed
 E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

sudo apt-get -f install:

 $ 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:
apache2-bin dbconfig-common dbconfig-mysql libapr1 libaprutil1 libaprutil1-   dbd-sqlite3 libaprutil1-ldap libicu52 libjs-sphinxdoc libjs-underscore    libmysqlclient18 libzip4
  linux-headers-3.13.0-110 linux-headers-3.13.0-110-generic linux-headers- 4.4.0-64 linux-headers-4.4.0-64-generic linux-headers-4.4.0-66 linux-headers-4.4.0-66-generic
  linux-image-3.13.0-110-generic linux-image-4.4.0-64-generic linux-image-4.4.0-66-generic linux-image-extra-3.13.0-110-generic linux-image-extra-4.4.0-64-generic
  linux-image-extra-4.4.0-66-generic php-phpseclib php-tcpdf
  Use 'sudo apt autoremove' to remove them.
 The following additional packages will be installed:
  linux-image-4.4.0-72-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-72-generic
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
4 not fully installed or removed.
Need to get 0 B/21.8 MB of archives.
After this operation, 66.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 230179 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-72-generic_4.4.0-72.93_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-72-generic (4.4.0-72.93) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-72-  generic_4.4.0-72.93_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-72-generic' to '/boot  /vmlinuz-4.4.0-72-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-72-generic    /boot/vmlinuz-4.4.0-72-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-72-generic /boot/vmlinuz-4.4.0-72-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-72-generic_4.4.0-72.93_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

df -ah:

    $ df -ah
Filesystem                   Size  Used Avail Use% Mounted on
sysfs                           0     0     0    - /sys
proc                            0     0     0    - /proc
udev                         226M     0  226M   0% /dev
devpts                          0     0     0    - /dev/pts
tmpfs                         49M  2.5M   47M   6% /run
/dev/mapper/ubuntu--vg-root   19G  6.5G   12G  37% /
securityfs                      0     0     0    - /sys/kernel/security
tmpfs                        245M     0  245M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        245M     0  245M   0% /sys/fs/cgroup
cgroup                          0     0     0    - /sys/fs/cgroup/systemd
pstore                          0     0     0    - /sys/fs/pstore
cgroup                          0     0     0    - /sys/fs/cgroup/blkio
cgroup                          0     0     0    - /sys/fs/cgroup/net_cls,net_prio
cgroup                          0     0     0    - /sys/fs/cgroup/cpuset
cgroup                          0     0     0    - /sys/fs/cgroup/devices
cgroup                          0     0     0    - /sys/fs/cgroup/cpu,cpuacct
cgroup                          0     0     0    - /sys/fs/cgroup/hugetlb
cgroup                          0     0     0    - /sys/fs/cgroup/freezer
cgroup                          0     0     0    - /sys/fs/cgroup/perf_event
cgroup                          0     0     0    - /sys/fs/cgroup/memory
cgroup                          0     0     0    - /sys/fs/cgroup/pids
systemd-1                       -     -     -    - /proc/sys/fs/binfmt_misc
fusectl                         0     0     0    - /sys/fs/fuse/connections
mqueue                          0     0     0    - /dev/mqueue
debugfs                         0     0     0    - /sys/kernel/debug
hugetlbfs                       0     0     0    - /dev/hugepages
/dev/vda1                    236M  229M     0 100% /boot
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                         49M     0   49M   0% /run/user/1000
binfmt_misc                     0     0     0    - /proc/sys/fs/binfmt_misc
pishva2005@parslet:~$ 

我不知道它是否boot已满或者其他原因导致了这个问题。

答案1

apt-get 命令无法正常运行,因为您的 /boot 分区已达到其最大容量。可能发生的情况是某些内核升级未完全执行,因此 apt-get 卡住并将保持冻结状态,直到您清除 /boot 中的一些空间。通过以下方式找出已安装的内核版本:

dpkg --list 'linux-image*'

检查当前正在使用的版本

uname -r

删除不再需要的内核安装

sudo apt-get remove linux-image-version

用内核版本替换版本。之后

sudo apt-get autoremove

sudo update-grub

最后更新 grub。

相关内容