GNU/Linux >> Znalost Linux >  >> Ubuntu

Balíčky poškozeného jádra Ubuntu 16.04 mi nedovolí nic nainstalovat nebo odebrat pomocí Apt-get?

Kdykoli se pokusím s apt-get něco udělat, ať už jde o instalaci, odstranění, vyčištění, aktualizaci, upgrade, vždy se mi objeví stejná chyba.

[email protected]:~/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)

Zkoušel jsem postupovat podle této otázky, ale bez úspěchu:
Apt neodstraní částečně nainstalované jádro a nemůže nainstalovat žádné další balíčky

při kontrole stavového souboru dpkg vidím, že oba balíčky jsou napůl nainstalovány

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.

** Úpravy

Související:Ubuntu – Jak deaktivovat `apt-daily.service` na cloudovém obrazu virtuálního počítače Ubuntu?

po ručním odstranění balíčků jádra podle pokynů user.dz
paste.ubuntu.com/23487716

mezitím během sudo apt-get install -f mě Ubuntu upozornilo na systémovou chybu

Přijatá odpověď:

Poznámka: Jak ChaiT.Rex komentoval níže, k vyřešení problému jsou potřeba pouze kroky 4 a 5.

Kroky 1,2 a 3 nechávám zdokumentované pro každého, kdo může potřebovat ručně odstranit některé balíčky. Ale zkuste nejprve toto https://askubuntu.com/a/490677/26246, které vypadá jednodušeji.

  1. Odstraňte je ručně, buďte opatrní pokud přepisujete níže uvedené příkazy rm -rf je nebezpečný příkaz, když je spuštěn jako 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*
    
  2. Změňte jejich stav ve stavovém souboru dpkg.

    Pro každý případ zálohujte

    sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.backup0
    

    Najděte související položky (příkaz s očekávaným výstupem, číslo řádku se bude lišit):

    ~$ 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
    

    Otevřete stavový soubor pro úpravu a změnu stavu balíčku:

    sudo nano +18488 /var/lib/dpkg/status
    

    od:

    Package: linux-image-extra-4.4.0-38-generic
    Status: install ok installed
    

    komu:

    Package: linux-image-extra-4.4.0-38-generic
    Status: deinstall ok config-files
    

    Ctrl +o zachránit. Ctrl +x pro ukončení.

    Proveďte stejné změny v linux-image-extra-4.4.0-42-generic.

  3. Ručně odstraňte také linux-image-4.4.0-38-generic a 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
    

    Stejně jako předtím upravte jejich stav na 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
    
  4. Odstraňte problémový soubor virtualbox

    sudo rm /etc/kernel/postinst.d/vboxadd
    
  5. Aktualizujte stav dpkg a nabídku grub

    sudo dpkg --audit
    sudo apt-get install -f
    sudo update-grub
    

Ubuntu
  1. Rozbité balíčky Ubuntu 16.04 po nové instalaci?

  2. Jak nainstalovat Gfortran?

  3. Apt-Get Seznam nainstalovaných balíčků | Seznam nainstalovaný pomocí Apt na Ubuntu

  1. Valgrind – problém s drženými rozbitými balíčky?

  2. Proč centrum softwaru Ubuntu nenainstaluje soubory .deb?

  3. Nainstalovat/odebrat seznam balíčků z příkazového řádku pomocí Apt-get?

  1. Nainstalujte balíčky RPM na Ubuntu

  2. Problémy s instalací Opencv ve Studiu 12.04 – přerušené závislosti?

  3. Jak nainstalovat místní balíčky .deb pomocí apt-get