我的其中一台服务器有一个大问题。我需要为 selenium2 安装 firefox。当我输入:
apt-get 安装 Firefox
我得到输出:
Do you want to continue? [Y/n]
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu xenial/main amd64 libjbig0 amd64 2.1-3.1 [26.6 kB]
Get:2 http://nova.clouds.archive.ubuntu.com/ubuntu xenial/main amd64 libvpx3 amd64 1.5.0-2ubuntu1 [732 kB]
Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libxpm4 amd64 1:3.5.11-1ubuntu0.16.04.1 [33.8 kB]
Get:4 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgd3 amd64 2.1.1-4ubuntu0.16.04.8 [126 kB]
Get:5 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 firefox amd64 59.0.2+build1-0ubuntu0.16.04.1 [44.6 MB]
Fetched 45.5 MB in 36s (1,262 kB/s)
Extracting templates from packages: 100%
(Reading database ... 141165 files and directories currently installed.)
Removing linux-image-4.4.0-62-generic (4.4.0-62.83) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-62-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
Searching for GRUB installation directory ... found: /boot/grub
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
Cannot determine root device. Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
/usr/sbin/update-grub-legacy-ec2: line 375: awk: command not found
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-62-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-62-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.4.0-62-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
所以,如果我认为正确的话,我需要安装 awk。所以我输入:
apt-get 安装原始 awk
但这会导致类似的错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-4.4.0-62-generic
The following NEW packages will be installed:
original-awk
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
28 not fully installed or removed.
Need to get 69.0 kB of archives.
After this operation, 64.6 MB disk space will be freed.
Do you want to continue? [Y/n]
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu xenial/universe amd64 original-awk amd64 2012-12-20-5 [69.0 kB]
Fetched 69.0 kB in 1s (59.6 kB/s)
(Reading database ... 141165 files and directories currently installed.)
Removing linux-image-4.4.0-62-generic (4.4.0-62.83) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-62-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
Searching for GRUB installation directory ... found: /boot/grub
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
Cannot determine root device. Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
/usr/sbin/update-grub-legacy-ec2: line 375: awk: command not found
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-62-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-62-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.4.0-62-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
也apt-get upgrade
给出同样的错误。我可以做什么?
uname -a
返回:
Linux vps395796 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux.
编辑:这不起作用。使用 --fix-broken 标志安装会出现与以前相同的错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-4.4.0-62-generic
The following NEW packages will be installed:
original-awk
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
28 not fully installed or removed.
Need to get 0 B/69.0 kB of archives.
After this operation, 64.6 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 141165 files and directories currently installed.)
Removing linux-image-4.4.0-62-generic (4.4.0-62.83) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-62-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
Searching for GRUB installation directory ... found: /boot/grub
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
Cannot determine root device. Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
/usr/sbin/update-grub-legacy-ec2: line 375: awk: command not found
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-62-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-62-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.4.0-62-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg --remove linux-image-4.4.0-62-generic 重新运行错误:
(Reading database ... 141165 files and directories currently installed.)
Removing linux-image-4.4.0-62-generic (4.4.0-62.83) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-62-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-62-generic /boot/vmlinuz-4.4.0-62-generic
Searching for GRUB installation directory ... found: /boot/grub
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
Cannot determine root device. Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
/usr/sbin/update-grub-legacy-ec2: line 375: awk: command not found
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-62-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-62-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-4.4.0-62-generic
答案1
问题是 APT 首先尝试完成系统中待处理的事务。就您而言,这意味着删除不再使用的旧内核。但这一步正在被破坏,因为缺少“awk”......
您可以尝试以下方法来修复您的系统:
$ sudo apt-get install --fix-broken original-awk
如果仍然失败,请尝试手动删除该包:
$ sudo dpkg --remove linux-image-4.4.0-62-generic
希望其中之一能够修复您的系统并允许您继续进行软件包安装。