インストール、削除、パージ、更新、アップグレードなど、apt-getで何かを行おうとすると、常に同じエラーが発生します。
ses@ses-VirtualBox:~/Downloads$ Sudo apt-get install ssh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-45 linux-headers-4.4.0-45-generic linux-image-4.4.0-45-generic linux-image-extra-4.4.0-45-generic
Use 'Sudo apt autoremove' to remove them.
The following additional packages will be installed:
ncurses-term openssh-server openssh-sftp-server ssh-import-id
Suggested packages:
ssh-askpass rssh molly-guard monkeysphere
The following packages will be REMOVED:
linux-image-extra-4.4.0-38-generic linux-image-extra-4.4.0-42-generic
The following NEW packages will be installed:
ncurses-term openssh-server openssh-sftp-server ssh ssh-import-id
0 upgraded, 5 newly installed, 2 to remove and 0 not upgraded.
10 not fully installed or removed.
Need to get 0 B/643 kB of archives.
After this operation, 320 MB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
(Reading database ... 308434 files and directories currently installed.)
Removing linux-image-extra-4.4.0-38-generic (4.4.0-38.57) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: executing /etc/kernel/postinst.d/vboxadd 4.4.0-38-generic /boot/vmlinuz-4.4.0-38-generic
run-parts: failed to exec /etc/kernel/postinst.d/vboxadd: Exec format error
run-parts: /etc/kernel/postinst.d/vboxadd exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-38-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-42-generic (4.4.0-42.62) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: executing /etc/kernel/postinst.d/vboxadd 4.4.0-42-generic /boot/vmlinuz-4.4.0-42-generic
run-parts: failed to exec /etc/kernel/postinst.d/vboxadd: Exec format error
run-parts: /etc/kernel/postinst.d/vboxadd exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-42-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-38-generic
linux-image-extra-4.4.0-42-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
私はこの質問に従ってみましたが、運はありません: Aptは部分的にインストールされたカーネルを削除できず、他のパッケージをインストールできません
dpkgステータスファイルの確認両方のパッケージが半分インストールされていることがわかります
Package: linux-image-extra-4.4.0-38-generic
Status: deinstall ok half-installed
Priority: optional
Section: kernel
Installed-Size: 158607
Maintainer: Ubuntu Kernel Team <[email protected]>
Architecture: AMD64
Source: linux
Version: 4.4.0-38.57
Depends: linux-image-4.4.0-38-generic, crda | wireless-crda
Description: Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
This package contains the Linux kernel extra modules for version 4.4.0 on
64 bit x86 SMP.
.
Also includes the corresponding System.map file, the modules built by the
packager, and scripts that try to ensure that the system is not left in an
unbootable state after an update.
.
Supports Generic processors.
.
Geared toward desktop and server systems.
.
You likely do not want to install this package directly. Instead, install
the linux-generic meta-package, which will ensure that upgrades work
correctly, and that supporting packages are also installed.
**編集
user.dzの指示に従って手動でカーネルパッケージを削除した後 paste.ubuntu.com/23487716
注:ChaiT.Rexが以下にコメントしたように、問題を修正するには手順4と5のみが必要です。
一部のパッケージを手動で削除する必要がある人のために、手順1、2、3を文書化したままにします。しかし、最初にこれを試してください https://askubuntu.com/a/490677/26246 これは簡単に見えます。
それらを手動で削除してください、注意してください以下のコマンドを再入力する場合rm -rf
は、rootとして実行すると危険なコマンドです。
Sudo rm -rf /lib/modules/4.4.0-38-generic /lib/modules/4.4.0-42-generic
Sudo rm -rf /usr/share/doc/linux-image-extra-4.4.0-38-generic /usr/share/doc/linux-image-extra-4.4.0-42-generic
Sudo rm /var/lib/dpkg/info/linux-image-extra-4.4.0-38-generic* /var/lib/dpkg/info/linux-image-extra-4.4.0-42-generic*
Dpkgステータスファイルでステータスを変更します。
念のためバックアップを作成する
Sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.backup0
関連エントリを検索します(予想される出力のコマンド。行番号は異なります)。
~$ grep -n -e "linux-image-extra-4.4.0-38-generic" -e "linux-image-extra-4.4.0-42-generic" /var/lib/dpkg/status
18488:Package: linux-image-extra-4.4.0-42-generic
77123:Package: linux-image-extra-4.4.0-38-generic
編集のためにステータスファイルを開き、パッケージステータスを変更します。
Sudo nano +18488 /var/lib/dpkg/status
から:
Package: linux-image-extra-4.4.0-38-generic
Status: install ok installed
に:
Package: linux-image-extra-4.4.0-38-generic
Status: deinstall ok config-files
Ctrl+o 保存する。 Ctrl+x 出る。
Linux-image-extra-4.4.0-42-genericにも同じ変更を加えます。
Linux-image-4.4.0-38-genericとlinux-image-4.4.0-42-genericも手動で削除します
Sudo rm -f *4.4.0-38-generic *4.4.0-42-generic
Sudo rm -rf /usr/share/doc/linux-image-4.4.0-38-generic /usr/share/doc/linux-image-4.4.0-42-generic
ステータスをdeinstall ok config-files
に編集する前と同じ
$ grep -n -e "Package: linux-image-4.4.0-38-generic" -e "Package: linux-image-4.4.0-42-generic" /var/lib/dpkg/status
61217:Package: linux-image-4.4.0-38-generic
98051:Package: linux-image-4.4.0-42-generic
面倒な仮想ボックスファイルを削除する
Sudo rm /etc/kernel/postinst.d/vboxadd
DpkgステータスとGRUBメニューを更新
Sudo dpkg --audit
Sudo apt-get install -f
Sudo update-grub