在收到有关 PHP5 安全漏洞的最新公告(Ubuntu 安全通知 USN-2254-1)后,我决定升级我的服务器,但遇到了一些问题。列出的新软件包如下:
libapache2-mod-php5 5.3.10-1ubuntu3.12
php5-cgi 5.3.10-1ubuntu3.12
php5-cli 5.3.10-1ubuntu3.12
php5-fpm 5.3.10-1ubuntu3.12
但无论我做什么,我都会收到这些错误。这是我从控制台获得的典型输出:
# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 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 libapache2-mod-php5 (5.3.10-1ubuntu3.12) ...
/usr/bin/ucf: line 520: awk: command not found
dpkg: error processing libapache2-mod-php5 (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up php5-cgi (5.3.10-1ubuntu3.12) ...
/usr/bin/ucf: line 520: awk: command not found
dpkg: error processing php5-cgi (--configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of php5:
php5 depends on libapache2-mod-php5 (>= 5.3.10-1ubuntu3.12) | libapache2-mod-php5filter (>= 5.3.10-1ubuntu3.12) | php5-cgi (>= 5.3.10-1ubuntu3.12) | php5-fpm (>= 5.3.10-1ubuntu3.12); however:
Package libapache2-mod-php5 is not configured yet.
Package libapache2-mod-php5filter is not installed.
Package php5-cgi is not configured yet.
Package php5-fpm is not installed.
dpkg: error processing php5 (--configure):
dependency problems - leaving unconfigured
Setting up php5-cli (5.3.10-1ubuntu3.12) ...
/usr/bin/ucf: line 520: awk: command not found
dpkg: error processing php5-cli (--configure):
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
libapache2-mod-php5
php5-cgi
php5
php5-cli
E: Sub-process /usr/bin/dpkg returned an error code (1)
这种情况以前从未发生过,所以认为这是最新更新的结果?
到目前为止,我已经尝试过以不同的方式重新安装软件包,但总是回到这个错误列表。
awk: command not found
更新:我在其他事情上也遇到了同样的错误......
PS 系统是 Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-64-generic-pae i686)
答案1
为了修复 awk 损坏的替代链接,请尝试:
sudo update-alternatives --set awk /usr/bin/mawk
使用命令验证是否已修复:
awk '{print $0}' /etc/passwd
重做 apt 命令:
apt-get dist-upgrade
如果此方法不起作用且目录 /etc/alternatives 不存在,请尝试:
sudo mkdir /etc/alternatives
sudo update-alternatives --all
选择一切处于“自动”模式。