运行 apt-get upgrade 时出错(Ubuntu 14.04 LTS)

运行 apt-get upgrade 时出错(Ubuntu 14.04 LTS)

我跑了

    apt-get update
    apt-get upgrade

一切都很顺利,直到发生了这样的事情:

Preparing to unpack .../mysql-server-5.5_5.5.50-0ubuntu0.14.04.1_amd64.deb ...
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 33.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 48.
open2: fork failed: Cannot allocate memory at /usr/share/perl5/Debconf/ConfModule.pm line 59.
dpkg: warning: subprocess old pre-removal script returned error exit status 12
dpkg: trying script from the new package instead ...
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 33.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 48.
open2: fork failed: Cannot allocate memory at /usr/share/perl5/Debconf/ConfModule.pm line 59.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.50-0ubuntu0.14.04.1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 12
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 33.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Debconf/FrontEnd/ScreenSize.pm line 48.
open2: fork failed: Cannot allocate memory at /usr/share/perl5/Debconf/ConfModule.pm line 59.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 12
Preparing to unpack .../mysql-client-core-5.5_5.5.50-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.5 (5.5.50-0ubuntu0.14.04.1) over (5.5.49-0ubuntu0.14.04.1) ...
Preparing to unpack .../mysql-client-5.5_5.5.50-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.5 (5.5.50-0ubuntu0.14.04.1) over (5.5.49-0ubuntu0.14.04.1) ...
dpkg: unrecoverable fatal error, aborting:
 fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)

所以我运行:

    # free -m
             total       used       free     shared    buffers     cached
Mem:           992        693        298         16         16        144
-/+ buffers/cache:        532        459
Swap:            0          0          0

在我看来,这似乎足够运行更新。接下来我尝试:

# dpkg --configure -a
Setting up mysql-client-core-5.5 (5.5.50-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libcurl3-gnutls:amd64 (7.35.0-1ubuntu2.8) ...
Setting up libdrm2:amd64 (2.4.67-1ubuntu0.14.04.1) ...
Setting up libdrm-radeon1:amd64 (2.4.67-1ubuntu0.14.04.1) ...
Setting up libdrm-nouveau2:amd64 (2.4.67-1ubuntu0.14.04.1) ...
Setting up libcurl3:amd64 (7.35.0-1ubuntu2.8) ...
Setting up libmysqlclient18:amd64 (5.5.50-0ubuntu0.14.04.1) ...
Setting up libavahi-common-data:amd64 (0.6.31-4ubuntu1.1) ...
Setting up libavahi-common3:amd64 (0.6.31-4ubuntu1.1) ...
Setting up libdrm-intel1:amd64 (2.4.67-1ubuntu0.14.04.1) ...
Setting up libavahi-client3:amd64 (0.6.31-4ubuntu1.1) ...
Setting up mysql-client-5.5 (5.5.50-0ubuntu0.14.04.1) ...
Setting up curl (7.35.0-1ubuntu2.8) ...
dpkg: error processing package mysql-server-5.5 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server

目前,我不确定我需要修复什么问题。如果有人能给我指明正确的方向,我将不胜感激。

谢谢!

答案1

为了增加可见性,下面是我修复它的方法:

apt-get -f install

谢谢,@Kuntal Majumder

相关内容